Commit e9b43963 by Tyler Hallada

Update to match changes to API of GradesService

parent e074693f
...@@ -911,7 +911,7 @@ def update_attempt_status(exam_id, user_id, to_status, ...@@ -911,7 +911,7 @@ def update_attempt_status(exam_id, user_id, to_status,
grades_service.override_subsection_grade( grades_service.override_subsection_grade(
user_id=exam_attempt_obj.user_id, user_id=exam_attempt_obj.user_id,
course_key_or_id=exam['course_id'], course_key_or_id=exam['course_id'],
subsection=exam_attempt_obj.proctored_exam.content_id, usage_key_or_id=exam_attempt_obj.proctored_exam.content_id,
earned_all=REJECTED_GRADE_OVERRIDE_EARNED, earned_all=REJECTED_GRADE_OVERRIDE_EARNED,
earned_graded=REJECTED_GRADE_OVERRIDE_EARNED earned_graded=REJECTED_GRADE_OVERRIDE_EARNED
) )
......
...@@ -930,7 +930,7 @@ class ProctoredExamApiTests(ProctoredExamTestCase): ...@@ -930,7 +930,7 @@ class ProctoredExamApiTests(ProctoredExamTestCase):
grades_service = get_runtime_service('grades') grades_service = get_runtime_service('grades')
grades = grades_service.get_subsection_grade(user_id=self.user.id, grades = grades_service.get_subsection_grade(user_id=self.user.id,
course_key_or_id=exam_attempt.proctored_exam.course_id, course_key_or_id=exam_attempt.proctored_exam.course_id,
subsection=exam_attempt.proctored_exam.content_id) usage_key_or_id=exam_attempt.proctored_exam.content_id)
self.assertEqual(grades, { self.assertEqual(grades, {
'earned_all': 0.0, 'earned_all': 0.0,
......
...@@ -183,13 +183,14 @@ class MockGradesService(object): ...@@ -183,13 +183,14 @@ class MockGradesService(object):
"""Initialize empty data store for grades (a dict)""" """Initialize empty data store for grades (a dict)"""
self.grades = {} self.grades = {}
def get_subsection_grade(self, user_id, course_key_or_id, subsection): def get_subsection_grade(self, user_id, course_key_or_id, usage_key_or_id):
"""Returns entered grade override for key (user_id + course_key + subsection) or None""" """Returns entered grade override for key (user_id + course_key + subsection) or None"""
return self.grades.get(str(user_id) + str(course_key_or_id) + str(subsection)) return self.grades.get(str(user_id) + str(course_key_or_id) + str(usage_key_or_id))
def override_subsection_grade(self, user_id, course_key_or_id, subsection, earned_all=None, earned_graded=None): def override_subsection_grade(self, user_id, course_key_or_id, usage_key_or_id, earned_all=None,
earned_graded=None):
"""Sets grade override earned points for key (user_id + course_key + subsection)""" """Sets grade override earned points for key (user_id + course_key + subsection)"""
self.grades[str(user_id) + str(course_key_or_id) + str(subsection)] = { self.grades[str(user_id) + str(course_key_or_id) + str(usage_key_or_id)] = {
'earned_all': earned_all, 'earned_all': earned_all,
'earned_graded': earned_graded 'earned_graded': earned_graded
} }
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