From 59544a7b2c0620f301e09f3e005a1d2d5ddfebfc Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:15:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D1=82=D0=B0=D1=82=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/feedback/serializers.py | 2 +- src/front/src/views/AboutPortalPage.vue | 32 ++++++++++++++++++++----- src/general_vacation/excel.py | 2 +- src/general_vacation/views.py | 4 ++-- src/watcher/views.py | 4 ++-- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/feedback/serializers.py b/src/feedback/serializers.py index 6cae6c514..21ee1aca6 100644 --- a/src/feedback/serializers.py +++ b/src/feedback/serializers.py @@ -31,7 +31,7 @@ class RatingStatusStatSerializer(serializers.ModelSerializer): fields ='__all__' def get_user(self, obj): - print(obj.usercom, 'obj.user') + # obj.user return ShortUserSerializer(DictEmployee.objects.get(login=obj.usercom)).data diff --git a/src/front/src/views/AboutPortalPage.vue b/src/front/src/views/AboutPortalPage.vue index 705bb8099..53374079d 100644 --- a/src/front/src/views/AboutPortalPage.vue +++ b/src/front/src/views/AboutPortalPage.vue @@ -33,6 +33,7 @@ + {{countvising}} @@ -63,7 +64,7 @@ {{key}} - {{ val.now }} + {{ val.now }} {{ val.week }} {{ val.year }} @@ -76,6 +77,7 @@
{{key}} : {{ val.count }} {{ val.login }} +
@@ -106,6 +108,7 @@ export default { setup(){ const visiting = ref([]) const feedback = ref([]) + const countvising = ref({now: 0, week: 0, year: 0}) const arrlines = {} const data = computed({ @@ -202,7 +205,7 @@ setup(){ pagecounter() const countvis = () => { - + let filteres = visiting.value.reduce((acc, item) => { acc['year'] += item.count @@ -213,6 +216,7 @@ setup(){ } if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) { + acc['week'] += item.count } @@ -226,34 +230,49 @@ setup(){ const countgrupp = () => { - + let us = {} + const groupedData = visiting.value.reduce((acc, item) => { + console.log(countvising.value, 'countvising.value'); if (!acc[item.pages]) { acc[item.pages] = {now: 0, week: 0, year: 0} } acc[item.pages]['year'] += item.count + if (item.visitdate == moment(maxDate.value).format('YYYY-MM-DD')) { acc[item.pages]['now'] += item.count + } if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) { acc[item.pages]['week'] += item.count + } + // if (!us[item.author.id]) + // { + // us[item.author.id] = new Set() + // } + + return acc }, {}); - + console.log(groupedData, '----------------------------'); return groupedData } - + // const countgruppsumm = () => { + // countgrupp() + // } + + const activuser = () => { const groupedData = @@ -302,7 +321,8 @@ setup(){ activuser, data, options, - feedback + feedback, + countvising } } diff --git a/src/general_vacation/excel.py b/src/general_vacation/excel.py index fcfbc93e6..94159a532 100644 --- a/src/general_vacation/excel.py +++ b/src/general_vacation/excel.py @@ -230,7 +230,7 @@ class loadExcel(): df3.loc[(df3['e'] == 'Доп н/д'), 'e'] = 'nd' df3.loc[(df3['e'] == 'Доп в/л'), 'e'] = 'vl' df3['d'] = df3['d'].astype(int) - print(df3) + for ind in df3.index: # print(df3['login'][ind]) # diff --git a/src/general_vacation/views.py b/src/general_vacation/views.py index 88ae1ac5d..092c1ffd2 100644 --- a/src/general_vacation/views.py +++ b/src/general_vacation/views.py @@ -43,7 +43,7 @@ class DailyRoundUpAPIView(APIView): def get(self, request): user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname').order_by('id_dict_department__order_department') - print(user,' helloooooooooooo') + re = roundExcel(user) file_path = getattr(re, request.GET.get("excel"))() @@ -128,6 +128,6 @@ class DailyloadAPIView(APIView): class SearchUserAPIView(APIView): def post(self, request): f= DictEmployee.objects.values('familyname').filter(fio__icontains=request.data['searchname']) - print(f, '-----------------------------') + return Response('') diff --git a/src/watcher/views.py b/src/watcher/views.py index 126e10bdd..323245a80 100644 --- a/src/watcher/views.py +++ b/src/watcher/views.py @@ -20,13 +20,13 @@ class Counter(ListAPIView): def get(self, request): - res = CountVisitor.objects.filter(visitdate__range=['2023-01-01', '2023-12-31']).annotate(Sum('count')) + res = CountVisitor.objects.filter(visitdate__range=['2024-01-01', '2024-12-31']).annotate(Sum('count')) result = CountSerializer(res, many=True).data # Обратная связь feed = RatingStatus.objects.all() feedback = RatingStatusStatSerializer(feed, many=True).data - print(feedback, '++++++++++++++++++++++++++++++++++++++') + return Response({'result':result, 'feedback':feedback})