Commit 2a4976cf by Vik Paruchuri

Cleanup how peer grading handles due date

parent 0b991f9b
...@@ -42,7 +42,7 @@ class PeerGradingFields(object): ...@@ -42,7 +42,7 @@ class PeerGradingFields(object):
default=False, default=False,
scope=Scope.settings scope=Scope.settings
) )
due_date = Date( due = Date(
help="Due date that should be displayed.", help="Due date that should be displayed.",
default=None, default=None,
scope=Scope.settings) scope=Scope.settings)
...@@ -100,25 +100,25 @@ class PeerGradingModule(PeerGradingFields, XModule): ...@@ -100,25 +100,25 @@ class PeerGradingModule(PeerGradingFields, XModule):
if self.use_for_single_location: if self.use_for_single_location:
try: try:
self.linked_problem = modulestore().get_instance(self.system.course_id, self.link_to_location) self.linked_problem = modulestore().get_instance(self.system.course_id, self.link_to_location)
except: except Exception:
log.error("Linked location {0} for peer grading module {1} does not exist".format( log.error("Linked location {0} for peer grading module {1} does not exist".format(
self.link_to_location, self.location)) self.link_to_location, self.location))
raise raise
due_date = self.linked_problem._model_data.get('peer_grading_due', None) due_date = self.linked_problem._model_data.get('due', None)
if due_date: if due_date:
self._model_data['due'] = due_date self._model_data['due'] = due_date
try: try:
self.timeinfo = TimeInfo(self.due_date, self.grace_period_string) self.timeinfo = TimeInfo(self.due, self.grace_period_string)
except: except Exception:
log.error("Error parsing due date information in location {0}".format(location)) log.error("Error parsing due date information in location {0}".format(self.location))
raise raise
self.display_due_date = self.timeinfo.display_due_date self.display_due_date = self.timeinfo.display_due_date
try: try:
self.student_data_for_location = json.loads(self.student_data_for_location) self.student_data_for_location = json.loads(self.student_data_for_location)
except: except Exception:
pass pass
self.ajax_url = self.system.ajax_url self.ajax_url = self.system.ajax_url
...@@ -532,7 +532,7 @@ class PeerGradingModule(PeerGradingFields, XModule): ...@@ -532,7 +532,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
problem_location = problem['location'] problem_location = problem['location']
descriptor = _find_corresponding_module_for_location(problem_location) descriptor = _find_corresponding_module_for_location(problem_location)
if descriptor: if descriptor:
problem['due'] = descriptor._model_data.get('peer_grading_due', None) problem['due'] = descriptor._model_data.get('due', None)
grace_period_string = descriptor._model_data.get('graceperiod', None) grace_period_string = descriptor._model_data.get('graceperiod', None)
try: try:
problem_timeinfo = TimeInfo(problem['due'], grace_period_string) problem_timeinfo = TimeInfo(problem['due'], grace_period_string)
...@@ -622,10 +622,11 @@ class PeerGradingDescriptor(PeerGradingFields, RawDescriptor): ...@@ -622,10 +622,11 @@ class PeerGradingDescriptor(PeerGradingFields, RawDescriptor):
metadata_translations = { metadata_translations = {
'is_graded': 'graded', 'is_graded': 'graded',
'attempts': 'max_attempts', 'attempts': 'max_attempts',
'due_data' : 'due'
} }
@property @property
def non_editable_metadata_fields(self): def non_editable_metadata_fields(self):
non_editable_fields = super(PeerGradingDescriptor, self).non_editable_metadata_fields non_editable_fields = super(PeerGradingDescriptor, self).non_editable_metadata_fields
non_editable_fields.extend([PeerGradingFields.due_date, PeerGradingFields.grace_period_string]) non_editable_fields.extend([PeerGradingFields.due, PeerGradingFields.grace_period_string])
return non_editable_fields return non_editable_fields
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