-
Notifications
You must be signed in to change notification settings - Fork 7
EAP: Add script to send deadline reminder notification #2617
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
Merged
susilnem
merged 4 commits into
feat/add-email-setup-and-template
from
feat/add-deadline-field-and-reminder-email-notification
Jan 2, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2b550a0
feat(eap): Add dead line field on registration model and eap submissi…
sudip-khanal 2968d87
fix(eap): Change reminder target from 10 days to 1 week
sudip-khanal 80f20bd
chore(eap): Rename dead_line field to deadline and add deadline remin…
sudip-khanal a7b823a
fix(eap): Use iterator in deadline reminder queryset
sudip-khanal 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| from datetime import timedelta | ||
|
|
||
| from django.core.management.base import BaseCommand | ||
| from django.utils import timezone | ||
| from sentry_sdk.crons import monitor | ||
|
|
||
| from eap.models import EAPRegistration | ||
| from eap.tasks import send_deadline_reminder_email | ||
| from main.sentry import SentryMonitor | ||
|
|
||
|
|
||
| class Command(BaseCommand): | ||
| help = "Send EAP submission reminder emails 1 week before deadline" | ||
|
|
||
| @monitor(monitor_slug=SentryMonitor.EAP_SUBMISSION_REMINDER) | ||
| def handle(self, *args, **options): | ||
| """ | ||
| Finds EAP-registrations whose submission deadline is exactly 1 week from today | ||
| and sends reminder emails for each matching registration. | ||
| """ | ||
| target_date = timezone.now().date() + timedelta(weeks=1) | ||
| queryset = EAPRegistration.objects.filter( | ||
| deadline=target_date, | ||
| ) | ||
|
|
||
| if not queryset.exists(): | ||
| self.stdout.write(self.style.NOTICE("No EAP registrations found for deadline reminder.")) | ||
| return | ||
|
|
||
| for instance in queryset.iterator(): | ||
| self.stdout.write(self.style.NOTICE(f"Sending deadline reminder email for EAPRegistration ID={instance.id}")) | ||
| send_deadline_reminder_email(instance.id) | ||
|
|
||
| self.stdout.write(self.style.SUCCESS("Successfully sent all deadline reminder emails.")) |
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,23 @@ | ||
| # Generated by Django 4.2.26 on 2025-12-24 05:46 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('eap', '0013_alter_eapregistration_national_society_contact_email_and_more'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='eapregistration', | ||
| name='deadline', | ||
| field=models.DateField(blank=True, help_text='Date by which the EAP submission must be completed.', null=True, verbose_name='deadline'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='eapregistration', | ||
| name='deadline_remainder_sent_at', | ||
| field=models.DateTimeField(blank=True, help_text='Timestamp when the deadline reminder email was sent.', null=True, verbose_name='deadline reminder email sent at'), | ||
| ), | ||
| ] |
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
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.