jira-15 top leadership API

This commit is contained in:
jain
2023-07-09 19:25:59 +05:30
parent 1b60d4344e
commit 3098de36b8
2 changed files with 15 additions and 2 deletions

View File

@ -143,11 +143,18 @@ class SearchTaskListAPIView(viewsets.ModelViewSet):
class TopJuniorListAPIView(viewsets.ModelViewSet):
"""Top juniors list"""
serializer_class = TopJuniorSerializer
permission_classes = [IsAuthenticated]
# permission_classes = [IsAuthenticated]
queryset = JuniorPoints.objects.all()
def get_serializer_context(self):
context = super().get_serializer_context()
context.update({'view': self})
return context
def list(self, request, *args, **kwargs):
"""fetch junior list those complete their task"""
junior_total_points = self.get_queryset().order_by('-total_task_points')
serializer = self.get_serializer(junior_total_points, many=True)
return custom_response(serializer.data, response_status=status.HTTP_200_OK)