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

This commit is contained in:
Andrei Filippov committed 2024-11-01 11:48:49 +03:00
1 parent 0038d8c814
commit 3e872f4ae3
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)