Resubmit Photo-Verification button must appear in approval box.

Currently, Resubmit photo-verification button is not been displayed
inside the approval box on dashboard.In order to allow a learner to
resubmit before expire it must be displayed in it.
This commit is contained in:
uzairr
2019-11-14 13:40:00 +05:00
parent a48ec5fdfd
commit 34134ff229
4 changed files with 34 additions and 4 deletions

View File

@@ -9,6 +9,8 @@ import six
from django.conf import settings
from django.test import override_settings
from django.urls import reverse
from django.utils.timezone import now
from mock import patch
from pytz import UTC
@@ -131,6 +133,17 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
response = self.client.get(self.dashboard_url)
self.assertContains(response, attempt.expiration_datetime.strftime("%m/%d/%Y"))
@patch("lms.djangoapps.verify_student.services.is_verification_expiring_soon")
def test_verify_resubmit_button_on_dashboard(self, mock_expiry):
mock_expiry.return_value = True
SoftwareSecurePhotoVerification.objects.create(user=self.user, status='approved', expiry_date=now())
response = self.client.get(self.dashboard_url)
self.assertContains(response, "Resubmit Verification")
mock_expiry.return_value = False
response = self.client.get(self.dashboard_url)
self.assertNotContains(response, "Resubmit Verification")
def test_missed_verification_deadline(self):
# Expiration date in the past
self._setup_mode_and_enrollment(self.DATES[self.PAST], "verified")
@@ -299,7 +312,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
self._assert_course_verification_status(VERIFY_STATUS_APPROVED)
response2 = self.client.get(self.dashboard_url)
self.assertContains(response2, attempt2.expiration_datetime.strftime("%m/%d/%Y"))
self.assertContains(response2, attempt2.expiration_datetime.strftime("%m/%d/%Y"), count=3)
self.assertContains(response2, attempt2.expiration_datetime.strftime("%m/%d/%Y"), count=2)
def _setup_mode_and_enrollment(self, deadline, enrollment_mode):
"""Create a course mode and enrollment.

View File

@@ -12,6 +12,7 @@ from django.urls import reverse
from django.utils.translation import ugettext as _
from course_modes.models import CourseMode
from lms.djangoapps.verify_student.utils import is_verification_expiring_soon
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from student.models import User
@@ -213,7 +214,8 @@ class IDVerificationService(object):
elif attempt.status == 'approved':
user_status['status'] = 'approved'
if getattr(attempt, 'expiry_date', None):
expiration_datetime = cls.get_expiration_datetime(user, ['approved'])
if getattr(attempt, 'expiry_date', None) and is_verification_expiring_soon(expiration_datetime):
user_status['verification_expiry'] = attempt.expiry_date.date().strftime("%m/%d/%Y")
elif attempt.status in ['submitted', 'approved', 'must_retry']:

View File

@@ -1250,6 +1250,18 @@
border-bottom-color: $verified-color-lvl4;
}
.action-reverify {
@extend %btn-primary-error;
@extend %t-weight4;
display: block;
@include font-size(14);
}
.btn-reverify {
margin-top: ($baseline/2);
}
.deco-arrow {
@include triangle(($baseline/2), $verified-color-lvl4, up);
}

View File

@@ -11,7 +11,10 @@ from django.utils.translation import ugettext as _
<span class="title status-title">${_("Current Verification Status: Approved")}</span>
<p class="status-note">${_("Your edX verification has been approved. Your verification is effective for one year after submission.")}</p>
%if verification_expiry:
<p class="status-note"><span><b>${_("Warning")}: </b></span><i>${_("Your photo verification expires on {verification_expiry}.Approved verification photos are required to earn a certificate and to take a proctored exam. It can take up to 3 days to re-verify, so please re-verify at least a week before any proctored events.").format(verification_expiry=verification_expiry)}</i></p>
<p class="status-note"><span><b>${_("Warning")}: </b></span><i>${_("Your photo verification expires on {verification_expiry}. Please be aware photo verification can take up to three days once initiated and you will not be able to earn a certificate or take a proctored exam until approved.").format(verification_expiry=verification_expiry)}</i></p>
<div class="btn-reverify">
<a href="${reverse('verify_student_reverify')}" class="action action-reverify">${_("Resubmit Verification")}</a>
</div>
%endif
</li>
%elif verification_status == 'pending':
@@ -43,7 +46,7 @@ from django.utils.translation import ugettext as _
<li class="status status-verification is-denied">
<span class="title status-title">${_("Current Verification Status: Expired")}</span>
<p class="status-note">${_("Your verification has expired. To receive a verified certificate, you must submit a new photo of yourself and your government-issued photo ID before the verification deadline for your course.")}</p>
<p class="status-note"><span><b>${_("Warning")}: </b></span><i>${_("Approved verification photos are required to earn a certificate and to take a proctored exam. It can take up to 3 days to re-verify, so please re-verify at least a week before any proctored events.")}</i></p>
<p class="status-note"><span><b>${_("Warning")}: </b></span><i>${_(" Please be aware photo verification can take up to three days once initiated and you will not be able to earn a certificate or take a proctored exam until approved.")}</i></p>
<div class="btn-reverify">
<a href="${reverse('verify_student_reverify')}" class="action action-reverify">${_("Resubmit Verification")}</a>
</div>