fixed article reward points notification for 0 points earned

This commit is contained in:
abutalib-kiwi
2023-09-13 14:38:18 +05:30
parent eaf67b682f
commit a653518cfd

View File

@ -712,7 +712,7 @@ class CompleteArticleAPIView(views.APIView):
total_earn_points=Sum('earn_points'))['total_earn_points']
data = {"total_earn_points":total_earn_points}
send_notification.delay(ARTICLE_REWARD_POINTS, None, None,
request.user.id, {'points': total_earn_points})
request.user.id, {'points': total_earn_points if total_earn_points else 0})
return custom_response(SUCCESS_CODE['3042'], data, response_status=status.HTTP_200_OK)
except Exception as e:
return custom_error_response(str(e), response_status=status.HTTP_400_BAD_REQUEST)