Updated Clickhouse number handling. Removed number formatting.

This commit is contained in:
Mike Cao 2024-08-20 14:53:53 -07:00
parent caa9da9166
commit 04e0b33622
15 changed files with 23 additions and 145 deletions

View file

@ -18,9 +18,9 @@ async function relationalQuery(websiteId: string) {
select count(distinct session_id) x
from website_event
where website_id = {{websiteId::uuid}}
and created_at >= {{startAt}}
and created_at >= {{startDate}}
`,
{ websiteId, startAt: subMinutes(new Date(), 5) },
{ websiteId, startDate: subMinutes(new Date(), 5) },
);
return result[0] ?? null;
@ -35,14 +35,10 @@ async function clickhouseQuery(websiteId: string): Promise<{ x: number }> {
count(distinct session_id) x
from website_event
where website_id = {websiteId:UUID}
and created_at >= {startAt:DateTime64}
and created_at >= {startDate:DateTime64}
`,
{ websiteId, startAt: subMinutes(new Date(), 5) },
).then(a => {
return Object.values(a).map(a => {
return { x: Number(a.x) };
});
});
{ websiteId, startDate: subMinutes(new Date(), 5) },
);
return result[0] ?? null;
}