Приложение голосование сделано!

This commit is contained in:
Andrei Filippov committed 2024-11-01 11:48:49 +03:00
1 parent e3661db5cb
commit 2108058a6b
5 files changed
+83 -26

No files matched your search

+4 -4
View File
@@ -42,8 +42,8 @@ class SetThanks(APIView):
class GetThanks(APIView):
def get(self, request):
# Группировка кандидатов по имени и подсчет каждого
count_thanks = ThanksVote.objects.values(
'cand_name').annotate(total=Count('id'))
count_thanks = ThanksVote.objects.values('voted_user',
'cand_name').annotate(total=Count('id'))
return Response(count_thanks)
@@ -63,8 +63,8 @@ class SetBest(APIView):
class GetBest(APIView):
def get(self, request):
# Группировка кандидатов по имени и подсчет каждого
count_bests = BestVote.objects.values(
'department_user', 'cand_name').annotate(total=Count('id'))
count_bests = BestVote.objects.values('voted_user',
'department_user', 'cand_name').annotate(total=Count('id'))
return Response(count_bests)