Browse Source

Fix ProgressAPI to return response

pull/1679/head
Hironsan 2 years ago
parent
commit
387e02931e
1 changed files with 3 additions and 2 deletions
  1. 5
      backend/metrics/views.py

5
backend/metrics/views.py

@ -18,8 +18,9 @@ class ProgressAPI(APIView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
examples = Example.objects.filter(project=self.kwargs["project_id"]).values("id") examples = Example.objects.filter(project=self.kwargs["project_id"]).values("id")
total = examples.count() total = examples.count()
done = ExampleState.objects.count_done(examples, user=self.request.user)
return {"total": total, "remaining": total - done}
complete = ExampleState.objects.count_done(examples, user=self.request.user)
data = {"total": total, "remaining": total - complete, "complete": complete}
return Response(data=data, status=status.HTTP_200_OK)
class MemberProgressAPI(APIView): class MemberProgressAPI(APIView):

Loading…
Cancel
Save