Add Comments to verify_student/views.py

This commit is contained in:
Zainab Amir
2019-03-08 15:46:00 +05:00
committed by GitHub

View File

@@ -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)