changes in notification method

This commit is contained in:
abutalib-kiwi
2023-08-16 16:40:34 +05:30
parent e73113fcca
commit 3017b0ece0
9 changed files with 72 additions and 37 deletions

View File

@ -29,7 +29,7 @@ from .utils import real_time, convert_timedelta_into_datetime, update_referral_p
# notification's constant
from notifications.constants import TASK_POINTS, TASK_REJECTED
# send notification function
from notifications.utils import send_notification
from notifications.utils import send_notification, send_notification_to_junior
# In this serializer file
@ -383,7 +383,8 @@ class ApproveTaskSerializer(serializers.ModelSerializer):
# update complete time of task
# instance.completed_on = real_time()
instance.completed_on = timezone.now().astimezone(pytz.utc)
send_notification.delay(TASK_POINTS, None, junior_details.auth.id, {})
send_notification_to_junior.delay(TASK_POINTS, None, junior_details.auth.id,
{'task_id': instance.id})
else:
# reject the task
instance.task_status = str(NUMBER['three'])
@ -391,7 +392,8 @@ class ApproveTaskSerializer(serializers.ModelSerializer):
# update reject time of task
# instance.rejected_on = real_time()
instance.rejected_on = timezone.now().astimezone(pytz.utc)
send_notification.delay(TASK_REJECTED, None, junior_details.auth.id, {})
send_notification_to_junior.delay(TASK_REJECTED, None, junior_details.auth.id,
{'task_id': instance.id})
instance.save()
junior_data.save()
return junior_details