refactor views and queries for dashboard

This commit is contained in:
Francis Cao 2024-07-10 00:54:46 -07:00
parent bfd5c5f150
commit f518066d93
7 changed files with 34 additions and 43 deletions

View file

@ -46,7 +46,7 @@ async function clickhouseQuery(
...filters,
eventType: EVENT_TYPE.pageView,
});
const table = unit === 'hour' ? 'website_event_metric_hourly' : 'website_event_metric_daily';
const table = unit === 'hour' ? 'website_event_stats_hourly' : 'website_event_stats_daily';
return rawQuery(
`
@ -56,7 +56,7 @@ async function clickhouseQuery(
from (
select
${getDateQuery('created_at', unit, timezone)} as t,
countMerge(views) as y
sum(views) as y
from ${table} website_event
where website_id = {websiteId:UUID}
and created_at between {startDate:DateTime64} and {endDate:DateTime64}