feat(allocation): add --not-renewed-only flag to send_allowance_renewal_available_emails - #828
Open
matthew-li wants to merge 2 commits into
Open
feat(allocation): add --not-renewed-only flag to send_allowance_renewal_available_emails#828matthew-li wants to merge 2 commits into
matthew-li wants to merge 2 commits into
Conversation
…al_available_emails Add a --not-renewed-only option that restricts the recipient set to active projects that have not yet submitted a non-denied renewal request for the upcoming allowance year. Intended for mid-month reminder runs. Also adds Django TestCase tests (BRC + LRC variants) for both the AllowanceRenewalAvailableEmailSender class and the management command. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
CI generates a BRC env file. LRCTestBase.setUpClass enables LRC only long enough to run setup commands, then reverts. Without re-enabling LRC for each test method, flag checks in setUp and in the management command raise DoesNotExist / ImproperlyConfigured. Follow the existing pattern of wrapping per-test state with enable_deployment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds a
--not-renewed-onlyflag to thesend_allowance_renewal_available_emailsmanagement command. When set, the command restricts emails to active projects that have not yet submitted a non-denied (Under Review,Approved, orComplete) renewal request for the upcoming allowance year.Why
The command is typically run once at the start of the renewal window to announce that renewals are open. A mid-month reminder pass is useful, but should only target PIs who still haven't acted — not re-notify those who have already renewed. The new flag enables that use case.
Changes
send_allowance_renewal_available_emails: adds--not-renewed-onlyargparse flag; passes it through toAllowanceRenewalAvailableEmailSender.AllowanceRenewalAvailableEmailSender: addsnot_renewed_only=Falseconstructor parameter;_get_eligible_projects()excludes projects that are thepre_projectof any non-deniedAllocationRenewalRequestfor the next period when the flag is set. (Projects whose PI submitted a new project request instead of renewing are not excluded — that case is rare enough in practice to not warrant the added complexity.)test_allowance_renewal_available_email_sender.py— unit-level tests for_get_eligible_projects()andrun().test_send_allowance_renewal_available_emails.py— command-level tests covering--dry_run,--not-renewed-only, wet-run confirmation, and cancellation.Test plan
python manage.py test coldfront.core.allocation.tests.test_commands.test_send_allowance_renewal_available_emails.TestSendAllowanceRenewalAvailableEmailsBRCpython manage.py test coldfront.core.allocation.tests.test_commands.test_send_allowance_renewal_available_emails.TestSendAllowanceRenewalAvailableEmailsLRCpython manage.py test coldfront.core.project.tests.test_utils.test_renewal_utils.test_allowance_renewal_available_email_sender.TestAllowanceRenewalAvailableEmailSenderBRCpython manage.py test coldfront.core.project.tests.test_utils.test_renewal_utils.test_allowance_renewal_available_email_sender.TestAllowanceRenewalAvailableEmailSenderLRC