Skip to content

Commit

Permalink
check if notification already exists to prevent duplicate insert atte…
Browse files Browse the repository at this point in the history
…mpts
  • Loading branch information
Kenneth Kehl committed Dec 2, 2024
1 parent 56a1b50 commit 8e296c3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/dao/notifications_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ def dao_create_notification(notification):
notification.to = "1"
notification.normalised_to = "1"

result = None
if notification.notification_type == NotificationType.SMS:
stmt = select(Notification).where(Notification.id == notification.id)
result = db.session.execute(stmt).scalar()
stmt = select(Notification).where(Notification.id == notification.id)
result = db.session.execute(stmt).scalar()
print(f"RESULT IN NOTIFICATIONS_DAO FROM Scalar is {result}")
if result is None:
db.session.add(notification)

Expand Down

0 comments on commit 8e296c3

Please sign in to comment.