diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index 39c8ea601b38e58595082e46c3ececff153fdc6e..a5a7c901c8f4f590469028a6a36ac121eafa828f 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)