Merge pull request #2796 from alphagov/split-letters-into-zips-based-on-postage

Split letters into zips based on postage
This commit is contained in:
Pea M. Tyczynska
2020-07-08 11:49:21 +01:00
committed by GitHub
3 changed files with 106 additions and 43 deletions

View File

@@ -733,7 +733,7 @@ def notifications_not_yet_sent(should_be_sending_after_seconds, notification_typ
return notifications
def dao_get_letters_to_be_printed(print_run_deadline):
def dao_get_letters_to_be_printed(print_run_deadline, postage):
"""
Return all letters created before the print run deadline that have not yet been sent
"""
@@ -741,7 +741,8 @@ def dao_get_letters_to_be_printed(print_run_deadline):
Notification.created_at < convert_bst_to_utc(print_run_deadline),
Notification.notification_type == LETTER_TYPE,
Notification.status == NOTIFICATION_CREATED,
Notification.key_type == KEY_TYPE_NORMAL
Notification.key_type == KEY_TYPE_NORMAL,
Notification.postage == postage,
).order_by(
Notification.created_at
).all()