diff --git a/src/back/vote/models.py b/src/back/vote/models.py index 69d7b7fbc..bf65bbafe 100644 --- a/src/back/vote/models.py +++ b/src/back/vote/models.py @@ -11,7 +11,6 @@ class ThanksVote(models.Model): vote_thanks_date = models.DateTimeField(auto_now_add=True) class Meta: - # unique_together = ('cand_name', 'voted_user') verbose_name = "Голосование, хочу сказать спасибо!" verbose_name_plural = "Голосование, хочу сказать спасибо!" @@ -27,7 +26,6 @@ class BestVote(models.Model): vote_best_date = models.DateTimeField(auto_now_add=True) class Meta: - # unique_together = ('cand_name', 'voted_user') verbose_name = "Голосование, мой коллега самый лучший" verbose_name_plural = "Голосование, мой коллега самый лучший" diff --git a/src/back/vote/urls.py b/src/back/vote/urls.py index bae2ed07e..dd966a677 100644 --- a/src/back/vote/urls.py +++ b/src/back/vote/urls.py @@ -10,4 +10,6 @@ urlpatterns = [ path('getthanks/', GetThanks.as_view(), name=''), path('setbest/', SetBest.as_view(), name=''), path('getbest/', GetBest.as_view(), name=''), + path('getnotvotethn/', GetNotVoteThn.as_view()), + path('getnotvotebst/', GetNotVoteBst.as_view()), ] diff --git a/src/back/vote/views.py b/src/back/vote/views.py index 32f27e0ae..d4ede78a6 100644 --- a/src/back/vote/views.py +++ b/src/back/vote/views.py @@ -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) @@ -64,6 +64,22 @@ class SetBest(APIView): class GetBest(APIView): def get(self, request): # Группировка кандидатов по имени и подсчет каждого - count_bests = BestVote.objects.values( - '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) + + +class GetNotVoteThn(APIView): + def get(self, request): + list_thn_users = ThanksVote.objects.values('voted_user') + list_emp = DictEmployee.objects.filter( + deleted=0).exclude(login__in=list_thn_users) + return Response(GetEmpSerializer(list_emp, many=True).data) + + +class GetNotVoteBst(APIView): + def get(self, request): + list_bst_users = BestVote.objects.values('voted_user') + list_emp_bst = DictEmployee.objects.filter( + deleted=0).exclude(login__in=list_bst_users) + return Response(GetEmpSerializer(list_emp_bst, many=True).data) diff --git a/src/front/src/components/vote/VoteAdmin.vue b/src/front/src/components/vote/VoteAdmin.vue index d85e73d94..776f9b693 100644 --- a/src/front/src/components/vote/VoteAdmin.vue +++ b/src/front/src/components/vote/VoteAdmin.vue @@ -10,26 +10,35 @@ Процент проголосовавших - - 88 + + {{ perc_bst }}% + + Лидер номинации + + + + {{ department }} +
+ {{ employee.name }} +
+
+
ФИО не участвовавших в голосовании - - ФИО - - - - Лидер номинации - - - - ФИО - + + + {{ key }} +
+ {{ item_fio.fio }} +
+
+
+ @@ -42,36 +51,142 @@ Процент проголосовавших - - 88 + + + + Лидер номинации + + +
+ {{ leader }} +
+
ФИО не участвовавших в голосовании - - - ФИО - - - - Лидер номинации - - - - ФИО - + + + {{ key }} +
+ {{ item_fio.fio }} +
+
+
\ No newline at end of file diff --git a/src/front/src/components/vote/VoteForm.vue b/src/front/src/components/vote/VoteForm.vue index 01e1aa444..0404482ec 100644 --- a/src/front/src/components/vote/VoteForm.vue +++ b/src/front/src/components/vote/VoteForm.vue @@ -1,8 +1,8 @@