def on_attempt_changed(sender, instance, signal, **kwargs): # pylint: disable=unused-argument """ Archive the exam attempt whenever the attempt status is about to be modified. Make a new entry with the previous value of the status in the ProctoredExamStudentAttemptHistory table. """ if signal is pre_save: if instance.id: # on an update case, get the original # and see if the status has changed, if so, then we need # to archive it original = sender.objects.get(id=instance.id) if original.status != instance.status: instance = original else: return else: return else: # remove the attempt on the backend # timed exams have no backend backend = get_backend_provider(name=instance.proctored_exam.backend) if backend: result = backend.remove_exam_attempt(instance.proctored_exam.external_id, instance.external_id) if not result: log.error('Failed to remove attempt %d from %s', instance.id, backend.verbose_name) models.archive_model(models.ProctoredExamStudentAttemptHistory, instance, id='attempt_id')
def on_attempt_changed(sender, instance, signal, **kwargs): # pylint: disable=unused-argument """ Archive the exam attempt whenever the attempt status is about to be modified. Make a new entry with the previous value of the status in the ProctoredExamStudentAttemptHistory table. """ if signal is pre_save: if instance.id: # on an update case, get the original # and see if the status has changed, if so, then we need # to archive it original = sender.objects.get(id=instance.id) if original.status != instance.status: instance = original else: return else: return else: # remove the attempt on the backend # timed exams have no backend backend = get_backend_provider(name=instance.proctored_exam.backend) if backend: result = backend.remove_exam_attempt( instance.proctored_exam.external_id, instance.external_id) if not result: log.error(u'Failed to remove attempt %d from %s', instance.id, backend.verbose_name) models.archive_model(models.ProctoredExamStudentAttemptHistory, instance, id='attempt_id')
def on_review_policy_changed(sender, instance, signal, **kwargs): # pylint: disable=unused-argument """ Archiving all changes made to the Review Policy. Will only archive on update/delete, and not on new entries created. """ if signal is pre_save: if instance.id: instance = sender.objects.get(id=instance.id) else: return models.archive_model(models.ProctoredExamReviewPolicyHistory, instance, id='original_id')
def on_review_policy_changed(sender, instance, signal, **kwargs): # pylint: disable=unused-argument """ Archiving all changes made to the Review Policy. Will only archive on update/delete, and not on new entries created. """ if signal is pre_save: if instance.id: instance = sender.objects.get(id=instance.id) else: return models.archive_model(models.ProctoredExamReviewPolicyHistory, instance, id='original_id')
def on_review_changed(sender, instance, signal, **kwargs): # pylint: disable=unused-argument """ Archiving all changes made to the Review. Will only archive on update/delete, and not on new entries created. """ if signal is pre_save: if instance.id: # only for update cases instance = sender.objects.get(id=instance.id) else: # don't archive on create return models.archive_model(models.ProctoredExamSoftwareSecureReviewHistory, instance, id='review_id')
def on_review_changed(sender, instance, signal, **kwargs): # pylint: disable=unused-argument """ Archiving all changes made to the Review. Will only archive on update/delete, and not on new entries created. """ if signal is pre_save: if instance.id: # only for update cases instance = sender.objects.get(id=instance.id) else: # don't archive on create return models.archive_model(models.ProctoredExamSoftwareSecureReviewHistory, instance, id='review_id')
def on_attempt_changed(sender, instance, signal, **kwargs): # pylint: disable=unused-argument """ Archive the exam attempt whenever the attempt status is about to be modified. Make a new entry with the previous value of the status in the ProctoredExamStudentAttemptHistory table. """ if signal is pre_save: if instance.id: # on an update case, get the original # and see if the status has changed, if so, then we need # to archive it original = sender.objects.get(id=instance.id) if original.status != instance.status: instance = original else: return else: return models.archive_model(models.ProctoredExamStudentAttemptHistory, instance, id='attempt_id')