Commit 7a300483 by Simon Chen

ECOM-4640 make sure honor cert students also see generate cert button (#12687)

parent b00ce028
......@@ -231,21 +231,21 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase):
# # of mongo queries,
# # of xblocks
# )
('no_overrides', 1, True, False): (48, 1, 6, 13),
('no_overrides', 2, True, False): (120, 16, 6, 84),
('no_overrides', 3, True, False): (400, 81, 6, 335),
('ccx', 1, True, False): (48, 1, 6, 13),
('ccx', 2, True, False): (120, 16, 6, 84),
('ccx', 3, True, False): (400, 81, 6, 335),
('no_overrides', 1, True, False): (47, 1, 6, 13),
('no_overrides', 2, True, False): (119, 16, 6, 84),
('no_overrides', 3, True, False): (399, 81, 6, 335),
('ccx', 1, True, False): (47, 1, 6, 13),
('ccx', 2, True, False): (119, 16, 6, 84),
('ccx', 3, True, False): (399, 81, 6, 335),
('ccx', 1, True, True): (47, 1, 6, 13),
('ccx', 2, True, True): (119, 16, 6, 84),
('ccx', 3, True, True): (399, 81, 6, 335),
('no_overrides', 1, False, False): (48, 1, 6, 13),
('no_overrides', 2, False, False): (120, 16, 6, 84),
('no_overrides', 3, False, False): (400, 81, 6, 335),
('ccx', 1, False, False): (48, 1, 6, 13),
('ccx', 2, False, False): (120, 16, 6, 84),
('ccx', 3, False, False): (400, 81, 6, 335),
('no_overrides', 1, False, False): (47, 1, 6, 13),
('no_overrides', 2, False, False): (119, 16, 6, 84),
('no_overrides', 3, False, False): (399, 81, 6, 335),
('ccx', 1, False, False): (47, 1, 6, 13),
('ccx', 2, False, False): (119, 16, 6, 84),
('ccx', 3, False, False): (399, 81, 6, 335),
('ccx', 1, False, True): (47, 1, 6, 13),
('ccx', 2, False, True): (119, 16, 6, 84),
('ccx', 3, False, True): (399, 81, 6, 335),
......@@ -260,22 +260,22 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
__test__ = True
TEST_DATA = {
('no_overrides', 1, True, False): (48, 1, 4, 9),
('no_overrides', 2, True, False): (120, 16, 19, 54),
('no_overrides', 3, True, False): (400, 81, 84, 215),
('ccx', 1, True, False): (48, 1, 4, 9),
('ccx', 2, True, False): (120, 16, 19, 54),
('ccx', 3, True, False): (400, 81, 84, 215),
('ccx', 1, True, True): (50, 1, 4, 13),
('ccx', 2, True, True): (122, 16, 19, 84),
('ccx', 3, True, True): (402, 81, 84, 335),
('no_overrides', 1, False, False): (48, 1, 4, 9),
('no_overrides', 2, False, False): (120, 16, 19, 54),
('no_overrides', 3, False, False): (400, 81, 84, 215),
('ccx', 1, False, False): (48, 1, 4, 9),
('ccx', 2, False, False): (120, 16, 19, 54),
('ccx', 3, False, False): (400, 81, 84, 215),
('no_overrides', 1, True, False): (47, 1, 4, 9),
('no_overrides', 2, True, False): (119, 16, 19, 54),
('no_overrides', 3, True, False): (399, 81, 84, 215),
('ccx', 1, True, False): (47, 1, 4, 9),
('ccx', 2, True, False): (119, 16, 19, 54),
('ccx', 3, True, False): (399, 81, 84, 215),
('ccx', 1, True, True): (49, 1, 4, 13),
('ccx', 2, True, True): (121, 16, 19, 84),
('ccx', 3, True, True): (401, 81, 84, 335),
('no_overrides', 1, False, False): (47, 1, 4, 9),
('no_overrides', 2, False, False): (119, 16, 19, 54),
('no_overrides', 3, False, False): (399, 81, 84, 215),
('ccx', 1, False, False): (47, 1, 4, 9),
('ccx', 2, False, False): (119, 16, 19, 54),
('ccx', 3, False, False): (399, 81, 84, 215),
('ccx', 1, False, True): (47, 1, 4, 9),
('ccx', 2, False, True): (119, 16, 19, 54),
('ccx', 3, False, True): (400, 81, 84, 215),
('ccx', 3, False, True): (399, 81, 84, 215),
}
......@@ -1368,7 +1368,7 @@ class ProgressPageTests(ModuleStoreTestCase):
self.assertContains(resp, u"Download Your Certificate")
@ddt.data(
*itertools.product(((42, 4, True), (42, 4, False)), (True, False))
*itertools.product(((41, 4, True), (41, 4, False)), (True, False))
)
@ddt.unpack
def test_query_counts(self, (sql_calls, mongo_calls, self_paced), self_paced_enabled):
......@@ -1406,9 +1406,13 @@ class ProgressPageTests(ModuleStoreTestCase):
) as user_verify:
user_verify.return_value = user_verified
resp = views.progress(self.request, course_id=unicode(self.course.id))
cert_button_hidden = course_mode is CourseMode.AUDIT or \
course_mode in CourseMode.VERIFIED_MODES and not user_verified
self.assertEqual(
course_mode is not CourseMode.AUDIT and user_verified,
'Request Certificate' in resp.content)
cert_button_hidden,
'Request Certificate' not in resp.content)
@attr('shard_1')
......
......@@ -726,6 +726,12 @@ def _progress(request, course_key, student_id):
# checking certificate generation configuration
enrollment_mode, is_active = CourseEnrollment.enrollment_mode_for_user(student, course_key)
# If the learner is in verified modes and the student did not have
# their ID verified, we need to show message to ask learner to verify their ID first
missing_required_verification = enrollment_mode in CourseMode.VERIFIED_MODES and \
not SoftwareSecurePhotoVerification.user_is_verified(student)
show_generate_cert_btn = (
is_active and CourseMode.is_eligible_for_certificate(enrollment_mode)
and certs_api.cert_generation_enabled(course_key)
......@@ -741,7 +747,7 @@ def _progress(request, course_key, student_id):
'passed': is_course_passed(course, grade_summary),
'show_generate_cert_btn': show_generate_cert_btn,
'credit_course_requirements': _credit_course_requirements(course_key, student),
'is_id_verified': SoftwareSecurePhotoVerification.user_is_verified(student)
'missing_required_verification': missing_required_verification
}
if show_generate_cert_btn:
......
......@@ -80,7 +80,10 @@ from django.utils.http import urlquote_plus
<p class="copy">${_("We're creating your certificate. You can keep working in your courses and a link to it will appear here and on your Dashboard when it is ready.")}</p>
</div>
<div class="msg-actions"></div>
%elif not is_id_verified or is_unverified:
%elif missing_required_verification or is_unverified:
## The is_unverified variable comes from certificate status.
## At the moment, the assumption is we should not show generate certificate button
## if the certificate previously generated is in unverified status
<div class="msg-content">
## Translators: This message appears to users when the users have not completed identity verification.
<h2 class="title">${_("Certificate unavailable")}</h2>
......
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