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
662a2c23
Commit
662a2c23
authored
Aug 14, 2017
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Convert RecurringNudge emails to multiple tasks
parent
fac4e387
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
openedx/core/djangoapps/schedules/management/commands/send_recurring_nudge.py
+16
-12
No files found.
openedx/core/djangoapps/schedules/management/commands/send_recurring_nudge.py
View file @
662a2c23
...
...
@@ -33,26 +33,26 @@ class ScheduleStartResolver(RecipientResolver):
def
__init__
(
self
,
target_start_date
):
self
.
target_start_date
=
target_start_date
def
send
(
self
,
msg_type
):
schedule_day
.
delay
(
self
.
target_start_date
)
def
build_email_context
(
self
):
def
send
(
self
,
week
):
schedule_day
.
delay
(
week
,
self
.
target_start_date
)
@task
def
schedule_day
(
target_date
):
def
schedule_day
(
week
,
target_date
):
for
hour
in
range
(
23
):
schedule_hour
.
delay
(
target_date
,
hour
)
schedule_hour
.
delay
(
week
,
target_date
,
hour
)
@task
def
schedule_hour
(
target_date
,
hour
):
def
schedule_hour
(
week
,
target_date
,
hour
):
for
minute
in
range
(
60
):
schedule_minute
.
delay
(
target_date
,
hour
,
minute
)
schedule_minute
.
delay
(
week
,
target_date
,
hour
,
minute
)
@task
def
schedule_minute
(
target_date
,
hour
,
minute
):
def
schedule_minute
(
week
,
target_date
,
hour
,
minute
):
msg_type
=
RecurringNudge
(
week
)
for
(
user
,
language
,
context
)
in
schedules_for_minute
(
target_date
,
hour
,
minute
):
msg
=
msg_type
.
personalize
(
Recipient
(
...
...
@@ -62,7 +62,12 @@ def schedule_minute(target_date, hour, minute):
language
,
context
)
ace
.
send
.
delay
(
msg
)
schedule_send
.
delay
(
msg
)
@task
def
schedule_send
(
msg
):
ace
.
send
(
msg
)
def
schedules_for_minute
(
target_date
,
hour
,
minute
):
...
...
@@ -118,6 +123,5 @@ class Command(BaseCommand):
current_date
=
datetime
.
date
(
*
[
int
(
x
)
for
x
in
options
[
'date'
]
.
split
(
'-'
)])
for
week
in
(
1
,
2
,
3
,
4
):
msg_t
=
RecurringNudge
(
week
)
target_date
=
current_date
+
datetime
.
timedelta
(
days
=
week
*
7
)
ScheduleStartResolver
(
target_date
)
.
send
(
msg_t
)
ScheduleStartResolver
(
target_date
)
.
send
(
week
)
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