Change the query to get the notifications for the check_templated_letter_state.

Now looking at the updated_at date, we are getting the alert if the notification was created_at:17:29 updated to created status at 17:30, so the letter is in the next days bucket.

Not sure if I want to make this change, there isn't an index on updated_at, so the query might be slow.
This commit is contained in:
Rebecca Law
2019-08-16 10:37:51 +01:00
parent 92d78956be
commit f097abe82b
2 changed files with 14 additions and 14 deletions

View File

@@ -689,11 +689,11 @@ def dao_old_letters_with_created_status():
last_processing_deadline = yesterday_bst.replace(hour=17, minute=30, second=0, microsecond=0)
notifications = Notification.query.filter(
Notification.created_at < convert_bst_to_utc(last_processing_deadline),
Notification.updated_at < convert_bst_to_utc(last_processing_deadline),
Notification.notification_type == LETTER_TYPE,
Notification.status == NOTIFICATION_CREATED
).order_by(
Notification.created_at
Notification.updated_at
).all()
return notifications