added notification for getting points after reading article

This commit is contained in:
abutalib-kiwi
2023-08-25 19:08:15 +05:30
parent 9b6a84c7d1
commit 5b2ab2275e
5 changed files with 18 additions and 8 deletions

View File

@ -77,6 +77,7 @@ def get_notification_data(notification_type, from_user_id, from_user_type, to_us
push_data = NOTIFICATION_DICT[notification_type].copy()
notification_data = push_data.copy()
task_name = None
points = extra_data.get('points', None)
if 'task_id' in extra_data:
task = JuniorTask.objects.filter(id=extra_data.get('task_id')).first()
task_name = task.task_name
@ -85,8 +86,9 @@ def get_notification_data(notification_type, from_user_id, from_user_type, to_us
from_user_name, from_user_image, from_user = get_from_user_details(from_user_id, from_user_type)
push_data['body'] = push_data['body'].format(from_user=from_user_name, task_name=task_name)
notification_data['body'] = notification_data['body'].format(from_user=from_user_name, task_name=task_name)
push_data['body'] = push_data['body'].format(from_user=from_user_name, task_name=task_name, points=points)
notification_data['body'] = notification_data['body'].format(from_user=from_user_name,
task_name=task_name, points=points)
notification_data['from_user'] = from_user_name
notification_data['from_user_image'] = from_user_image