Commit b05271c9 by Bridger Maxwell

Added a feature flag, END_COURSE_ENABLED to enable the certificate request and exit survey.

parent 82a7f969
......@@ -2,6 +2,7 @@ import json
import logging
import uuid
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponse
from mitxmako.shortcuts import render_to_response
......@@ -16,7 +17,7 @@ log = logging.getLogger("mitx.certificates")
@login_required
def certificate_request(request):
''' Attempt to send a certificate. '''
if request.method != "POST":
if request.method != "POST" or not settings.END_COURSE_ENABLED:
raise Http404
verification_checked = request.POST.get('cert_request_verify', 'false')
......
......@@ -74,21 +74,6 @@ def profile(request, student_id = None):
grade_sheet = grades.grade_sheet(student)
took_survey = student_took_survey(user_info)
generated_certificate = None
certificate_download_url = None
certificate_requested = False
if grade_sheet['grade']:
try:
generated_certificate = GeneratedCertificate.objects.get(user = student)
certificate_requested = True
certificate_download_url = generated_certificate.download_url
except GeneratedCertificate.DoesNotExist:
#They haven't submited the request form
certificate_requested = False
context={'name':user_info.name,
'username':student.username,
'location':user_info.location,
......@@ -98,10 +83,27 @@ def profile(request, student_id = None):
'csrf':csrf(request)['csrf_token'],
'grade_cutoffs' : course_settings.GRADE_CUTOFFS,
'grade_sheet' : grade_sheet,
'certificate_requested' : certificate_requested,
'certificate_download_url' : certificate_download_url,
'took_survey' : took_survey,
}
if settings.END_COURSE_ENABLED:
took_survey = student_took_survey(user_info)
generated_certificate = None
certificate_download_url = None
certificate_requested = False
if grade_sheet['grade']:
try:
generated_certificate = GeneratedCertificate.objects.get(user = student)
certificate_requested = True
certificate_download_url = generated_certificate.download_url
except GeneratedCertificate.DoesNotExist:
#They haven't submited the request form
certificate_requested = False
context.update({'certificate_requested' : certificate_requested,
'certificate_download_url' : certificate_download_url,
'took_survey' : took_survey})
return render_to_response('profile.html', context)
......
......@@ -461,7 +461,7 @@ def accept_name_change(request):
@login_required
def record_exit_survey(request):
if request.method != "POST":
if request.method != "POST" or not settings.END_COURSE_ENABLED:
raise Http404
default_responses = {
......
......@@ -5,6 +5,9 @@ import tempfile
import djcelery
# Enables certificate requests and the exit survey
END_COURSE_ENABLED = False
# from settings2.askbotsettings import LIVESETTINGS_OPTIONS
DEFAULT_GROUPS = []
......
......@@ -5,6 +5,7 @@
<%!
from django.core.urlresolvers import reverse
from django.conf import settings
%>
<%block name="headextra">
......@@ -121,7 +122,7 @@ $(function() {
return false;
});
%if settings.END_COURSE_ENABLED:
/*
There is a fieldset, #survey_fieldset, which contains an exit survey. This exist survey can be taken by iteself,
or as part of the certificate request. If they haven't taken the survey yet, it moves to the open modal dialogue.
......@@ -190,7 +191,7 @@ $(function() {
// "new_email":new_email});
return false;
});
%endif
});
</script>
......@@ -206,7 +207,8 @@ $(function() {
<header>
<h1>Course Progress</h1>
</header>
%if settings.END_COURSE_ENABLED:
<div id="grade">
%if grade_sheet['grade']:
<p>Final Grade: <strong>${grade_sheet['grade']}</strong></p>
......@@ -228,6 +230,8 @@ $(function() {
Take the <a class="survey_link" rel="leanModal" href="#survey">survey</a>.
</div>
%endif
%endif
<div id="grade-detail-graph"></div>
......
......@@ -15,7 +15,6 @@ urlpatterns = ('',
url(r'^accept_name_change$', 'student.views.accept_name_change'),
url(r'^reject_name_change$', 'student.views.reject_name_change'),
url(r'^pending_name_changes$', 'student.views.pending_name_changes'),
url(r'^certificate_request$', 'certificates.views.certificate_request'),
url(r'^gradebook$', 'courseware.views.gradebook'),
url(r'^event$', 'track.views.user_track'),
url(r'^t/(?P<template>[^/]*)$', 'static_template_view.views.index'),
......@@ -40,8 +39,11 @@ urlpatterns = ('',
url(r'^send_feedback$', 'util.views.send_feedback'),
)
if True: # settings.END_COURSE_ENABLED:
urlpatterns += (url(r'^record_exit_survey$','student.views.record_exit_survey'),)
if settings.END_COURSE_ENABLED:
urlpatterns += (
url(r'^certificate_request$', 'certificates.views.certificate_request'),
url(r'^record_exit_survey$','student.views.record_exit_survey'),
)
if settings.PERFSTATS:
urlpatterns=urlpatterns + (url(r'^reprofile$','perfstats.views.end_profile'),)
......
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