Статистика
This commit is contained in:
1 parent
8f701420a9
commit
59544a7b2c
5 files changed
+29
-9
No files matched your search
@@ -31,7 +31,7 @@ class RatingStatusStatSerializer(serializers.ModelSerializer):
|
|||||||
fields ='__all__'
|
fields ='__all__'
|
||||||
|
|
||||||
def get_user(self, obj):
|
def get_user(self, obj):
|
||||||
print(obj.usercom, 'obj.user')
|
|
||||||
# obj.user
|
# obj.user
|
||||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.usercom)).data
|
return ShortUserSerializer(DictEmployee.objects.get(login=obj.usercom)).data
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
<v-row>
|
<v-row>
|
||||||
<v-col class="bg-red">
|
<v-col class="bg-red">
|
||||||
<feedmodul :feedback="feedback"/>
|
<feedmodul :feedback="feedback"/>
|
||||||
|
{{countvising}}
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(val, key) in countgrupp()" :key = key>
|
<tr v-for="(val, key) in countgrupp()" :key = key>
|
||||||
<td class="text-left">{{key}}</td>
|
<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.week }}</td>
|
||||||
<td class="text-center">{{ val.year }}</td>
|
<td class="text-center">{{ val.year }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
<div v-for="(val, key) in activuser()" :key = key>
|
<div v-for="(val, key) in activuser()" :key = key>
|
||||||
{{key}} : {{ val.count }} {{ val.login }}
|
{{key}} : {{ val.count }} {{ val.login }}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<v-card class="d-flex" title="Самые активные пользователи">
|
<v-card class="d-flex" title="Самые активные пользователи">
|
||||||
|
|
||||||
@@ -106,6 +108,7 @@ export default {
|
|||||||
setup(){
|
setup(){
|
||||||
const visiting = ref([])
|
const visiting = ref([])
|
||||||
const feedback = ref([])
|
const feedback = ref([])
|
||||||
|
const countvising = ref({now: 0, week: 0, year: 0})
|
||||||
|
|
||||||
const arrlines = {}
|
const arrlines = {}
|
||||||
const data = computed({
|
const data = computed({
|
||||||
@@ -213,6 +216,7 @@ setup(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
|
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
|
||||||
|
|
||||||
acc['week'] += item.count
|
acc['week'] += item.count
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,9 +230,11 @@ setup(){
|
|||||||
|
|
||||||
|
|
||||||
const countgrupp = () => {
|
const countgrupp = () => {
|
||||||
|
let us = {}
|
||||||
|
|
||||||
const groupedData =
|
const groupedData =
|
||||||
visiting.value.reduce((acc, item) => {
|
visiting.value.reduce((acc, item) => {
|
||||||
|
console.log(countvising.value, 'countvising.value');
|
||||||
|
|
||||||
if (!acc[item.pages]) {
|
if (!acc[item.pages]) {
|
||||||
acc[item.pages] = {now: 0, week: 0, year: 0}
|
acc[item.pages] = {now: 0, week: 0, year: 0}
|
||||||
@@ -236,23 +242,36 @@ setup(){
|
|||||||
|
|
||||||
acc[item.pages]['year'] += item.count
|
acc[item.pages]['year'] += item.count
|
||||||
|
|
||||||
|
|
||||||
if (item.visitdate == moment(maxDate.value).format('YYYY-MM-DD')) {
|
if (item.visitdate == moment(maxDate.value).format('YYYY-MM-DD')) {
|
||||||
acc[item.pages]['now'] += item.count
|
acc[item.pages]['now'] += item.count
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
|
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
|
||||||
acc[item.pages]['week'] += item.count
|
acc[item.pages]['week'] += item.count
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (!us[item.author.id])
|
||||||
|
// {
|
||||||
|
// us[item.author.id] = new Set()
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return acc
|
return acc
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
|
||||||
|
console.log(groupedData, '----------------------------');
|
||||||
return groupedData
|
return groupedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const countgruppsumm = () => {
|
||||||
|
// countgrupp()
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
const activuser = () => {
|
const activuser = () => {
|
||||||
|
|
||||||
@@ -302,7 +321,8 @@ setup(){
|
|||||||
activuser,
|
activuser,
|
||||||
data,
|
data,
|
||||||
options,
|
options,
|
||||||
feedback
|
feedback,
|
||||||
|
countvising
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class loadExcel():
|
|||||||
df3.loc[(df3['e'] == 'Доп н/д'), 'e'] = 'nd'
|
df3.loc[(df3['e'] == 'Доп н/д'), 'e'] = 'nd'
|
||||||
df3.loc[(df3['e'] == 'Доп в/л'), 'e'] = 'vl'
|
df3.loc[(df3['e'] == 'Доп в/л'), 'e'] = 'vl'
|
||||||
df3['d'] = df3['d'].astype(int)
|
df3['d'] = df3['d'].astype(int)
|
||||||
print(df3)
|
|
||||||
for ind in df3.index:
|
for ind in df3.index:
|
||||||
# print(df3['login'][ind])
|
# print(df3['login'][ind])
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class DailyRoundUpAPIView(APIView):
|
|||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
|
||||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname').order_by('id_dict_department__order_department')
|
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)
|
re = roundExcel(user)
|
||||||
file_path = getattr(re, request.GET.get("excel"))()
|
file_path = getattr(re, request.GET.get("excel"))()
|
||||||
@@ -128,6 +128,6 @@ class DailyloadAPIView(APIView):
|
|||||||
class SearchUserAPIView(APIView):
|
class SearchUserAPIView(APIView):
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
f= DictEmployee.objects.values('familyname').filter(fio__icontains=request.data['searchname'])
|
f= DictEmployee.objects.values('familyname').filter(fio__icontains=request.data['searchname'])
|
||||||
print(f, '-----------------------------')
|
|
||||||
return Response('')
|
return Response('')
|
||||||
|
|
||||||
@@ -20,13 +20,13 @@ class Counter(ListAPIView):
|
|||||||
|
|
||||||
def get(self, request):
|
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
|
result = CountSerializer(res, many=True).data
|
||||||
|
|
||||||
# Обратная связь
|
# Обратная связь
|
||||||
feed = RatingStatus.objects.all()
|
feed = RatingStatus.objects.all()
|
||||||
feedback = RatingStatusStatSerializer(feed, many=True).data
|
feedback = RatingStatusStatSerializer(feed, many=True).data
|
||||||
print(feedback, '++++++++++++++++++++++++++++++++++++++')
|
|
||||||
return Response({'result':result, 'feedback':feedback})
|
return Response({'result':result, 'feedback':feedback})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user