Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
16990c27
Commit
16990c27
authored
Oct 24, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an end date to courses.
- needed for cert generation (and later lots of other things)
parent
ec5e28fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
common/lib/xmodule/xmodule/course_module.py
+13
-2
doc/xml-format.md
+1
-0
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
16990c27
...
...
@@ -22,13 +22,13 @@ class CourseDescriptor(SequenceDescriptor):
self
.
book_url
=
book_url
self
.
table_of_contents
=
self
.
_get_toc_from_s3
()
self
.
start_page
=
int
(
self
.
table_of_contents
[
0
]
.
attrib
[
'page'
])
# The last page should be the last element in the table of contents,
# but it may be nested. So recurse all the way down the last element
last_el
=
self
.
table_of_contents
[
-
1
]
while
last_el
.
getchildren
():
last_el
=
last_el
[
-
1
]
self
.
end_page
=
int
(
last_el
.
attrib
[
'page'
])
@property
...
...
@@ -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
...
...
doc/xml-format.md
View file @
16990c27
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment