Commit 020e1e94 by Don Mitchell

Move side effecting of definition for grader to the course_module and

don't make caller responsible.
parent de3a75d2
...@@ -118,8 +118,6 @@ class CourseGradingModel(object): ...@@ -118,8 +118,6 @@ class CourseGradingModel(object):
descriptor.raw_grader[index] = grader descriptor.raw_grader[index] = grader
else: else:
descriptor.raw_grader.append(grader) descriptor.raw_grader.append(grader)
# make definition notice the update
descriptor.raw_grader = descriptor.raw_grader
get_modulestore(course_location).update_item(course_location, descriptor.definition['data']) get_modulestore(course_location).update_item(course_location, descriptor.definition['data'])
......
...@@ -127,6 +127,7 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -127,6 +127,7 @@ class CourseDescriptor(SequenceDescriptor):
# NOTE (THK): This is a last-minute addition for Fall 2012 launch to dynamically # NOTE (THK): This is a last-minute addition for Fall 2012 launch to dynamically
# disable the syllabus content for courses that do not provide a syllabus # disable the syllabus content for courses that do not provide a syllabus
self.syllabus_present = self.system.resources_fs.exists(path('syllabus')) self.syllabus_present = self.system.resources_fs.exists(path('syllabus'))
self._grading_policy = {}
self.set_grading_policy(self.definition['data'].get('grading_policy', None)) self.set_grading_policy(self.definition['data'].get('grading_policy', None))
self.test_center_exams = [] self.test_center_exams = []
...@@ -196,11 +197,9 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -196,11 +197,9 @@ class CourseDescriptor(SequenceDescriptor):
grading_policy.update(course_policy) grading_policy.update(course_policy)
# Here is where we should parse any configurations, so that we can fail early # Here is where we should parse any configurations, so that we can fail early
grading_policy['RAW_GRADER'] = grading_policy['GRADER'] # used for cms access # Use setters so that side effecting to .definitions works
grading_policy['GRADER'] = grader_from_conf(grading_policy['GRADER']) self.raw_grader = grading_policy['GRADER'] # used for cms access
self._grading_policy = grading_policy self.grade_cutoffs = grading_policy['GRADE_CUTOFFS']
@classmethod @classmethod
def read_grading_policy(cls, paths, system): def read_grading_policy(cls, paths, system):
...@@ -318,10 +317,6 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -318,10 +317,6 @@ class CourseDescriptor(SequenceDescriptor):
self.metadata['enrollment_end'] = stringify_time(value) self.metadata['enrollment_end'] = stringify_time(value)
@property @property
def grader(self):
return self._grading_policy['GRADER']
@property
def raw_grader(self): def raw_grader(self):
return self._grading_policy['RAW_GRADER'] return self._grading_policy['RAW_GRADER']
......
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