mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Merge branch 'master' into fix-billable-units-query
Conflicts: tests/app/dao/test_notification_dao.py
This commit is contained in:
@@ -129,9 +129,17 @@ def dao_create_notification(notification):
|
||||
if not notification.status:
|
||||
notification.status = 'created'
|
||||
|
||||
notification_history = NotificationHistory.from_original(notification)
|
||||
db.session.add(notification)
|
||||
db.session.add(notification_history)
|
||||
if _should_record_notification_in_history_table(notification):
|
||||
db.session.add(NotificationHistory.from_original(notification))
|
||||
|
||||
|
||||
def _should_record_notification_in_history_table(notification):
|
||||
if notification.api_key_id and notification.key_type == KEY_TYPE_TEST:
|
||||
return False
|
||||
if notification.service.research_mode:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _decide_permanent_temporary_failure(current_status, status):
|
||||
@@ -188,9 +196,11 @@ def update_notification_status_by_reference(reference, status):
|
||||
@statsd(namespace="dao")
|
||||
def dao_update_notification(notification):
|
||||
notification.updated_at = datetime.utcnow()
|
||||
notification_history = NotificationHistory.query.get(notification.id)
|
||||
notification_history.update_from_original(notification)
|
||||
db.session.add(notification)
|
||||
if _should_record_notification_in_history_table(notification):
|
||||
notification_history = NotificationHistory.query.get(notification.id)
|
||||
notification_history.update_from_original(notification)
|
||||
db.session.add(notification_history)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user