Merge branch 'Andr' into develop

This commit is contained in:
Nukeap committed 2024-11-02 09:29:15 +03:00
commit 18b41141e8
6 files changed
+221 -41

No files matched your search

-2
View File
@@ -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 = "Голосование, мой коллега самый лучший"
+2
View File
@@ -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()),
]
+20 -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)
@@ -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)