Commit 16990c27 by Victor Shnayder

Add an end date to courses.

- needed for cert generation (and later lots of other things)
parent ec5e28fc
......@@ -87,6 +87,7 @@ class CourseDescriptor(SequenceDescriptor):
self.enrollment_start = self._try_parse_time("enrollment_start")
self.enrollment_end = self._try_parse_time("enrollment_end")
self.end = self._try_parse_time("end")
# NOTE: relies on the modulestore to call set_grading_policy() right after
# init. (Modulestore is in charge of figuring out where to load the policy from)
......@@ -127,6 +128,16 @@ class CourseDescriptor(SequenceDescriptor):
return definition
def has_ended(self):
"""
Returns True if the current time is after the specified course end date.
Returns False if there is no end date specified.
"""
if self.end_date is None:
return False
return time.gmtime() > self.end
def has_started(self):
return time.gmtime() > self.start
......
......@@ -251,6 +251,7 @@ Supported fields at the course level:
* "start" -- specify the start date for the course. Format-by-example: "2012-09-05T12:00".
* "enrollment_start", "enrollment_end" -- when can students enroll? (if not specified, can enroll anytime). Same format as "start".
* "end" -- specify the end date for the course. Format-by-example: "2012-11-05T12:00".
* "tabs" -- have custom tabs in the courseware. See below for details on config.
* TODO: there are others
......
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