mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
In the effort to reduce the number of database connections I introduced a small bug. This only affected the test templated letter flow, a None type error would happen when trying to creathe completed_at timestamp for a delivered message.
In the previous PR I removed the `update_notification` method to reduce the need for another update query. However, that meant the notification was marked as delivered without an updated_at timestamp. It is weird to set the updated_at when we create the notification. So is this a better fix? Or do I put the update back now? I recommend we push this fix now.
This commit is contained in:
@@ -5,7 +5,9 @@ from app.models import LETTER_TYPE
|
||||
from app.notifications.process_notifications import persist_notification
|
||||
|
||||
|
||||
def create_letter_notification(letter_data, template, api_key, status, reply_to_text=None, billable_units=None):
|
||||
def create_letter_notification(
|
||||
letter_data, template, api_key, status, reply_to_text=None, billable_units=None, updated_at=None
|
||||
):
|
||||
notification = persist_notification(
|
||||
template_id=template.id,
|
||||
template_version=template.version,
|
||||
@@ -24,6 +26,7 @@ def create_letter_notification(letter_data, template, api_key, status, reply_to_
|
||||
status=status,
|
||||
reply_to_text=reply_to_text,
|
||||
billable_units=billable_units,
|
||||
postage=letter_data.get('postage')
|
||||
postage=letter_data.get('postage'),
|
||||
updated_at=updated_at
|
||||
)
|
||||
return notification
|
||||
|
||||
Reference in New Issue
Block a user