Skip to content

Commit

Permalink
Merge pull request #1 from zimka/hotfix
Browse files Browse the repository at this point in the history
Fix exception when date is None in ORA; None is meaningful date in ORA workflow
  • Loading branch information
zimka authored Jan 23, 2018
2 parents 12f2a7c + 8c44153 commit 74b8188
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion course_shifts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def get_shifted_date(self, user, date):
user.username,
str(self)
))
return date + timedelta(days=self.days_shift)
try:
value = date + timedelta(days=self.days_shift)
return value
except OverflowError:
return date

def get_enrollment_limits(self, shift_settings=None):
"""
Expand Down
8 changes: 4 additions & 4 deletions course_shifts/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CourseShiftOverrideProvider(FieldOverrideProvider):
)
OPENASSESSMENT_NAMES = (
'due',
'submission_due'
'submission_due',
'start',
'submission_start',
'rubric_assessments'
Expand Down Expand Up @@ -108,6 +108,8 @@ def enabled_for(cls, course):
return True

def shift_string_date(self, base_value, shift_group, name):
if not base_value:
return base_value
parsed_value = dateutil.parser.parse(base_value)
if parsed_value.isoformat() != base_value:
log.error("CourseShift can't move non-iso 8601 date: {} ({})".format(
Expand All @@ -116,7 +118,7 @@ def shift_string_date(self, base_value, shift_group, name):
))
return None
shifted_value = shift_group.get_shifted_date(self.user, parsed_value)
return shifted_value.isoformat()
return unicode(shifted_value.isoformat())

def shift_rubric_assessment(self, base_value, shift_group, name):
shifted_rubric_assessment = []
Expand All @@ -131,8 +133,6 @@ def shift_rubric_assessment(self, base_value, shift_group, name):
shift_group=shift_group,
name=name
)
if (shifted_due is None) or (shifted_start is None):
return
shifted_row = dict(row)
shifted_row['start'] = shifted_start
shifted_row['due'] = shifted_due
Expand Down

0 comments on commit 74b8188

Please sign in to comment.