Добавлены компоненты подсчета процентов в главном окне и кона подтверждения выбора
This commit is contained in:
1 parent
928a014ce4
commit
4168c7b100
7 files changed
+155
-20
No files matched your search
@@ -29,9 +29,11 @@ class GetForBst(APIView):
|
||||
class SetThanks(APIView):
|
||||
def post(self, request):
|
||||
voted_user = request.data['voted_user']
|
||||
department_user = request.data['department_user']
|
||||
cand_name = request.data['cand_name_id']
|
||||
ThanksVote.objects.create(
|
||||
voted_user=voted_user,
|
||||
department_user=department_user,
|
||||
cand_name=cand_name
|
||||
)
|
||||
return Response("Ваш голос добавлен!")
|
||||
@@ -39,7 +41,7 @@ class SetThanks(APIView):
|
||||
|
||||
class GetThanks(APIView):
|
||||
def get(self, request):
|
||||
# Группировка товаров по имени и подсчет каждого
|
||||
# Группировка кандидатов по имени и подсчет каждого
|
||||
count_thanks = ThanksVote.objects.values(
|
||||
'cand_name').annotate(total=Count('id'))
|
||||
return Response(count_thanks)
|
||||
@@ -48,9 +50,11 @@ class GetThanks(APIView):
|
||||
class SetBest(APIView):
|
||||
def post(self, request):
|
||||
voted_user = request.data['voted_user']
|
||||
department_user = request.data['department_user']
|
||||
cand_name = request.data['cand_name_id']
|
||||
BestVote.objects.create(
|
||||
voted_user=voted_user,
|
||||
department_user=department_user,
|
||||
cand_name=cand_name
|
||||
)
|
||||
return Response("Ваш голос добавлен!")
|
||||
@@ -58,6 +62,7 @@ class SetBest(APIView):
|
||||
|
||||
class GetBest(APIView):
|
||||
def get(self, request):
|
||||
count_bests = ThanksVote.objects.values(
|
||||
# Группировка кандидатов по имени и подсчет каждого
|
||||
count_bests = BestVote.objects.values(
|
||||
'cand_name').annotate(total=Count('id'))
|
||||
return Response(count_bests)
|
||||
Reference in new issue
Block a user