From 68a40cd7705236f069b68f3fbc53465a2b9ad8b6 Mon Sep 17 00:00:00 2001 From: Zainab Amir <zainabamir16@outlook.com> Date: Fri, 8 Mar 2019 12:21:37 +0500 Subject: [PATCH] Add comments for code implementation --- lms/djangoapps/verify_student/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index 39c8ea601b3..a5a7c901c8f 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -1165,6 +1165,11 @@ def results_callback(request): verification = SoftwareSecurePhotoVerification.objects.filter(status='approved', user_id=attempt.user_id) if verification: log.info(u'Making expiry date of previous approved verification NULL for {}'.format(attempt.user_id)) + # The updated_at field in sspv model has auto_now set to True, which means any time save() is called on + # the model instance, `updated_at` will change. Some of the existing functionality of verification + # (showing your verification has expired on dashboard) relies on updated_at. + # In case the attempt.approve() fails for some reason and to not cause any inconsistencies in existing + # functionality update() is called instead of save() previous_verification = verification.latest('updated_at') SoftwareSecurePhotoVerification.objects.filter(pk=previous_verification.pk ).update(expiry_date=None, expiry_email_date=None) -- GitLab