Add job to schedule weekly deliveries#1978
Merged
stephencdaly merged 6 commits intomainfrom Mar 19, 2026
Merged
Conversation
Rename this class so we can use it for getting submissions for both daily and weekly batch deliveries.
We will add a separate method to get weekly batches, so rename the existing method.
Use the `.all_week` method to get the date range for the week, ensuring it is in the London timezone. For now, a week for batching will always start at the beginning of the day on a Monday. If this later becomes configurable, we will need to update this implementation.
Add a method, that given a date, will return batches of submissions per form and mode where the form has `send_weekly_submission_batch` set to true for the final submission in the week. Include all submissions for the week in the batch, even if they were submitted for an older version of the form that did not have `send_weekly_submission_batch` set to true.
eafde96 to
f0ffd44
Compare
theseanything
previously approved these changes
Mar 19, 2026
Add a job that will be run on a recurring schedule that finds all form_ids and modes to send submission batches for the previous week. For each form_id and mode, create a Delivery, associating the submissions with it, and schedule a SendSubmissionBatchJob to send the email.
Schedule the job to run every Monday at 2:15 AM London time. We tell users that we will run the job shortly after 2:00 AM. We're scheduling it to run a little while after the job to schedule the daily batches has run in order to spread the load on the system.
f0ffd44 to
b88eb1c
Compare
|
Contributor
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-1978.submit.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
theseanything
approved these changes
Mar 19, 2026
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 problem does this pull request solve?
Trello card: https://trello.com/c/BKWLt0FV
Add a recurring job that will run every Monday at 2:15am to created Delivery records and schedule SendSubmissionBatchJobs to send emails containing weekly batches of submissions per form and mode for the previous week for forms that have
send_weekly_submission_batchset to true.Things to consider when reviewing