Merge pull request #317 from KiwiTechLLC/ZBKBCK-52

check answer api fixed
This commit is contained in:
Abu Talib
2023-09-08 16:56:18 +05:30
committed by GitHub

View File

@ -104,7 +104,6 @@ def send_notification(notification_type, from_user_id, from_user_type, to_user_i
notification_data, push_data, from_user, to_user = get_notification_data(notification_type, from_user_id,
from_user_type, to_user_id, extra_data)
user_notification_type = UserNotification.objects.filter(user=to_user).first()
notification_data.update({'badge': Notification.objects.filter(notification_to=to_user, is_read=False).count()})
Notification.objects.create(notification_type=notification_type, notification_from=from_user,
notification_to=to_user, data=notification_data)
if user_notification_type and user_notification_type.push_notification:
@ -139,13 +138,10 @@ def send_notification_multiple_user(notification_type, from_user_id, from_user_t
notification_list = []
for user in to_user_list:
notification_copy_data = notification_data.copy()
notification_copy_data.update(
{'badge': Notification.objects.filter(notification_to=user, is_read=False).count()})
notification_list.append(Notification(notification_type=notification_type,
notification_to=user,
notification_from=from_user,
data=notification_copy_data))
data=notification_data))
Notification.objects.bulk_create(notification_list)
to_user_list = to_user_list.filter(user_notification__push_notification=True)
send_multiple_push(to_user_list, push_data)