Skip to content

Commit c3d1784

Browse files
committed
Fix getting all sites & pass count of days to tab list header
1 parent 2001a3f commit c3d1784

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/components/TabItemHeader.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="header-block">
33
<div class="time-block">
4-
<p>{{ title }} ({{ countOfSites }} sites)</p>
4+
<p>{{ title }}</p>
55
<p class="time">{{ summaryTimeString }}</p>
66
</div>
77
<div class="sorted-block">
@@ -30,6 +30,7 @@ const props = defineProps<{
3030
summaryTime: number;
3131
countOfSites: number;
3232
firstDay: Date;
33+
countOfActiveDays: number;
3334
}>();
3435
3536
const sortingBySelected = ref<SortingBy>();
@@ -40,7 +41,12 @@ const emit = defineEmits<{
4041
4142
const title = computed(() => {
4243
if (props.listType == TypeOfList.Today) return 'Today';
43-
if (props.listType == TypeOfList.All) return `Aggregate data since ${props.firstDay} `;
44+
if (props.listType == TypeOfList.All) {
45+
let countOfActiveDays = props.countOfActiveDays > 1 ? `(${props.countOfActiveDays} days)` : '';
46+
return `Aggregate data since ${props.firstDay.toLocaleDateString()} ${countOfActiveDays} (${
47+
props.countOfSites
48+
} sites)`;
49+
}
4450
});
4551
4652
onMounted(async () => {

src/components/TabList.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
:summaryTime="summaryTime"
99
:countOfSites="countOfSites"
1010
:firstDay="firstDay"
11+
:countOfActiveDays="countOfActiveDays"
1112
@sortingBy="sorting"
1213
/>
1314

@@ -49,6 +50,8 @@ const timeForChart = ref<number[]>();
4950
const sitesForChart = ref<string[]>();
5051
5152
const summaryTime = ref<number>();
53+
const firstDay = ref<Date>();
54+
const countOfActiveDays = ref<number>();
5255
5356
const countOfSites = computed(() => (tabs.value != undefined ? tabs.value.length : 0));
5457
@@ -57,6 +60,8 @@ async function loadList(sortingBy: SortingBy) {
5760
if (props.type == TypeOfList.Today) tabSummary = await useTodayTabListSummary(sortingBy);
5861
if (props.type == TypeOfList.All) {
5962
tabSummary = await useAllTabListSummary(sortingBy);
63+
firstDay.value = tabSummary.firstDay;
64+
countOfActiveDays.value = tabSummary.activeDaysTotal;
6065
dataForOvarallStats.value = tabSummary;
6166
}
6267

src/compositions/all-tab-list-summary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function useAllTabListSummary(sortingBy: SortingBy): Promise<Overal
1111
let tabs: Tab[] = [];
1212

1313
const summaryTimeListForToday = unSortedTabs.map(function (tab) {
14-
return tab.days.find(day => day.date === todayLocalDate())!.summary;
14+
return tab.days.find(day => day.date === todayLocalDate())?.summary;
1515
});
1616

1717
const todaySummaryTime =

0 commit comments

Comments
 (0)