Commit 71a1562e by Kristin Stephens

Fix offline_gradecalc

Bug: Throws error when can't find a user on the request object for grading or can't find a session attribute.

Fix: Added a user attribute with a value of the current student and a session attribute with a value of an empty dictionary.
parent b143de1f
......@@ -44,12 +44,14 @@ def offline_grade_calculation(course_id):
def is_secure(self):
return False
request = DummyRequest()
print "%d enrolled students" % len(enrolled_students)
course = get_course_by_id(course_id)
for student in enrolled_students:
request = DummyRequest()
request.user = student
request.session = {}
gradeset = grades.grade(student, request, course, keep_raw_scores=True)
gs = enc.encode(gradeset)
ocg, created = models.OfflineComputedGrade.objects.get_or_create(user=student, course_id=course_id)
......
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