Add the ability for self-service course survey reports

This commit is contained in:
Afzal Wali
2015-10-28 15:43:13 +05:00
committed by Chris Dodge
parent d210ca6e42
commit 5a11f75a48
10 changed files with 239 additions and 1 deletions

View File

@@ -1358,6 +1358,29 @@ def get_exec_summary_report(request, course_id):
})
@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_level('staff')
def get_course_survey_results(request, course_id):
"""
get the survey results report for the particular course.
"""
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id)
try:
instructor_task.api.submit_course_survey_report(request, course_key)
status_response = _("The survey report is being created."
" To view the status of the report, see Pending Instructor Tasks below.")
except AlreadyRunningError:
status_response = _(
"The survey report is currently being created."
" To view the status of the report, see Pending Instructor Tasks below."
" You will be able to download the report when it is complete."
)
return JsonResponse({
"status": status_response
})
@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_level('staff')

View File

@@ -115,6 +115,8 @@ urlpatterns = patterns(
'instructor.views.api.get_enrollment_report', name="get_enrollment_report"),
url(r'get_exec_summary_report$',
'instructor.views.api.get_exec_summary_report', name="get_exec_summary_report"),
url(r'get_course_survey_results$',
'instructor.views.api.get_course_survey_results', name="get_course_survey_results"),
# Coupon Codes..
url(r'get_coupon_codes',

View File

@@ -169,7 +169,6 @@ def instructor_dashboard_2(request, course_id):
'disable_buttons': disable_buttons,
'analytics_dashboard_message': analytics_dashboard_message
}
return render_to_response('instructor/instructor_dashboard_2/instructor_dashboard_2.html', context)
@@ -516,6 +515,8 @@ def _section_data_download(course, access):
'list_report_downloads_url': reverse('list_report_downloads', kwargs={'course_id': unicode(course_key)}),
'calculate_grades_csv_url': reverse('calculate_grades_csv', kwargs={'course_id': unicode(course_key)}),
'problem_grade_report_url': reverse('problem_grade_report', kwargs={'course_id': unicode(course_key)}),
'course_has_survey': True if course.course_survey_name else False,
'course_survey_results_url': reverse('get_course_survey_results', kwargs={'course_id': unicode(course_key)}),
}
return section_data