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
fb36c7df
Commit
fb36c7df
authored
Jun 14, 2017
by
Alex Dusenbery
Committed by
Alex Dusenbery
Jun 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EDUCATOR-514 | Add certificate_available_date field to CourseFields
parent
89831f06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
common/lib/xmodule/xmodule/course_module.py
+13
-3
common/lib/xmodule/xmodule/seq_module.py
+1
-1
common/lib/xmodule/xmodule/tests/test_course_module.py
+9
-1
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
fb36c7df
...
@@ -4,7 +4,7 @@ Django module container for classes and operations related to the "Course Module
...
@@ -4,7 +4,7 @@ Django module container for classes and operations related to the "Course Module
import
json
import
json
import
logging
import
logging
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
from
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
import
requests
import
requests
from
lazy
import
lazy
from
lazy
import
lazy
...
@@ -187,6 +187,10 @@ class CourseFields(object):
...
@@ -187,6 +187,10 @@ class CourseFields(object):
scope
=
Scope
.
settings
scope
=
Scope
.
settings
)
)
end
=
Date
(
help
=
_
(
"Date that this class ends"
),
scope
=
Scope
.
settings
)
end
=
Date
(
help
=
_
(
"Date that this class ends"
),
scope
=
Scope
.
settings
)
certificate_available_date
=
Date
(
help
=
_
(
"Date that certificates become available to learners"
),
scope
=
Scope
.
content
)
cosmetic_display_price
=
Integer
(
cosmetic_display_price
=
Integer
(
display_name
=
_
(
"Cosmetic Course Display Price"
),
display_name
=
_
(
"Cosmetic Course Display Price"
),
help
=
_
(
help
=
_
(
...
@@ -530,7 +534,7 @@ class CourseFields(object):
...
@@ -530,7 +534,7 @@ class CourseFields(object):
default
=
False
,
default
=
False
,
)
)
cert_html_view_overrides
=
Dict
(
cert_html_view_overrides
=
Dict
(
# Translators: This field is the container for course-specific certifcate configuration values
# Translators: This field is the container for course-specific certif
i
cate configuration values
display_name
=
_
(
"Certificate Web/HTML View Overrides"
),
display_name
=
_
(
"Certificate Web/HTML View Overrides"
),
# Translators: These overrides allow for an alternative configuration of the certificate web view
# Translators: These overrides allow for an alternative configuration of the certificate web view
help
=
_
(
"Enter course-specific overrides for the Web/HTML template parameters here (JSON format)"
),
help
=
_
(
"Enter course-specific overrides for the Web/HTML template parameters here (JSON format)"
),
...
@@ -539,7 +543,7 @@ class CourseFields(object):
...
@@ -539,7 +543,7 @@ class CourseFields(object):
# Specific certificate information managed via Studio (should eventually fold other cert settings into this)
# Specific certificate information managed via Studio (should eventually fold other cert settings into this)
certificates
=
Dict
(
certificates
=
Dict
(
# Translators: This field is the container for course-specific certifcate configuration values
# Translators: This field is the container for course-specific certif
i
cate configuration values
display_name
=
_
(
"Certificate Configuration"
),
display_name
=
_
(
"Certificate Configuration"
),
# Translators: These overrides allow for an alternative configuration of the certificate web view
# Translators: These overrides allow for an alternative configuration of the certificate web view
help
=
_
(
"Enter course-specific configuration information here (JSON format)"
),
help
=
_
(
"Enter course-specific configuration information here (JSON format)"
),
...
@@ -915,6 +919,8 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
...
@@ -915,6 +919,8 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
except
InvalidTabsException
as
err
:
except
InvalidTabsException
as
err
:
raise
type
(
err
)(
'{msg} For course: {course_id}'
.
format
(
msg
=
err
.
message
,
course_id
=
unicode
(
self
.
id
)))
raise
type
(
err
)(
'{msg} For course: {course_id}'
.
format
(
msg
=
err
.
message
,
course_id
=
unicode
(
self
.
id
)))
self
.
set_default_certificate_available_date
()
def
set_grading_policy
(
self
,
course_policy
):
def
set_grading_policy
(
self
,
course_policy
):
"""
"""
The JSON object can have the keys GRADER and GRADE_CUTOFFS. If either is
The JSON object can have the keys GRADER and GRADE_CUTOFFS. If either is
...
@@ -940,6 +946,10 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
...
@@ -940,6 +946,10 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
self
.
raw_grader
=
grading_policy
[
'GRADER'
]
# used for cms access
self
.
raw_grader
=
grading_policy
[
'GRADER'
]
# used for cms access
self
.
grade_cutoffs
=
grading_policy
[
'GRADE_CUTOFFS'
]
self
.
grade_cutoffs
=
grading_policy
[
'GRADE_CUTOFFS'
]
def
set_default_certificate_available_date
(
self
):
if
(
not
self
.
certificate_available_date
)
and
self
.
end
:
self
.
certificate_available_date
=
self
.
end
+
timedelta
(
days
=
2
)
@classmethod
@classmethod
def
read_grading_policy
(
cls
,
paths
,
system
):
def
read_grading_policy
(
cls
,
paths
,
system
):
"""Load a grading policy from the specified paths, in order, if it exists."""
"""Load a grading policy from the specified paths, in order, if it exists."""
...
...
common/lib/xmodule/xmodule/seq_module.py
View file @
fb36c7df
...
@@ -523,7 +523,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
...
@@ -523,7 +523,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
class
SequenceDescriptor
(
SequenceFields
,
ProctoringFields
,
MakoModuleDescriptor
,
XmlDescriptor
):
class
SequenceDescriptor
(
SequenceFields
,
ProctoringFields
,
MakoModuleDescriptor
,
XmlDescriptor
):
"""
"""
A Sequences Descriptor object
A Sequence
'
s Descriptor object
"""
"""
mako_template
=
'widgets/sequence-edit.html'
mako_template
=
'widgets/sequence-edit.html'
module_class
=
SequenceModule
module_class
=
SequenceModule
...
...
common/lib/xmodule/xmodule/tests/test_course_module.py
View file @
fb36c7df
...
@@ -359,7 +359,7 @@ class CourseDescriptorTestCase(unittest.TestCase):
...
@@ -359,7 +359,7 @@ class CourseDescriptorTestCase(unittest.TestCase):
Initialize dummy testing course.
Initialize dummy testing course.
"""
"""
super
(
CourseDescriptorTestCase
,
self
)
.
setUp
()
super
(
CourseDescriptorTestCase
,
self
)
.
setUp
()
self
.
course
=
get_dummy_course
(
start
=
_TODAY
)
self
.
course
=
get_dummy_course
(
start
=
_TODAY
,
end
=
_NEXT_WEEK
)
def
test_clean_id
(
self
):
def
test_clean_id
(
self
):
"""
"""
...
@@ -388,3 +388,11 @@ class CourseDescriptorTestCase(unittest.TestCase):
...
@@ -388,3 +388,11 @@ class CourseDescriptorTestCase(unittest.TestCase):
Test CourseDescriptor.number.
Test CourseDescriptor.number.
"""
"""
self
.
assertEqual
(
self
.
course
.
number
,
COURSE
)
self
.
assertEqual
(
self
.
course
.
number
,
COURSE
)
def
test_set_default_certificate_available_date
(
self
):
"""
The certificate_available_date field should default to two days
after the course end date.
"""
expected_certificate_available_date
=
self
.
course
.
end
+
timedelta
(
days
=
2
)
self
.
assertEqual
(
expected_certificate_available_date
,
self
.
course
.
certificate_available_date
)
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