Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
94291287
Unverified
Commit
94291287
authored
7 years ago
by
Gabe Mulley
Browse files
Options
Downloads
Patches
Plain Diff
do not create schedules for instructor led courses
parent
2d408543
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openedx/core/djangoapps/schedules/signals.py
+13
-10
13 additions, 10 deletions
openedx/core/djangoapps/schedules/signals.py
openedx/core/djangoapps/schedules/tests/test_signals.py
+9
-22
9 additions, 22 deletions
openedx/core/djangoapps/schedules/tests/test_signals.py
with
22 additions
and
32 deletions
openedx/core/djangoapps/schedules/signals.py
+
13
−
10
View file @
94291287
...
...
@@ -41,17 +41,20 @@ def create_schedule(sender, **kwargs):
log
.
debug
(
'
Schedules: Creation not enabled for this course or for this site
'
)
return
if
not
enrollment
.
course_overview
.
self_paced
:
log
.
debug
(
'
Schedules: Creation only enabled for self-paced courses
'
)
return
delta
=
None
if
enrollment
.
course_overview
.
self_paced
:
global_config
=
DynamicUpgradeDeadlineConfiguration
.
current
()
if
global_config
.
enabled
:
# Use the default from this model whether or not the feature is enabled
delta
=
global_config
.
deadline_days
# Check if the course has a deadline override
course_config
=
CourseDynamicUpgradeDeadlineConfiguration
.
current
(
enrollment
.
course_id
)
if
course_config
.
enabled
:
delta
=
course_config
.
deadline_days
global_config
=
DynamicUpgradeDeadlineConfiguration
.
current
()
if
global_config
.
enabled
:
# Use the default from this model whether or not the feature is enabled
delta
=
global_config
.
deadline_days
# Check if the course has a deadline override
course_config
=
CourseDynamicUpgradeDeadlineConfiguration
.
current
(
enrollment
.
course_id
)
if
course_config
.
enabled
:
delta
=
course_config
.
deadline_days
upgrade_deadline
=
None
...
...
This diff is collapsed.
Click to expand it.
openedx/core/djangoapps/schedules/tests/test_signals.py
+
9
−
22
View file @
94291287
...
...
@@ -21,12 +21,14 @@ from ..tests.factories import ScheduleConfigFactory
class
CreateScheduleTests
(
SharedModuleStoreTestCase
):
def
assert_schedule_created
(
self
):
enrollment
=
CourseEnrollmentFactory
()
course
=
create_course_run
(
self_paced
=
True
)
enrollment
=
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
mode
=
CourseMode
.
AUDIT
)
self
.
assertIsNotNone
(
enrollment
.
schedule
)
self
.
assertIsNone
(
enrollment
.
schedule
.
upgrade_deadline
)
def
assert_schedule_not_created
(
self
):
enrollment
=
CourseEnrollmentFactory
()
course
=
create_course_run
(
self_paced
=
True
)
enrollment
=
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
mode
=
CourseMode
.
AUDIT
)
with
self
.
assertRaises
(
Schedule
.
DoesNotExist
):
enrollment
.
schedule
...
...
@@ -68,34 +70,19 @@ class CreateScheduleTests(SharedModuleStoreTestCase):
site
=
SiteFactory
.
create
()
mock_get_current_site
.
return_value
=
site
ScheduleConfigFactory
.
create
(
site
=
site
,
enabled
=
True
,
create_schedules
=
True
)
course
=
create_self_paced_course_run
()
DynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
enabled
=
False
)
course
=
create_course_run
(
self_paced
=
False
)
enrollment
=
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
mode
=
CourseMode
.
AUDIT
)
self
.
assertEqual
(
enrollment
.
schedule
.
start
,
enrollment
.
created
)
self
.
assertIsNone
(
enrollment
.
schedule
.
upgrade_deadline
)
@override_waffle_flag
(
SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_schedule_config_creation_enabled_instructor_paced_with_deadline
(
self
,
mock_get_current_site
):
site
=
SiteFactory
.
create
()
mock_get_current_site
.
return_value
=
site
ScheduleConfigFactory
.
create
(
site
=
site
,
enabled
=
True
,
create_schedules
=
True
)
course
=
create_self_paced_course_run
()
global_config
=
DynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
enabled
=
True
)
enrollment
=
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
mode
=
CourseMode
.
AUDIT
)
expected_deadline
=
enrollment
.
created
+
datetime
.
timedelta
(
days
=
global_config
.
deadline_days
)
self
.
assertEqual
(
enrollment
.
schedule
.
start
,
enrollment
.
created
)
self
.
assertEqual
(
enrollment
.
schedule
.
upgrade_deadline
,
expected_deadline
)
with
self
.
assertRaises
(
Schedule
.
DoesNotExist
):
enrollment
.
schedule
def
create_
self_paced_
course_run
():
def
create_course_run
(
self_paced
=
True
):
"""
Create a new course run and course modes.
Both audit and verified `CourseMode` objects will be created for the course run.
"""
now
=
datetime
.
datetime
.
now
(
utc
)
course
=
CourseFactory
.
create
(
start
=
now
+
datetime
.
timedelta
(
days
=-
1
),
self_paced
=
True
)
course
=
CourseFactory
.
create
(
start
=
now
+
datetime
.
timedelta
(
days
=-
1
),
self_paced
=
self_paced
)
CourseModeFactory
(
course_id
=
course
.
id
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment