From 6bdceabc653818cf065269699ef0164f9c8a98a8 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Tue, 17 Oct 2023 11:45:24 -0700 Subject: [PATCH] Return array of records --- src/queries/analytics/getActiveVisitors.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/queries/analytics/getActiveVisitors.ts b/src/queries/analytics/getActiveVisitors.ts index 962bea35..398cc9c8 100644 --- a/src/queries/analytics/getActiveVisitors.ts +++ b/src/queries/analytics/getActiveVisitors.ts @@ -24,10 +24,10 @@ async function relationalQuery(websiteId: string) { ); } -async function clickhouseQuery(websiteId: string): Promise<{ x: number }> { +async function clickhouseQuery(websiteId: string): Promise<{ x: number }[]> { const { rawQuery } = clickhouse; - const result = rawQuery( + return rawQuery( ` select count(distinct session_id) x @@ -41,6 +41,4 @@ async function clickhouseQuery(websiteId: string): Promise<{ x: number }> { return { x: Number(a.x) }; }); }); - - return result[0] ?? null; }