diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 98b63851ba..141fc2798a 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -146,10 +146,12 @@ def dashboard(request): show_courseware_links_for = frozenset(course.id for course in courses if has_access(request.user, course, 'load')) + # TODO: workaround to not have to zip courses and certificates in the template + # since before there is a migration to certificates if settings.MITX_FEATURES.get('CERTIFICATES_ENABLED'): - cert_statuses = [certificate_status_for_student(request.user, course.id) for course in courses] + cert_statuses = {(course.id, certificate_status_for_student(request.user, course.id)) for course in courses} else: - cert_statuses = [] + cert_statuses = {} context = {'courses': courses, 'message': message, @@ -804,6 +806,3 @@ def test_center_login(request): return redirect('/courses/MITx/6.002x/2012_Fall/courseware/Final_Exam/Final_Exam_Fall_2012/') else: return HttpResponseForbidden() - - - diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 4c7b00ee23..edd882afd0 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -115,7 +115,7 @@ % if len(courses) > 0: - % for course, cert_status in zip(courses, cert_statuses): + % for course in courses:
<% @@ -154,8 +154,10 @@
- - % if course.has_ended: + <% + cert_status = cert_statuses.get(course.id) + %> + % if course.has_ended and cert_status: <% passing_grade = False cert_button = False @@ -350,4 +352,3 @@ -