-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a command to send reminder emails for self-paced courses with relative due dates.
- Loading branch information
1 parent
4266934
commit 8f213ac
Showing
24 changed files
with
826 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" | ||
This module contains various configuration settings via | ||
waffle switches for the course_date_signals app. | ||
""" | ||
|
||
|
||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag | ||
|
||
# .. toggle_name: studio.custom_relative_dates | ||
# .. toggle_implementation: CourseWaffleFlag | ||
# .. toggle_default: False | ||
# .. toggle_description: Waffle flag to enable custom pacing input for Personalized Learner Schedule (PLS). | ||
# .. This flag guards an input in Studio for a self paced course, where the user can enter date offsets | ||
# .. for a subsection. | ||
# .. toggle_use_cases: temporary | ||
# .. toggle_creation_date: 2021-07-12 | ||
# .. toggle_target_removal_date: 2021-12-31 | ||
# .. toggle_warning: Flag course_experience.relative_dates should also be active for relative dates functionalities to work. | ||
# .. toggle_tickets: https://openedx.atlassian.net/browse/AA-844 | ||
CUSTOM_RELATIVE_DATES = CourseWaffleFlag('studio.custom_relative_dates', __name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
openedx/core/djangoapps/schedules/management/commands/send_course_due_date_reminders.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
Management command to send Schedule course due date reminders | ||
""" | ||
|
||
import datetime | ||
import pytz | ||
from textwrap import dedent # lint-amnesty, pylint: disable=wrong-import-order | ||
|
||
from django.contrib.sites.models import Site | ||
|
||
from openedx.core.djangoapps.schedules.management.commands import SendEmailBaseCommand | ||
from openedx.core.djangoapps.schedules.tasks import COURSE_DUE_DATE_REMINDER_LOG_PREFIX, ScheduleCourseDueDateReminders | ||
|
||
|
||
class Command(SendEmailBaseCommand): | ||
""" | ||
Command to send due date reminders for subsections in Self paced courses. | ||
Note: this feature does not support reminders for INDIVIDUAL_DUE_DATES as the applicable schedule | ||
objects are fetched based on course relative due dates. | ||
Usage: | ||
./manage.py lms send_course_due_date_reminders localhost:18000 --due 7 --date 2023-06-07 | ||
Positional required args: | ||
- site: Django site domain name, for example: localhost:18000 | ||
Keyword Required args | ||
- due-in: Remind subsections due in given days | ||
Optional args: | ||
- date: The date to compute weekly messages relative to, in YYYY-MM-DD format. | ||
- override-recipient-email: Send all emails to this address instead of the actual recipient | ||
""" | ||
help = dedent(__doc__).strip() | ||
async_send_task = ScheduleCourseDueDateReminders | ||
log_prefix = COURSE_DUE_DATE_REMINDER_LOG_PREFIX | ||
|
||
def add_arguments(self, parser): | ||
super().add_arguments(parser) | ||
parser.add_argument( | ||
'--due-in', | ||
type=int, | ||
help='Remind subsections due in given days', | ||
) | ||
|
||
def handle(self, *args, **options): | ||
current_date = datetime.datetime( | ||
*[int(x) for x in options['date'].split('-')], | ||
tzinfo=pytz.UTC | ||
) | ||
|
||
site = Site.objects.get(domain__iexact=options['site_domain_name']) | ||
override_recipient_email = options.get('override_recipient_email') | ||
|
||
self.async_send_task.enqueue(site, current_date, options['due_in'], override_recipient_email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.