From 27b9f46f300dc60511dfb98bb7edba2081606a48 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 6 Mar 2025 09:51:12 +0100 Subject: [PATCH] Avoid adding the same notification twice to a sender --- src/server/BreCal/services/schedule_routines.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/BreCal/services/schedule_routines.py b/src/server/BreCal/services/schedule_routines.py index f108933..446b786 100644 --- a/src/server/BreCal/services/schedule_routines.py +++ b/src/server/BreCal/services/schedule_routines.py @@ -220,7 +220,8 @@ def SendNotifications(): if user["notify_email"]: if user["user_email"] not in email_dict: email_dict[user["user_email"]] = [] - email_dict[user["user_email"]].append(notification) + if notification not in email_dict[user["user_email"]]: + email_dict[user["user_email"]].append(notification) if user["notify_whatsapp"]: # TBD pass @@ -236,7 +237,8 @@ def SendNotifications(): if user["notify_email"] and notification.type in user_notifications: if user["user_email"] not in email_dict: email_dict[user["user_email"]] = [] - email_dict[user["user_email"]].append(notification) + if notification not in email_dict[user["user_email"]]: + email_dict[user["user_email"]].append(notification) if user["notify_whatsapp"] and notification.type in user_notifications: # TBD pass