fix: bug fix

pull/2040/head
minkik 2023-05-18 14:29:54 +09:00 committed by Joseph Lee
parent 555e5afd15
commit c5d3369c8c
1 changed files with 11 additions and 2 deletions

View File

@ -75,7 +75,7 @@ export default async (
city, city,
}, },
}); });
const prevPeriod = await getWebsiteStats(websiteId, { let prevPeriod = await getWebsiteStats(websiteId, {
startDate: prevStartDate, startDate: prevStartDate,
endDate: prevEndDate, endDate: prevEndDate,
filters: { filters: {
@ -92,8 +92,17 @@ export default async (
city, city,
}, },
}); });
if (prevPeriod.length === 0) {
prevPeriod = [
{
pageviews: 0,
uniques: 0,
bounces: 0,
totaltime: 0,
},
];
}
let stats: object = { let stats: object = {
_id: '',
pageviews: 0, pageviews: 0,
uniques: 0, uniques: 0,
bounces: 0, bounces: 0,