Commit fcd3a1d6 by Douglas Hall

Merge pull request #287 from edx/ibrahimahmed443/SOL-1702-proctored-option-available-bug

fix the bug where 'Proctored Option available' appears on the left pa…
parents 323d961b a2f9f85a
......@@ -1309,6 +1309,11 @@ STATUS_SUMMARY_MAP = {
'short_description': _('Failed Proctoring'),
'suggested_icon': 'fa-exclamation-triangle',
'in_completed_state': True
},
ProctoredExamStudentAttemptStatus.expired: {
'short_description': _('Proctored Option No Longer Available'),
'suggested_icon': 'fa-times-circle',
'in_completed_state': False
}
}
......@@ -1375,12 +1380,17 @@ def get_attempt_status_summary(user_id, course_id, content_id):
# practice exams always has an attempt status regardless of
# eligibility
if credit_service and not exam['is_practice_exam']:
credit_state = credit_service.get_credit_state(user_id, unicode(course_id))
credit_state = credit_service.get_credit_state(user_id, unicode(course_id), return_course_info=True)
if not _check_eligibility_of_enrollment_mode(credit_state):
return None
attempt = get_exam_attempt(exam['id'], user_id)
status = attempt['status'] if attempt else ProctoredExamStudentAttemptStatus.eligible
if attempt:
status = attempt['status']
elif not exam['is_practice_exam'] and has_due_date_passed(credit_state.get('course_end_date', None)):
status = ProctoredExamStudentAttemptStatus.expired
else:
status = ProctoredExamStudentAttemptStatus.eligible
status_map = STATUS_SUMMARY_MAP if not exam['is_practice_exam'] else PRACTICE_STATUS_SUMMARY_MAP
......
......@@ -165,6 +165,9 @@ class ProctoredExamStudentAttemptStatus(object):
# the exam is believed to be in error
error = 'error'
# the course end date has passed
expired = 'expired'
# status alias for sending email
status_alias_mapping = {
submitted: _('pending'),
......
......@@ -1215,6 +1215,24 @@ class ProctoredExamApiTests(LoggedInTestCase):
)
self.assertIsNone(rendered_response)
def test_proctored_status_summary_passed_end_date(self):
"""
Assert that we get the expected status summaries
"""
set_runtime_service('credit', MockCreditServiceWithCourseEndDate())
exam = get_exam_by_id(self.proctored_exam_id)
summary = get_attempt_status_summary(self.user.id, exam['course_id'], exam['content_id'])
expected = {
'status': ProctoredExamStudentAttemptStatus.expired,
'short_description': 'Proctored Option No Longer Available',
'suggested_icon': 'fa-times-circle',
'in_completed_state': False
}
self.assertIn(summary, [expected])
def test_practice_exam_passed_end_date(self):
"""
Verify that we get a None back on a practice exam
......@@ -2331,6 +2349,14 @@ class ProctoredExamApiTests(LoggedInTestCase):
'suggested_icon': 'fa-pencil-square-o',
'in_completed_state': False
}
),
(
ProctoredExamStudentAttemptStatus.expired, {
'status': ProctoredExamStudentAttemptStatus.expired,
'short_description': 'Proctored Option No Longer Available',
'suggested_icon': 'fa-times-circle',
'in_completed_state': False
}
)
)
@ddt.unpack
......
......@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):
setup(
name='edx-proctoring',
version='0.12.14',
version='0.12.15',
description='Proctoring subsystem for Open edX',
long_description=open('README.md').read(),
author='edX',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment