From 0f39e04697295c950a5a6d92ac2fa5562ae99da8 Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Tue, 29 Jan 2013 10:27:53 -0500 Subject: [PATCH] Adding certificate restriction lookup If certificate status is 'restricted' the grade and survey link will be shown, the download link will not --- common/djangoapps/student/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 61b49e6022..b583599e97 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -135,7 +135,7 @@ def cert_info(user, course): Get the certificate info needed to render the dashboard section for the given student and course. Returns a dictionary with keys: - 'status': one of 'generating', 'ready', 'notpassing', 'processing' + 'status': one of 'generating', 'ready', 'notpassing', 'processing', 'restricted' 'show_download_url': bool 'download_url': url, only present if show_download_url is True 'show_disabled_download_button': bool -- true if state is 'generating' @@ -168,6 +168,7 @@ def _cert_info(user, course, cert_status): CertificateStatuses.regenerating: 'generating', CertificateStatuses.downloadable: 'ready', CertificateStatuses.notpassing: 'notpassing', + CertificateStatuses.restricted: 'restricted', } status = template_state.get(cert_status['status'], default_status) @@ -176,7 +177,7 @@ def _cert_info(user, course, cert_status): 'show_download_url': status == 'ready', 'show_disabled_download_button': status == 'generating',} - if (status in ('generating', 'ready', 'notpassing') and + if (status in ('generating', 'ready', 'notpassing', 'restricted') and course.end_of_course_survey_url is not None): d.update({ 'show_survey_button': True, @@ -192,7 +193,7 @@ def _cert_info(user, course, cert_status): else: d['download_url'] = cert_status['download_url'] - if status in ('generating', 'ready', 'notpassing'): + if status in ('generating', 'ready', 'notpassing', 'restricted'): if 'grade' not in cert_status: # Note: as of 11/20/2012, we know there are students in this state-- cs169.1x, # who need to be regraded (we weren't tracking 'notpassing' at first).