From 6796b07d56ebfbbe76204ffc75f3eb6214196b51 Mon Sep 17 00:00:00 2001 From: Will Daly Date: Wed, 11 Feb 2015 13:45:52 -0500 Subject: [PATCH] Add messaging for when a student's verification will expire before the deadline. --- common/djangoapps/student/helpers.py | 15 +++++++++------ .../student/tests/test_verification_status.py | 12 ++++++++---- .../dashboard/_dashboard_course_listing.html | 10 ++++++++-- .../verify_student/_reverification_support.html | 4 ++-- .../verify_student/photo_reverification.html | 6 ++++-- 5 files changed, 31 insertions(+), 16 deletions(-) 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:
% if verification_status['status'] == VERIFY_STATUS_NEED_TO_VERIFY:
@@ -161,6 +162,11 @@ from student.helpers import ( % if verification_status['verification_good_until'] is not None:

${_('Your verification status is good until {date}.').format(date=verification_status['verification_good_until'])} % endif + % elif verification_status['status'] == VERIFY_STATUS_NEED_TO_REVERIFY: +

${_('Your verification will expire soon!')}

+ ## Translators: start_link and end_link will be replaced with HTML tags; + ## please do not translate these. +

${_('Your current verification will expire before the verification deadline for this course. {start_link}Re-verify your identity now{end_link} using a webcam and a government-issued ID.').format(start_link=''.format(href=reverse('verify_student_reverify')), end_link='')}

% endif
% endif diff --git a/lms/templates/verify_student/_reverification_support.html b/lms/templates/verify_student/_reverification_support.html index 93b608ff4a..bcd6039a2f 100644 --- a/lms/templates/verify_student/_reverification_support.html +++ b/lms/templates/verify_student/_reverification_support.html @@ -4,9 +4,9 @@