mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Don't do anything if the query doesn't yield results.
This commit is contained in:
@@ -395,21 +395,22 @@ def insert_update_notification_history(notification_type, date_to_delete_from, s
|
|||||||
Notification.key_type != KEY_TYPE_TEST
|
Notification.key_type != KEY_TYPE_TEST
|
||||||
).all()
|
).all()
|
||||||
|
|
||||||
stmt = insert(NotificationHistory).values(
|
if notifications:
|
||||||
notifications
|
stmt = insert(NotificationHistory).values(
|
||||||
)
|
notifications
|
||||||
|
)
|
||||||
|
|
||||||
stmt = stmt.on_conflict_do_update(
|
stmt = stmt.on_conflict_do_update(
|
||||||
constraint="notification_history_pkey",
|
constraint="notification_history_pkey",
|
||||||
set_={"notification_status": stmt.excluded.status,
|
set_={"notification_status": stmt.excluded.status,
|
||||||
"billable_units": stmt.excluded.billable_units,
|
"billable_units": stmt.excluded.billable_units,
|
||||||
"updated_at": stmt.excluded.updated_at,
|
"updated_at": stmt.excluded.updated_at,
|
||||||
"sent_at": stmt.excluded.sent_at,
|
"sent_at": stmt.excluded.sent_at,
|
||||||
"sent_by": stmt.excluded.sent_by
|
"sent_by": stmt.excluded.sent_by
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
db.session.connection().execute(stmt)
|
db.session.connection().execute(stmt)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
def _delete_letters_from_s3(
|
def _delete_letters_from_s3(
|
||||||
|
|||||||
Reference in New Issue
Block a user