Removed an update statement to notifications.

It's a small change, but we should remove any db operations that are not necessary.
This commit is contained in:
Rebecca Law
2018-09-20 14:47:24 +01:00
parent 645da3f33d
commit b00308d122
5 changed files with 45 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ 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):
def create_letter_notification(letter_data, template, api_key, status, reply_to_text=None, billable_units=None):
notification = persist_notification(
template_id=template.id,
template_version=template.version,
@@ -19,6 +19,7 @@ def create_letter_notification(letter_data, template, api_key, status, reply_to_
reference=create_random_identifier(),
client_reference=letter_data.get('reference'),
status=status,
reply_to_text=reply_to_text
reply_to_text=reply_to_text,
billable_units=billable_units
)
return notification

View File

@@ -70,7 +70,8 @@ def persist_notification(
simulated=False,
created_by_id=None,
status=NOTIFICATION_CREATED,
reply_to_text=None
reply_to_text=None,
billable_units=None
):
notification_created_at = created_at or datetime.utcnow()
if not notification_id:
@@ -94,6 +95,7 @@ def persist_notification(
created_by_id=created_by_id,
status=status,
reply_to_text=reply_to_text,
billable_units=billable_units
)
if notification_type == SMS_TYPE: