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
234780f5
Commit
234780f5
authored
Oct 19, 2017
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Resolver.send into baseclass
parent
33a50cf8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
49 deletions
+13
-49
openedx/core/djangoapps/schedules/resolvers.py
+13
-49
No files found.
openedx/core/djangoapps/schedules/resolvers.py
View file @
234780f5
...
...
@@ -68,7 +68,19 @@ class BinnedSchedulesBaseResolver(PrefixedDebugLoggerMixin, RecipientResolver):
override_recipient_email
=
attr
.
ib
(
default
=
None
)
def
send
(
self
,
msg_type
):
pass
_annotate_for_monitoring
(
msg_type
,
self
.
site
,
self
.
bin_num
,
self
.
target_datetime
,
self
.
day_offset
)
for
(
user
,
language
,
context
)
in
self
.
schedules_for_bin
():
msg
=
msg_type
.
personalize
(
Recipient
(
user
.
username
,
self
.
override_recipient_email
or
user
.
email
,
),
language
,
context
,
)
with
function_trace
(
'enqueue_send_task'
):
self
.
async_send_task
.
apply_async
((
self
.
site
.
id
,
str
(
msg
)),
retry
=
False
)
def
get_schedules_with_target_date_by_bin_and_orgs
(
schedule_date_field
,
current_datetime
,
target_datetime
,
bin_num
,
num_bins
=
DEFAULT_NUM_BINS
,
org_list
=
None
,
exclude_orgs
=
False
,
...
...
@@ -168,22 +180,6 @@ class ScheduleStartResolver(BinnedSchedulesBaseResolver):
"""
log_prefix
=
'Scheduled Nudge'
def
send
(
self
,
msg_type
):
_annotate_for_monitoring
(
msg_type
,
self
.
site
,
self
.
bin_num
,
self
.
target_datetime
,
self
.
day_offset
)
for
(
user
,
language
,
context
)
in
self
.
schedules_for_bin
():
msg
=
msg_type
.
personalize
(
Recipient
(
user
.
username
,
self
.
override_recipient_email
or
user
.
email
,
),
language
,
context
,
)
with
function_trace
(
'enqueue_send_task'
):
self
.
async_send_task
.
apply_async
(
(
self
.
site
.
id
,
str
(
msg
)),
retry
=
False
)
def
schedules_for_bin
(
self
):
# TODO: in the next refactor of this task, pass in current_datetime instead of reproducing it here
current_datetime
=
self
.
target_datetime
-
datetime
.
timedelta
(
days
=
self
.
day_offset
)
...
...
@@ -239,22 +235,6 @@ class UpgradeReminderResolver(BinnedSchedulesBaseResolver):
"""
log_prefix
=
'Upgrade Reminder'
def
send
(
self
,
msg_type
):
_annotate_for_monitoring
(
msg_type
,
self
.
site
,
self
.
bin_num
,
self
.
target_datetime
,
self
.
day_offset
)
for
(
user
,
language
,
context
)
in
self
.
schedules_for_bin
():
msg
=
msg_type
.
personalize
(
Recipient
(
user
.
username
,
self
.
override_recipient_email
or
user
.
email
,
),
language
,
context
,
)
with
function_trace
(
'enqueue_send_task'
):
self
.
async_send_task
.
apply_async
(
(
self
.
site
.
id
,
str
(
msg
)),
retry
=
False
)
def
schedules_for_bin
(
self
):
# TODO: in the next refactor of this task, pass in current_datetime instead of reproducing it here
current_datetime
=
self
.
target_datetime
-
datetime
.
timedelta
(
days
=
self
.
day_offset
)
...
...
@@ -335,22 +315,6 @@ class CourseUpdateResolver(BinnedSchedulesBaseResolver):
"""
log_prefix
=
'Course Update'
def
send
(
self
,
msg_type
):
_annotate_for_monitoring
(
msg_type
,
self
.
site
,
self
.
bin_num
,
self
.
target_datetime
,
self
.
day_offset
)
for
(
user
,
language
,
context
)
in
self
.
_course_update_schedules_for_bin
():
msg
=
msg_type
.
personalize
(
Recipient
(
user
.
username
,
self
.
override_recipient_email
or
user
.
email
,
),
language
,
context
,
)
with
function_trace
(
'enqueue_send_task'
):
self
.
async_send_task
.
apply_async
(
(
self
.
site
.
id
,
str
(
msg
)),
retry
=
False
)
def
schedules_for_bin
(
self
):
# TODO: in the next refactor of this task, pass in current_datetime instead of reproducing it here
current_datetime
=
self
.
target_datetime
-
datetime
.
timedelta
(
days
=
self
.
day_offset
)
...
...
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