creating only one notification per notification_type, even if multiple users request the same notification_type.
This commit is contained in:
parent
fae07bdadf
commit
0de47e2627
@ -313,13 +313,17 @@ class Notifier():
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_notifications_for_user_list(shipcall, users:list[model.User]):
|
def create_notifications_for_user_list(shipcall, users:list[model.User]):
|
||||||
|
notification_type_list = []
|
||||||
for user in users:
|
for user in users:
|
||||||
notification_type_list = Notifier.build_notification_type_list(user)
|
user_notification_type_list = Notifier.build_notification_type_list(user)
|
||||||
|
notification_type_list.extend(user_notification_type_list)
|
||||||
|
|
||||||
for notification_type in notification_type_list:
|
# get the unique notification types
|
||||||
schemaModel = dict(shipcall_id = shipcall.id, level = int(shipcall.evaluation), type = notification_type, message = "", created = datetime.datetime.now(), modified=None)
|
notification_type_list = list(set(notification_type_list))
|
||||||
query = SQLQuery.get_notifications_post(schemaModel)
|
for notification_type in notification_type_list:
|
||||||
schemas = execute_sql_query_standalone(query=query, param=schemaModel, command_type="execute")
|
schemaModel = dict(shipcall_id = shipcall.id, level = int(shipcall.evaluation), type = notification_type, message = "", created = datetime.datetime.now(), modified=None)
|
||||||
|
query = SQLQuery.get_notifications_post(schemaModel)
|
||||||
|
schemas = execute_sql_query_standalone(query=query, param=schemaModel, command_type="execute")
|
||||||
return
|
return
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user