Stop updating NotificationHistory

Doing my bit to remove imports of fixtures.
This commit is contained in:
Rebecca Law
2019-05-08 17:31:27 +01:00
parent a5ae77f5e0
commit 43334d63f3
5 changed files with 183 additions and 272 deletions

View File

@@ -164,14 +164,10 @@ def update_notification_status_by_reference(reference, status):
@statsd(namespace="dao")
@transactional
def dao_update_notification(notification):
notification.updated_at = datetime.utcnow()
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()
@statsd(namespace="dao")
@@ -529,12 +525,14 @@ def dao_update_notifications_by_reference(references, update_dict):
synchronize_session=False
)
updated_history_count = NotificationHistory.query.filter(
NotificationHistory.reference.in_(references)
).update(
update_dict,
synchronize_session=False
)
updated_history_count = 0
if updated_count == 0:
updated_history_count = NotificationHistory.query.filter(
NotificationHistory.reference.in_(references)
).update(
update_dict,
synchronize_session=False
)
return updated_count, updated_history_count