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
OpenEdx
edx-platform
Commits
178b3269
Commit
178b3269
authored
Oct 19, 2017
by
Calen Pennington
Committed by
Dillon Dumesnil
Oct 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass an instantiated Site object into schedule_bin
parent
c272f514
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
openedx/core/djangoapps/schedules/resolvers.py
+6
-9
openedx/core/djangoapps/schedules/tasks.py
+1
-1
No files found.
openedx/core/djangoapps/schedules/resolvers.py
View file @
178b3269
...
...
@@ -157,13 +157,12 @@ class ScheduleStartResolver(BinnedSchedulesBaseResolver):
log_prefix
=
'Scheduled Nudge'
def
schedule_bin
(
self
,
async_send_task
,
site
_id
,
target_day_str
,
day_offset
,
bin_num
,
org_list
,
exclude_orgs
=
False
,
override_recipient_email
=
None
,
self
,
async_send_task
,
site
,
target_day_str
,
day_offset
,
bin_num
,
org_list
,
exclude_orgs
=
False
,
override_recipient_email
=
None
,
):
target_datetime
=
deserialize
(
target_day_str
)
# TODO: in the next refactor of this task, pass in current_datetime instead of reproducing it here
current_datetime
=
target_datetime
-
datetime
.
timedelta
(
days
=
day_offset
)
msg_type
=
RecurringNudge
(
abs
(
day_offset
))
site
=
Site
.
objects
.
get
(
id
=
site_id
)
_annotate_for_monitoring
(
msg_type
,
site
,
bin_num
,
target_day_str
,
day_offset
)
...
...
@@ -185,7 +184,7 @@ class ScheduleStartResolver(BinnedSchedulesBaseResolver):
)
with
function_trace
(
'enqueue_send_task'
):
async_send_task
.
apply_async
(
(
site
_
id
,
str
(
msg
)),
retry
=
False
)
(
site
.
id
,
str
(
msg
)),
retry
=
False
)
def
schedules_for_bin
(
self
,
site
,
current_datetime
,
target_datetime
,
bin_num
,
org_list
,
exclude_orgs
=
False
):
...
...
@@ -241,13 +240,12 @@ class UpgradeReminderResolver(BinnedSchedulesBaseResolver):
log_prefix
=
'Upgrade Reminder'
def
schedule_bin
(
self
,
async_send_task
,
site
_id
,
target_day_str
,
day_offset
,
bin_num
,
org_list
,
exclude_orgs
=
False
,
override_recipient_email
=
None
,
self
,
async_send_task
,
site
,
target_day_str
,
day_offset
,
bin_num
,
org_list
,
exclude_orgs
=
False
,
override_recipient_email
=
None
,
):
target_datetime
=
deserialize
(
target_day_str
)
# TODO: in the next refactor of this task, pass in current_datetime instead of reproducing it here
current_datetime
=
target_datetime
-
datetime
.
timedelta
(
days
=
day_offset
)
msg_type
=
UpgradeReminder
()
site
=
Site
.
objects
.
get
(
id
=
site_id
)
_annotate_for_monitoring
(
msg_type
,
site
,
bin_num
,
target_day_str
,
day_offset
)
...
...
@@ -270,7 +268,7 @@ class UpgradeReminderResolver(BinnedSchedulesBaseResolver):
)
with
function_trace
(
'enqueue_send_task'
):
async_send_task
.
apply_async
(
(
site
_
id
,
str
(
msg
)),
retry
=
False
)
(
site
.
id
,
str
(
msg
)),
retry
=
False
)
def
schedules_for_bin
(
self
,
site
,
current_datetime
,
target_datetime
,
bin_num
,
org_list
,
exclude_orgs
=
False
):
...
...
@@ -352,13 +350,12 @@ class CourseUpdateResolver(BinnedSchedulesBaseResolver):
log_prefix
=
'Course Update'
def
schedule_bin
(
self
,
async_send_task
,
site
_id
,
target_day_str
,
day_offset
,
bin_num
,
org_list
,
exclude_orgs
=
False
,
override_recipient_email
=
None
,
self
,
async_send_task
,
site
,
target_day_str
,
day_offset
,
bin_num
,
org_list
,
exclude_orgs
=
False
,
override_recipient_email
=
None
,
):
target_datetime
=
deserialize
(
target_day_str
)
# TODO: in the next refactor of this task, pass in current_datetime instead of reproducing it here
current_datetime
=
target_datetime
-
datetime
.
timedelta
(
days
=
day_offset
)
msg_type
=
CourseUpdate
()
site
=
Site
.
objects
.
get
(
id
=
site_id
)
_annotate_for_monitoring
(
msg_type
,
site
,
bin_num
,
target_day_str
,
day_offset
)
...
...
@@ -382,7 +379,7 @@ class CourseUpdateResolver(BinnedSchedulesBaseResolver):
)
with
function_trace
(
'enqueue_send_task'
):
async_send_task
.
apply_async
(
(
site
_
id
,
str
(
msg
)),
retry
=
False
)
(
site
.
id
,
str
(
msg
)),
retry
=
False
)
def
schedules_for_bin
(
self
,
site
,
current_datetime
,
target_datetime
,
day_offset
,
bin_num
,
org_list
,
exclude_orgs
=
False
):
...
...
openedx/core/djangoapps/schedules/tasks.py
View file @
178b3269
...
...
@@ -136,7 +136,7 @@ class ScheduleMessageBaseTask(Task):
):
return
self
.
resolver
()
.
schedule_bin
(
self
.
async_send_task
,
site_id
,
Site
.
objects
.
get
(
id
=
site_id
)
,
target_day_str
,
day_offset
,
bin_num
,
...
...
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