Commit f5594ea4 by uzairr Committed by Uzair Rasheed

Courses having 'null' in course-end date shows incorrect course card

Course-discovery is returning incorrect availability status of the
courses that have 'null' value in their course_end date.To avoid it,
a conditional statement is modified so that it will behave as expected.

LEARNER-3218
parent 611b96c4
......@@ -724,7 +724,7 @@ class CourseRun(TimeStampedModel):
if self.end and self.end <= now:
return _('Archived')
elif self.start and self.end and (self.start <= now < self.end):
elif self.start and (self.start <= now):
return _('Current')
elif self.start and (now < self.start < upcoming_cutoff):
return _('Starting Soon')
......
......@@ -162,6 +162,7 @@ class CourseRunTests(TestCase):
('2030-01-01 00:00:00Z', None, 'Upcoming'),
(None, '2016-01-01 00:00:00Z', 'Archived'),
('2015-01-01 00:00:00Z', '2016-01-01 00:00:00Z', 'Archived'),
('2015-10-24 00:00:00Z', None, 'Current'),
('2016-01-01 00:00:00Z', '2017-01-01 00:00:00Z', 'Current'),
('2016-07-21 00:00:00Z', '2017-01-01 00:00:00Z', 'Starting Soon'),
)
......
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