diff --git a/src/front/src/components/dialog-search.vue b/src/front/src/components/dialog-search.vue index 921437b79..9ce132b77 100644 --- a/src/front/src/components/dialog-search.vue +++ b/src/front/src/components/dialog-search.vue @@ -32,6 +32,7 @@ rows="1" no-resize /> + @@ -152,7 +153,7 @@ export default { get() { let ob={} Object.keys(t_dailyRound.value).map(el1 => { - let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(searchname.value)) + let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(searchname.value.toLowerCase())) if(myarr.length>0) { diff --git a/src/front/src/views/AboutPortalPage.vue b/src/front/src/views/AboutPortalPage.vue index fbfd3871e..5c3be237e 100644 --- a/src/front/src/views/AboutPortalPage.vue +++ b/src/front/src/views/AboutPortalPage.vue @@ -52,53 +52,61 @@ export default { setup(){ const visiting = ref([]) - - getfromserver(`api/watcher/counter/`, visiting) - pagecounter() + const previousWeekStart = moment().subtract(1, 'weeks').startOf('week'); // начало предыдущей недели + const previousWeekEnd = moment().subtract(1, 'weeks').endOf('week'); // конец предыдущей недели - const countvis = () => { - let start = '2023-01-21' - let end = '2023-12-31' - let filteres = visiting.value.filter(e => e.visitdate >= start && e.visitdate <= end) - - - // let countAll = visiting.value.reduce((total, current)=> total +current.value, 0) - console.log(filteres, '----dsds-----'); - - return filteres.reduce((total, current) => total + current.count, 0) - } - - const countgrupp = () => { - - - const previousWeekStart = moment().subtract(1, 'weeks').startOf('week'); - const previousWeekEnd = moment().subtract(1, 'weeks').endOf('week'); - - console.log(previousWeekStart.format('YYYY-MM-DD')); // начало предыдущей недели - console.log(previousWeekEnd.format('YYYY-MM-DD')); // конец предыдущей недели - - const maxDate = new Date( + const maxDate = new Date( Math.max( - ...visiting.value.map(element => { - return new Date(element.visitdate); + ...visiting.value.map(e => { + return new Date(e.visitdate); }), ), ); - + getfromserver(`api/watcher/counter/`, visiting) + 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}) + + + // let countAll = visiting.value.reduce((total, current)=> total +current.value, 0) + + + return filteres + } + + + + const countgrupp = () => { + const groupedData = visiting.value.reduce((acc, item) => { + // console.log(acc, item, 'acc, itemacc, item'); - if (!acc[item.pages]) { acc[item.pages] = {now: 0, week: 0, year: 0} } acc[item.pages]['year'] += item.count - if (item.visitdate == moment(maxDate).format('YYYY-MM-DD')) { + if (item.visitdate == moment(maxDate.value).format('YYYY-MM-DD')) { acc[item.pages]['now'] += item.count } @@ -107,8 +115,6 @@ setup(){ } - - return acc }, {}); // filteres.reduce((acc, item) => { diff --git a/src/media/DailyRoundUp.xlsx b/src/media/DailyRoundUp.xlsx index ac0ff6866..8e8c81aab 100644 Binary files a/src/media/DailyRoundUp.xlsx and b/src/media/DailyRoundUp.xlsx differ