Add messaging for when a student's verification will expire before the deadline.

This commit is contained in:
Will Daly
2015-02-11 13:45:52 -05:00
parent 70ec4c5f66
commit 6796b07d56
5 changed files with 31 additions and 16 deletions

View File

@@ -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

View File

@@ -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):