Commit 8c2cbede by Carlos Andrés Rocha

Quickfix to render the dashboard when there is no certificate db tables

parent 39a5b6eb
...@@ -146,10 +146,12 @@ def dashboard(request): ...@@ -146,10 +146,12 @@ def dashboard(request):
show_courseware_links_for = frozenset(course.id for course in courses show_courseware_links_for = frozenset(course.id for course in courses
if has_access(request.user, course, 'load')) 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'): 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: else:
cert_statuses = [] cert_statuses = {}
context = {'courses': courses, context = {'courses': courses,
'message': message, 'message': message,
...@@ -804,6 +806,3 @@ def test_center_login(request): ...@@ -804,6 +806,3 @@ def test_center_login(request):
return redirect('/courses/MITx/6.002x/2012_Fall/courseware/Final_Exam/Final_Exam_Fall_2012/') return redirect('/courses/MITx/6.002x/2012_Fall/courseware/Final_Exam/Final_Exam_Fall_2012/')
else: else:
return HttpResponseForbidden() return HttpResponseForbidden()
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
</header> </header>
% if len(courses) > 0: % if len(courses) > 0:
% for course, cert_status in zip(courses, cert_statuses): % for course in courses:
<article class="my-course"> <article class="my-course">
<% <%
...@@ -154,8 +154,10 @@ ...@@ -154,8 +154,10 @@
</a> </a>
</article> </article>
<%
% if course.has_ended: cert_status = cert_statuses.get(course.id)
%>
% if course.has_ended and cert_status:
<% <%
passing_grade = False passing_grade = False
cert_button = False cert_button = False
...@@ -350,4 +352,3 @@ ...@@ -350,4 +352,3 @@
</div> </div>
</div> </div>
</section> </section>
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