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
22d3b028
Commit
22d3b028
authored
Jun 13, 2017
by
rabiaiftikhar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
respond to comments
parent
b84d4c02
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
lms/djangoapps/certificates/tests/test_signals.py
+3
-1
openedx/core/djangoapps/models/course_details.py
+4
-4
No files found.
lms/djangoapps/certificates/tests/test_signals.py
View file @
22d3b028
...
...
@@ -22,19 +22,21 @@ class SelfGeneratedCertsSignalTest(ModuleStoreTestCase):
# Enable the feature
CertificateGenerationConfiguration
.
objects
.
create
(
enabled
=
True
)
def
test_cert_generation_flag_on_pacing_toggle
(
self
):
"""
Verify that signal enables or disables self-generated certificates
according to course-pacing.
"""
#self-generation of cert disables by default
self
.
assertFalse
(
certs_api
.
cert_generation_enabled
(
self
.
course
.
id
))
_listen_for_course_pacing_changed
(
'store'
,
self
.
course
.
id
,
self
.
course
.
self_paced
)
#verify that self-generation of cert is enabled for self-paced course
self
.
assertTrue
(
certs_api
.
cert_generation_enabled
(
self
.
course
.
id
))
self
.
course
.
self_paced
=
False
self
.
store
.
update_item
(
self
.
course
,
self
.
user
.
id
)
_listen_for_course_pacing_changed
(
'store'
,
self
.
course
.
id
,
self
.
course
.
self_paced
)
# verify that self-generation of cert is disabled for instructor-paced course
self
.
assertFalse
(
certs_api
.
cert_generation_enabled
(
self
.
course
.
id
))
openedx/core/djangoapps/models/course_details.py
View file @
22d3b028
...
...
@@ -280,6 +280,10 @@ class CourseDetails(object):
if
dirty
:
module_store
.
update_item
(
descriptor
,
user
.
id
)
# fires a signal indicating that the course pacing has changed
if
is_pacing_changed
:
COURSE_PACING_CHANGE
.
send
(
sender
=
None
,
course_key
=
course_key
,
course_self_paced
=
descriptor
.
self_paced
)
# NOTE: below auto writes to the db w/o verifying that any of
# the fields actually changed to make faster, could compare
# against db or could have client send over a list of which
...
...
@@ -290,10 +294,6 @@ class CourseDetails(object):
cls
.
update_about_video
(
descriptor
,
jsondict
[
'intro_video'
],
user
.
id
)
# fires the signal that course pacing has changed after changes are reflected in db
if
is_pacing_changed
:
COURSE_PACING_CHANGE
.
send
(
sender
=
None
,
course_key
=
course_key
,
course_self_paced
=
descriptor
.
self_paced
)
# Could just return jsondict w/o doing any db reads, but I put
# the reads in as a means to confirm it persisted correctly
return
CourseDetails
.
fetch
(
course_key
)
...
...
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