Статисткика

This commit is contained in:
iriska-gri committed 2024-01-12 13:42:57 +03:00
1 parent 59544a7b2c
commit 59ec611036
2 files changed
+42 -39

No files matched your search

@@ -15,6 +15,7 @@
<script>
import { ref } from 'vue'
import {splitname} from '@/utils/universal_functions'
export default {
props: {
@@ -42,12 +43,12 @@ export default {
}
acc[item.crit].push(item.rating)
tot.add(item.usercom)
if (!us[item.author.id]) {
us[item.author.id] =new Set()
if (!us[splitname(item.author)]) {
us[splitname(item.author)] =new Set()
}
if (item.comment.length > 0) {
us[item.author.id].add(item.usercom)
us[splitname(item.author)].add(item.usercom)
}
@@ -67,6 +68,7 @@ export default {
for (let [key,val] of Object.entries(us))
{
console.log(key, val ,val.size, '2222222222222222');
t += val.size
if (crit.value.max < val.size) {
+36 -35
View File
@@ -18,13 +18,13 @@
<v-list class="d-flex flex-column align-start text-subtitle-1">
<v-list-item>
Посетителей сегодня: {{ countvis()['now'] }}
Посетителей сегодня: {{ countvising['now'] }}
</v-list-item>
<v-list-item>
Посетителей на прошлой неделе: {{ countvis()['week'] }}
Посетителей на прошлой неделе: {{ countvising['week'] }}
</v-list-item>
<v-list-item>
Посетителей с начала года: {{ countvis()['year'] }}
Посетителей с начала года: {{ countvising['year'] }}
</v-list-item>
</v-list>
</v-card>
@@ -33,7 +33,7 @@
<v-row>
<v-col class="bg-red">
<feedmodul :feedback="feedback"/>
{{countvising}}
{{crit}}
</v-col>
</v-row>
</v-col>
@@ -109,6 +109,7 @@ setup(){
const visiting = ref([])
const feedback = ref([])
const countvising = ref({now: 0, week: 0, year: 0})
const crit = ref([])
const arrlines = {}
const data = computed({
@@ -204,67 +205,67 @@ setup(){
//
pagecounter()
const countvis = () => {
let filteres = visiting.value.reduce((acc, item) => {
acc['year'] += item.count
if (item.visitdate == moment(maxDate.value).format('YYYY-MM-DD')) {
acc['now'] += item.count
}
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
acc['week'] += item.count
}
return acc
}, {now: 0, week: 0, year: 0})
return filteres
}
const countgrupp = () => {
let us = {}
let countall = {now: 0, week: 0, year: 0}
const groupedData =
visiting.value.reduce((acc, item) => {
console.log(countvising.value, 'countvising.value');
console.log(item, 'countvising.value');
if (!acc[item.pages]) {
acc[item.pages] = {now: 0, week: 0, year: 0}
}
acc[item.pages]['year'] += item.count
countall.year += item.count
if (item.visitdate == moment(maxDate.value).format('YYYY-MM-DD')) {
acc[item.pages]['now'] += item.count
countall.now += item.count
}
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
acc[item.pages]['week'] += item.count
countall.week += item.count
}
// if (!us[item.author.id])
// {
// us[item.author.id] = new Set()
// }
if (!us[splitname(item.author)])
{
us[splitname(item.author)] = {page: new Set(), login: 0}
}
us[splitname(item.author)]['page'].add(item.pages)
us[splitname(item.author)]['login'] = item.author.login
let arrcount = []
for (let [key,val] of Object.entries(us)) {
arrcount.push({id:key,max:val.page.size, login: val.login})
}
arrcount.sort((a, b) => {
return b['max']- a['max']
})
crit.value = arrcount.slice(0, 3)
countvising.value=countall
return acc
}, {});
console.log(groupedData, '----------------------------');
return groupedData
}
@@ -316,13 +317,13 @@ setup(){
return {
visiting,
countvis,
countgrupp,
activuser,
data,
options,
feedback,
countvising
countvising,
crit
}
}