From 3cfd26ea2035af134a4d75efe83ea15694027f6c Mon Sep 17 00:00:00 2001 From: Josh Hill Date: Wed, 4 Sep 2024 22:07:23 -0400 Subject: [PATCH 1/2] fix problem --- src/queries/analytics/sessions/getWebsiteSession.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/queries/analytics/sessions/getWebsiteSession.ts b/src/queries/analytics/sessions/getWebsiteSession.ts index f9b9f39a08..c563200aa2 100644 --- a/src/queries/analytics/sessions/getWebsiteSession.ts +++ b/src/queries/analytics/sessions/getWebsiteSession.ts @@ -49,7 +49,7 @@ async function relationalQuery(websiteId: string, sessionId: string) { sum(case when website_event.event_type = 1 then 1 else 0 end) as views, sum(case when website_event.event_type = 1 then 1 else 0 end) as events from session - join website_event on website_event.session_id = session.session_id + left outer join website_event on website_event.session_id = session.session_id where session.website_id = {{websiteId::uuid}} and session.session_id = {{sessionId::uuid}} group by session.session_id, visit_id, session.website_id, session.hostname, session.browser, session.os, session.device, session.screen, session.language, session.country, session.subdivision1, session.city) t From cb79e9cedaacb83b238de92bf66c1b68b788df7e Mon Sep 17 00:00:00 2001 From: Josh Hill Date: Thu, 5 Sep 2024 10:05:21 -0400 Subject: [PATCH 2/2] Update src/queries/analytics/sessions/getWebsiteSession.ts left inner join seems more appropriate --- src/queries/analytics/sessions/getWebsiteSession.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/queries/analytics/sessions/getWebsiteSession.ts b/src/queries/analytics/sessions/getWebsiteSession.ts index c563200aa2..d8df580300 100644 --- a/src/queries/analytics/sessions/getWebsiteSession.ts +++ b/src/queries/analytics/sessions/getWebsiteSession.ts @@ -49,7 +49,7 @@ async function relationalQuery(websiteId: string, sessionId: string) { sum(case when website_event.event_type = 1 then 1 else 0 end) as views, sum(case when website_event.event_type = 1 then 1 else 0 end) as events from session - left outer join website_event on website_event.session_id = session.session_id + left inner join website_event on website_event.session_id = session.session_id where session.website_id = {{websiteId::uuid}} and session.session_id = {{sessionId::uuid}} group by session.session_id, visit_id, session.website_id, session.hostname, session.browser, session.os, session.device, session.screen, session.language, session.country, session.subdivision1, session.city) t