Статисткика
This commit is contained in:
1 parent
59544a7b2c
commit
59ec611036
2 files changed
+42
-39
No files matched your search
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
import {splitname} from '@/utils/universal_functions'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -42,12 +43,12 @@ export default {
|
|||||||
}
|
}
|
||||||
acc[item.crit].push(item.rating)
|
acc[item.crit].push(item.rating)
|
||||||
tot.add(item.usercom)
|
tot.add(item.usercom)
|
||||||
|
|
||||||
if (!us[item.author.id]) {
|
if (!us[splitname(item.author)]) {
|
||||||
us[item.author.id] =new Set()
|
us[splitname(item.author)] =new Set()
|
||||||
}
|
}
|
||||||
if (item.comment.length > 0) {
|
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))
|
for (let [key,val] of Object.entries(us))
|
||||||
{
|
{
|
||||||
|
console.log(key, val ,val.size, '2222222222222222');
|
||||||
t += val.size
|
t += val.size
|
||||||
|
|
||||||
if (crit.value.max < val.size) {
|
if (crit.value.max < val.size) {
|
||||||
|
|||||||
@@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
<v-list class="d-flex flex-column align-start text-subtitle-1">
|
<v-list class="d-flex flex-column align-start text-subtitle-1">
|
||||||
<v-list-item>
|
<v-list-item>
|
||||||
Посетителей сегодня: {{ countvis()['now'] }}
|
Посетителей сегодня: {{ countvising['now'] }}
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-item>
|
<v-list-item>
|
||||||
Посетителей на прошлой неделе: {{ countvis()['week'] }}
|
Посетителей на прошлой неделе: {{ countvising['week'] }}
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-item>
|
<v-list-item>
|
||||||
Посетителей с начала года: {{ countvis()['year'] }}
|
Посетителей с начала года: {{ countvising['year'] }}
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card>
|
</v-card>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<v-row>
|
<v-row>
|
||||||
<v-col class="bg-red">
|
<v-col class="bg-red">
|
||||||
<feedmodul :feedback="feedback"/>
|
<feedmodul :feedback="feedback"/>
|
||||||
{{countvising}}
|
{{crit}}
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -109,6 +109,7 @@ setup(){
|
|||||||
const visiting = ref([])
|
const visiting = ref([])
|
||||||
const feedback = ref([])
|
const feedback = ref([])
|
||||||
const countvising = ref({now: 0, week: 0, year: 0})
|
const countvising = ref({now: 0, week: 0, year: 0})
|
||||||
|
const crit = ref([])
|
||||||
|
|
||||||
const arrlines = {}
|
const arrlines = {}
|
||||||
const data = computed({
|
const data = computed({
|
||||||
@@ -204,67 +205,67 @@ setup(){
|
|||||||
//
|
//
|
||||||
pagecounter()
|
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 = () => {
|
const countgrupp = () => {
|
||||||
let us = {}
|
let us = {}
|
||||||
|
let countall = {now: 0, week: 0, year: 0}
|
||||||
const groupedData =
|
const groupedData =
|
||||||
visiting.value.reduce((acc, item) => {
|
visiting.value.reduce((acc, item) => {
|
||||||
console.log(countvising.value, 'countvising.value');
|
console.log(item, '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}
|
||||||
}
|
}
|
||||||
|
|
||||||
acc[item.pages]['year'] += item.count
|
acc[item.pages]['year'] += item.count
|
||||||
|
countall.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
|
||||||
|
countall.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
|
||||||
|
countall.week += item.count
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!us[item.author.id])
|
if (!us[splitname(item.author)])
|
||||||
// {
|
{
|
||||||
// us[item.author.id] = new Set()
|
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
|
return acc
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
|
||||||
console.log(groupedData, '----------------------------');
|
|
||||||
return groupedData
|
return groupedData
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,13 +317,13 @@ setup(){
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
visiting,
|
visiting,
|
||||||
countvis,
|
|
||||||
countgrupp,
|
countgrupp,
|
||||||
activuser,
|
activuser,
|
||||||
data,
|
data,
|
||||||
options,
|
options,
|
||||||
feedback,
|
feedback,
|
||||||
countvising
|
countvising,
|
||||||
|
crit
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user