mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-16 02:16:16 +00:00
current page update in article api
This commit is contained in:
@ -270,14 +270,12 @@ class TopJuniorListAPIView(viewsets.ModelViewSet):
|
||||
"""Fetch junior list of those who complete their tasks"""
|
||||
try:
|
||||
junior_total_points = self.get_queryset().order_by('-total_points')
|
||||
|
||||
# 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)
|
||||
serializer = self.get_serializer(junior_total_points[:15], many=True)
|
||||
return custom_response(None, serializer.data, response_status=status.HTTP_200_OK)
|
||||
except Exception as e:
|
||||
return custom_error_response(str(e), response_status=status.HTTP_400_BAD_REQUEST)
|
||||
|
Reference in New Issue
Block a user