From 60f1b7b7558a30b54e7bcdec1f0d9ced3f55d919 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 22 Aug 2024 13:42:22 -0700 Subject: [PATCH] Revert session stats change. --- .../analytics/sessions/getSessionStats.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/queries/analytics/sessions/getSessionStats.ts b/src/queries/analytics/sessions/getSessionStats.ts index cd04976155..ee16e42560 100644 --- a/src/queries/analytics/sessions/getSessionStats.ts +++ b/src/queries/analytics/sessions/getSessionStats.ts @@ -22,21 +22,14 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) { return rawQuery( ` select - ${getDateSQL('g.created_at', unit, timezone)} as x, - count(distinct g.session_id) as y - from ( - select - website_event.session_id, - min(website_event.created_at) as created_at, - count(*) y - from website_event + ${getDateSQL('website_event.created_at', unit, timezone)} x, + count(distinct website_event.session_id) y + from website_event ${joinSession} - where website_event.website_id = {{websiteId::uuid}} + where website_event.website_id = {{websiteId::uuid}} and website_event.created_at between {{startDate}} and {{endDate}} - and event_type = {{eventType}} + and event_type = {{eventType}} ${filterQuery} - group by website_event.session_id, website_event.created_at - ) as g group by 1 `, params,