Show white listed ceretificates on progress page

White listed certificates should appear on the progress page
even if the user has not passed the course
LEARNER-3546
This commit is contained in:
Ahsan Ulhaq
2017-12-12 15:50:18 +05:00
parent 91d55cf95f
commit 50c8a80f32
2 changed files with 50 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ from datetime import datetime
from pytz import UTC
from certificates.models import CertificateWhitelist
from openedx.core.djangoapps.certificates.config import waffle
from student.models import CourseEnrollment
@@ -54,11 +55,12 @@ def is_certificate_valid(certificate):
def can_show_certificate_message(course, student, course_grade, certificates_enabled_for_course):
is_whitelisted = CertificateWhitelist.objects.filter(user=student, course_id=course.id, whitelist=True).exists()
if not (
(auto_certificate_generation_enabled() or certificates_enabled_for_course) and
CourseEnrollment.is_enrolled(student, course.id) and
certificates_viewable_for_course(course) and
course_grade.passed
(course_grade.passed or is_whitelisted)
):
return False
return True