-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat: due date reminder #32826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
feat: due date reminder #32826
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.