Статистика
This commit is contained in:
1 parent
92b5da82de
commit
949a7295cd
3 files changed
+9
-35
No files matched your search
@@ -7,7 +7,9 @@
|
|||||||
<v-col
|
<v-col
|
||||||
class="ma-3"
|
class="ma-3"
|
||||||
>
|
>
|
||||||
<v-table density="compact" class="mt-3">
|
|
||||||
|
{{visiting}}
|
||||||
|
<!-- <v-table density="compact" class="mt-3">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-left">
|
<th class="text-left">
|
||||||
@@ -28,7 +30,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</v-table>
|
</v-table> -->
|
||||||
|
|
||||||
<!-- <v-table density="compact" class="mt-3">
|
<!-- <v-table density="compact" class="mt-3">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -75,7 +77,7 @@ setup(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// getfromserver(`api/watcher/counter/`, visiting)
|
getfromserver(`api/watcher/counter/`, visiting)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
visiting
|
visiting
|
||||||
|
|||||||
@@ -92,27 +92,7 @@
|
|||||||
</v-slide-group-item>
|
</v-slide-group-item>
|
||||||
</v-slide-group>
|
</v-slide-group>
|
||||||
</v-sheet>
|
</v-sheet>
|
||||||
<!-- <v-btn-toggle
|
|
||||||
v-model="toggle"
|
|
||||||
divided
|
|
||||||
variant="outlined"
|
|
||||||
>
|
|
||||||
|
|
||||||
<v-tooltip
|
|
||||||
v-for="x in favorit"
|
|
||||||
:key="x"
|
|
||||||
:text="x.page"
|
|
||||||
location="top"
|
|
||||||
>
|
|
||||||
<template v-slot:activator="{ props }">
|
|
||||||
<v-btn
|
|
||||||
v-bind="props"
|
|
||||||
:icon="x.ico"
|
|
||||||
:to="x.fullPath"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</v-tooltip>
|
|
||||||
</v-btn-toggle> -->
|
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|||||||
+4
-12
@@ -16,8 +16,8 @@ class Counter(ListAPIView):
|
|||||||
permission_classes = (AllowAny,)
|
permission_classes = (AllowAny,)
|
||||||
serializer_class = CountSerializer
|
serializer_class = CountSerializer
|
||||||
|
|
||||||
# def get(self, request):
|
def get(self, request):
|
||||||
# res = CountVisitor.objects.values('page').annotate(Sum('count'))
|
res = CountVisitor.objects.values('pages__page').filter(visitdate__year='2023', visitdate__month='01', visitdate__day='21').annotate(Sum('count'))
|
||||||
# users = CountVisitor.objects.values('page', 'user__username').annotate(Sum('count'))
|
# users = CountVisitor.objects.values('page', 'user__username').annotate(Sum('count'))
|
||||||
# outuser = DictEmployee.objects.values('login', 'fio')
|
# outuser = DictEmployee.objects.values('login', 'fio')
|
||||||
# pUser = pd.DataFrame.from_records(users)
|
# pUser = pd.DataFrame.from_records(users)
|
||||||
@@ -31,24 +31,18 @@ class Counter(ListAPIView):
|
|||||||
# x['user__username'] = 'Анонимные'
|
# x['user__username'] = 'Анонимные'
|
||||||
|
|
||||||
# return Response({"pages":res, "users": users})
|
# return Response({"pages":res, "users": users})
|
||||||
|
return Response(res)
|
||||||
|
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
|
|
||||||
print('ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
myfullPath = request.data['fullPath']
|
myfullPath = request.data['fullPath']
|
||||||
if "?" in myfullPath:
|
if "?" in myfullPath:
|
||||||
myfullPath= myfullPath.split("?")[0]
|
myfullPath= myfullPath.split("?")[0]
|
||||||
print(request.data['page'], 'request.data[page]-------')
|
|
||||||
page, create = Pages.objects.get_or_create(page=request.data['page'], fullPath=myfullPath, ico=request.data['ico'])
|
page, create = Pages.objects.get_or_create(page=request.data['page'], fullPath=myfullPath, ico=request.data['ico'])
|
||||||
|
|
||||||
if request.data['user__id'] is not None:
|
if request.data['user__id'] is not None:
|
||||||
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),pages=page, visitdate=date.today())
|
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),pages=page, visitdate=date.today())
|
||||||
print('if ----------------------------')
|
|
||||||
else:
|
else:
|
||||||
watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
|
watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
|
||||||
watch.count+=1
|
watch.count+=1
|
||||||
@@ -59,8 +53,6 @@ class Counter(ListAPIView):
|
|||||||
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count()
|
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Response(res)
|
return Response(res)
|
||||||
|
|
||||||
class SelectedLinksAPIView(ListAPIView):
|
class SelectedLinksAPIView(ListAPIView):
|
||||||
|
|||||||
Reference in new issue
Block a user