EDUCATOR-2774 add new condition for cert eligible column in grade report

This commit is contained in:
rabiaiftikhar
2018-04-27 15:56:30 +05:00
parent 1f490a66c1
commit c51d121faa
2 changed files with 8 additions and 5 deletions

View File

@@ -570,12 +570,13 @@ def certificate_info_for_user(user, course_id, grade, user_is_whitelisted, user_
"""
certificate_is_delivered = 'N'
certificate_type = 'N/A'
eligible_for_certificate = 'Y' if (user_is_whitelisted or grade is not None) and user.profile.allow_certificate \
else 'N'
status = certificate_status(user_certificate)
can_have_certificate = CourseOverview.get_from_id(course_id).may_certify()
certificate_generated = status['status'] == CertificateStatuses.downloadable
can_have_certificate = CourseOverview.get_from_id(course_id).may_certify()
eligible_for_certificate = 'Y' if (user_is_whitelisted or grade is not None or certificate_generated) \
and user.profile.allow_certificate else 'N'
if certificate_generated and can_have_certificate:
certificate_is_delivered = 'Y'
certificate_type = status['mode']

View File

@@ -90,7 +90,9 @@ class CertificatesModelTest(ModuleStoreTestCase, MilestonesTestCaseMixin):
{'allow_certificate': True, 'whitelisted': True, 'grade': None, 'output': ['Y', 'Y', 'honor']},
{'allow_certificate': True, 'whitelisted': False, 'grade': 0.9, 'output': ['Y', 'Y', 'honor']},
{'allow_certificate': False, 'whitelisted': True, 'grade': 0.8, 'output': ['N', 'Y', 'honor']},
{'allow_certificate': False, 'whitelisted': None, 'grade': 0.8, 'output': ['N', 'Y', 'honor']}
{'allow_certificate': False, 'whitelisted': None, 'grade': 0.8, 'output': ['N', 'Y', 'honor']},
{'allow_certificate': True, 'whitelisted': None, 'grade': None, 'output': ['Y', 'Y', 'honor']},
{'allow_certificate': False, 'whitelisted': True, 'grade': None, 'output': ['N', 'Y', 'honor']}
)
def test_certificate_info_for_user_when_grade_changes(self, allow_certificate, whitelisted, grade, output):
"""