Статистика

This commit is contained in:
iriska-gri committed 2024-01-12 10:15:14 +03:00
1 parent 8f701420a9
commit 59544a7b2c
5 files changed
+32 -12

No files matched your search

+1 -1
View File
@@ -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
+26 -6
View File
@@ -33,6 +33,7 @@
<v-row>
<v-col class="bg-red">
<feedmodul :feedback="feedback"/>
{{countvising}}
</v-col>
</v-row>
</v-col>
@@ -63,7 +64,7 @@
<tbody>
<tr v-for="(val, key) in countgrupp()" :key = key>
<td class="text-left">{{key}}</td>
<td class="text-center">{{ val.now }}</td>
<td class="text-center">{{ val.now }} </td>
<td class="text-center">{{ val.week }}</td>
<td class="text-center">{{ val.year }}</td>
</tr>
@@ -76,6 +77,7 @@
<v-col class="bg-black">
<div v-for="(val, key) in activuser()" :key = key>
{{key}} : {{ val.count }} {{ val.login }}
</div>
<v-card class="d-flex" title="Самые активные пользователи">
@@ -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
}
}
+1 -1
View File
@@ -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])
#
+2 -2
View File
@@ -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('')
+2 -2
View File
@@ -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})