diff --git a/common/djangoapps/student/helpers.py b/common/djangoapps/student/helpers.py index d6093e8c01..38308e6721 100644 --- a/common/djangoapps/student/helpers.py +++ b/common/djangoapps/student/helpers.py @@ -53,6 +53,7 @@ VERIFY_STATUS_NEED_TO_VERIFY = "verify_need_to_verify" VERIFY_STATUS_SUBMITTED = "verify_submitted" VERIFY_STATUS_APPROVED = "verify_approved" VERIFY_STATUS_MISSED_DEADLINE = "verify_missed_deadline" +VERIFY_STATUS_NEED_TO_REVERIFY = "verify_need_to_reverify" def check_verify_status_by_course(user, course_enrollment_pairs, all_course_modes): @@ -64,6 +65,8 @@ def check_verify_status_by_course(user, course_enrollment_pairs, all_course_mode but has have not yet been approved. * VERIFY_STATUS_APPROVED: The student has been successfully verified. * VERIFY_STATUS_MISSED_DEADLINE: The student did not submit photos within the course's deadline. + * VERIFY_STATUS_NEED_TO_REVERIFY: The student has an active verification, but it is + set to expire before the verification deadline for the course. It is is also possible that a course does NOT have a verification status if: * The user is not enrolled in a verified mode, meaning that the user didn't pay. @@ -142,12 +145,12 @@ def check_verify_status_by_course(user, course_enrollment_pairs, all_course_mode ) if status is None and not submitted: if deadline is None or deadline > datetime.now(UTC): - # If a user already has an active or pending verification, - # but it will expire by the deadline, the we do NOT show the - # verification message. This is because we don't currently - # allow users to resubmit an attempt before their current - # attempt expires. - if not has_active_or_pending: + if has_active_or_pending: + # The user has an active verification, but the verification + # is set to expire before the deadline. Tell the student + # to reverify. + status = VERIFY_STATUS_NEED_TO_REVERIFY + else: status = VERIFY_STATUS_NEED_TO_VERIFY else: status = VERIFY_STATUS_MISSED_DEADLINE diff --git a/common/djangoapps/student/tests/test_verification_status.py b/common/djangoapps/student/tests/test_verification_status.py index dfaa1908e1..d9949c8db1 100644 --- a/common/djangoapps/student/tests/test_verification_status.py +++ b/common/djangoapps/student/tests/test_verification_status.py @@ -13,7 +13,8 @@ from student.helpers import ( VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED, VERIFY_STATUS_APPROVED, - VERIFY_STATUS_MISSED_DEADLINE + VERIFY_STATUS_MISSED_DEADLINE, + VERIFY_STATUS_NEED_TO_REVERIFY ) from xmodule.modulestore.tests.factories import CourseFactory @@ -209,7 +210,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase): # Expect that the "verify now" message is hidden # (since the user isn't allowed to submit another attempt while # a verification is active). - self._assert_course_verification_status(None) + self._assert_course_verification_status(VERIFY_STATUS_NEED_TO_REVERIFY) def _setup_mode_and_enrollment(self, deadline, enrollment_mode): """Create a course mode and enrollment. @@ -235,7 +236,8 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase): VERIFY_STATUS_NEED_TO_VERIFY: "ID verification pending", VERIFY_STATUS_SUBMITTED: "ID verification pending", VERIFY_STATUS_APPROVED: "ID Verified Ribbon/Badge", - VERIFY_STATUS_MISSED_DEADLINE: "Honor" + VERIFY_STATUS_MISSED_DEADLINE: "Honor", + VERIFY_STATUS_NEED_TO_REVERIFY: "Honor" } NOTIFICATION_MESSAGES = { @@ -245,6 +247,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase): ], VERIFY_STATUS_SUBMITTED: ["Thanks for your patience as we process your request."], VERIFY_STATUS_APPROVED: ["You have already verified your ID!"], + VERIFY_STATUS_NEED_TO_REVERIFY: ["Your verification will expire soon!"] } MODE_CLASSES = { @@ -252,7 +255,8 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase): VERIFY_STATUS_NEED_TO_VERIFY: "verified", VERIFY_STATUS_SUBMITTED: "verified", VERIFY_STATUS_APPROVED: "verified", - VERIFY_STATUS_MISSED_DEADLINE: "honor" + VERIFY_STATUS_MISSED_DEADLINE: "honor", + VERIFY_STATUS_NEED_TO_REVERIFY: "honor" } def _assert_course_verification_status(self, status): diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index 53ed489580..6a20a1e2e3 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -10,7 +10,8 @@ from student.helpers import ( VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED, VERIFY_STATUS_APPROVED, - VERIFY_STATUS_MISSED_DEADLINE + VERIFY_STATUS_MISSED_DEADLINE, + VERIFY_STATUS_NEED_TO_REVERIFY ) %> @@ -134,7 +135,7 @@ from student.helpers import ( <%include file='_dashboard_certificate_information.html' args='cert_status=cert_status,course=course, enrollment=enrollment'/> % endif - % if verification_status.get('status') in [VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED, VERIFY_STATUS_APPROVED] and not is_course_blocked: + % if verification_status.get('status') in [VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED, VERIFY_STATUS_APPROVED, VERIFY_STATUS_NEED_TO_REVERIFY] and not is_course_blocked: