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
26303580
Unverified
Commit
26303580
authored
Nov 17, 2017
by
Gabe Mulley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update schedule start when course start date changes
parent
8b8677a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
openedx/core/djangoapps/schedules/signals.py
+11
-13
openedx/core/djangoapps/schedules/tests/test_signals.py
+2
-2
No files found.
openedx/core/djangoapps/schedules/signals.py
View file @
26303580
...
...
@@ -89,19 +89,17 @@ def update_schedules_on_course_start_changed(sender, updated_course_overview, pr
Updates all course schedules if course hasn't started yet and
the updated start date is still in the future.
"""
current_time
=
timezone
.
now
()
if
previous_start_date
>
current_time
and
updated_course_overview
.
start
>
current_time
:
upgrade_deadline
=
_calculate_upgrade_deadline
(
updated_course_overview
.
id
,
content_availability_date
=
updated_course_overview
.
start
,
)
update_course_schedules
.
apply_async
(
kwargs
=
dict
(
course_id
=
unicode
(
updated_course_overview
.
id
),
new_start_date_str
=
date
.
serialize
(
updated_course_overview
.
start
),
new_upgrade_deadline_str
=
date
.
serialize
(
upgrade_deadline
),
),
)
upgrade_deadline
=
_calculate_upgrade_deadline
(
updated_course_overview
.
id
,
content_availability_date
=
updated_course_overview
.
start
,
)
update_course_schedules
.
apply_async
(
kwargs
=
dict
(
course_id
=
unicode
(
updated_course_overview
.
id
),
new_start_date_str
=
date
.
serialize
(
updated_course_overview
.
start
),
new_upgrade_deadline_str
=
date
.
serialize
(
upgrade_deadline
),
),
)
def
_calculate_upgrade_deadline
(
course_id
,
content_availability_date
):
...
...
openedx/core/djangoapps/schedules/tests/test_signals.py
View file @
26303580
...
...
@@ -165,7 +165,7 @@ class UpdateScheduleTests(SharedModuleStoreTestCase):
course
.
start
=
course
.
start
+
datetime
.
timedelta
(
days
=
3
)
# new course start changes to another future date
self
.
store
.
update_item
(
course
,
ModuleStoreEnum
.
UserID
.
test
)
enrollment
=
CourseEnrollment
.
objects
.
get
(
id
=
enrollment
.
id
)
self
.
assert_schedule_dates
(
enrollment
.
schedule
,
enrollment
.
created
)
# start remains unchanged
self
.
assert_schedule_dates
(
enrollment
.
schedule
,
course
.
start
)
# start set to new course start
def
test_not_updated_since_new_start_in_past
(
self
,
mock_get_current_site
):
mock_get_current_site
.
return_value
=
self
.
site
...
...
@@ -178,7 +178,7 @@ class UpdateScheduleTests(SharedModuleStoreTestCase):
course
.
start
=
course
.
start
+
datetime
.
timedelta
(
days
=-
10
)
# new course start changes to a past date
self
.
store
.
update_item
(
course
,
ModuleStoreEnum
.
UserID
.
test
)
enrollment
=
CourseEnrollment
.
objects
.
get
(
id
=
enrollment
.
id
)
self
.
assert_schedule_dates
(
enrollment
.
schedule
,
previous_start
)
# start remains unchanged
self
.
assert_schedule_dates
(
enrollment
.
schedule
,
course
.
start
)
# start set to new course start
def
_create_course_run
(
self_paced
=
True
,
start_day_offset
=-
1
):
...
...
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