From b65577f2b783374e4dade3328aec11fc6cbd5408 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Tue, 18 Sep 2012 13:18:19 -0400 Subject: [PATCH] Fixed tests for fast grading. --- lms/djangoapps/courseware/grades.py | 7 +++++++ lms/djangoapps/courseware/views.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/lms/djangoapps/courseware/grades.py b/lms/djangoapps/courseware/grades.py index 2bc930d81c..10ea81a8ee 100644 --- a/lms/djangoapps/courseware/grades.py +++ b/lms/djangoapps/courseware/grades.py @@ -237,6 +237,10 @@ def progress_summary(student, request, course, grader, student_module_cache): course: An XModule containing the course to grade student_module_cache: A StudentModuleCache initialized with all instance_modules for the student + + If the student does not have access to load the course module, this function + will return None. + """ @@ -245,6 +249,9 @@ def progress_summary(student, request, course, grader, student_module_cache): course_module = get_module(student, request, course.location, student_module_cache, course.id) + if not course_module: + # This student must not have access to the course. + return None chapters = [] # Don't include chapters that aren't displayable (e.g. due to error) diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index 09078cc36b..6350d70385 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -459,6 +459,10 @@ def progress(request, course_id, student_id=None): courseware_summary = grades.progress_summary(student, request, course, course.grader, student_module_cache) grade_summary = grades.grade(student, request, course, student_module_cache) + + if courseware_summary is None: + #This means the student didn't have access to the course (which the instructor requested) + raise Http404 context = {'course': course, 'courseware_summary': courseware_summary,