def handle(self, *args, **options): """ Management command entry point, simply call into the signal firiing """ # pylint: disable=import-outside-toplevel from edx_proctoring.api import (update_attempt_status, get_exam_by_id) exam_id = options['exam_id'] user_id = options['user_id'] to_status = options['to_status'] msg = (u'Running management command to update user {user_id} ' u'attempt status on exam_id {exam_id} to {to_status}'.format( user_id=user_id, exam_id=exam_id, to_status=to_status)) self.stdout.write(msg) if not ProctoredExamStudentAttemptStatus.is_valid_status(to_status): raise CommandError( u'{to_status} is not a valid attempt status!'.format( to_status=to_status)) # get exam, this will throw exception if does not exist, so let it bomb out get_exam_by_id(exam_id) update_attempt_status(exam_id, user_id, to_status) self.stdout.write('Completed!')
def handle(self, *args, **options): """ Management command entry point, simply call into the signal firiing """ from edx_proctoring.api import ( update_attempt_status, get_exam_by_id ) exam_id = options['exam_id'] user_id = options['user_id'] to_status = options['to_status'] msg = ( 'Running management command to update user {user_id} ' 'attempt status on exam_id {exam_id} to {to_status}'.format( user_id=user_id, exam_id=exam_id, to_status=to_status ) ) self.stdout.write(msg) if not ProctoredExamStudentAttemptStatus.is_valid_status(to_status): raise CommandError('{to_status} is not a valid attempt status!'.format(to_status=to_status)) # get exam, this will throw exception if does not exist, so let it bomb out get_exam_by_id(exam_id) update_attempt_status(exam_id, user_id, to_status) self.stdout.write('Completed!')
def handle(self, *args, **options): """ Management command entry point, simply call into the signal firiing """ # pylint: disable=import-outside-toplevel from edx_proctoring.api import update_attempt_status attempt_id = options['attempt_id'] to_status = options['to_status'] msg = (u'Running management command to update ' u'attempt {attempt_id} status to {to_status}'.format( attempt_id=attempt_id, to_status=to_status)) self.stdout.write(msg) if not ProctoredExamStudentAttemptStatus.is_valid_status(to_status): raise CommandError( u'{to_status} is not a valid attempt status!'.format( to_status=to_status)) update_attempt_status(attempt_id, to_status) self.stdout.write('Completed!')