mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-27 00:54:54 +00:00
jira-28 notification
This commit is contained in:
@ -35,7 +35,7 @@ from account.utils import custom_response, custom_error_response, OTP_EXPIRY, se
|
||||
from base.messages import ERROR_CODE, SUCCESS_CODE
|
||||
from base.constants import NUMBER
|
||||
from .utils import upload_image_to_alibaba
|
||||
from notifications.constants import REGISTRATION, TASK_CREATED
|
||||
from notifications.constants import REGISTRATION, TASK_CREATED, LEADERBOARD_RANKING
|
||||
from notifications.utils import send_notification
|
||||
|
||||
""" Define APIs """
|
||||
@ -245,6 +245,7 @@ class TopJuniorListAPIView(viewsets.ModelViewSet):
|
||||
# Update the position field for each JuniorPoints object
|
||||
for index, junior in enumerate(junior_total_points):
|
||||
junior.position = index + 1
|
||||
send_notification.delay(LEADERBOARD_RANKING, None, junior.junior.auth.id, {})
|
||||
junior.save()
|
||||
|
||||
serializer = self.get_serializer(junior_total_points, many=True)
|
||||
@ -309,11 +310,14 @@ class ApproveTaskAPIView(viewsets.ViewSet):
|
||||
"action": str(request.data['action']),
|
||||
"junior": self.request.data['junior_id']},
|
||||
data=request.data)
|
||||
if str(request.data['action']) == str(NUMBER['one']) and serializer.is_valid():
|
||||
unexpected_task_status = [str(NUMBER['five']), str(NUMBER['six'])]
|
||||
if (str(request.data['action']) == str(NUMBER['one']) and serializer.is_valid()
|
||||
and queryset[1] and queryset[1].task_status not in unexpected_task_status):
|
||||
# save serializer
|
||||
serializer.save()
|
||||
return custom_response(SUCCESS_CODE['3025'], response_status=status.HTTP_200_OK)
|
||||
elif str(request.data['action']) == str(NUMBER['two']) and serializer.is_valid():
|
||||
elif (str(request.data['action']) == str(NUMBER['two']) and serializer.is_valid()
|
||||
and queryset[1] and queryset[1].task_status not in unexpected_task_status):
|
||||
# save serializer
|
||||
serializer.save()
|
||||
return custom_response(SUCCESS_CODE['3026'], response_status=status.HTTP_200_OK)
|
||||
|
||||
Reference in New Issue
Block a user