Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fix null and string return types from getWebsiteStats

Francis Caof30724629cb4
diff --git a/src/queries/sql/getWebsiteStats.ts b/src/queries/sql/getWebsiteStats.ts
index 391d22be2..4a4bef78b 100644
--- a/src/queries/sql/getWebsiteStats.ts
+++ b/src/queries/sql/getWebsiteStats.ts
@@ -36,11 +36,11 @@ async function relationalQuery(
return rawQuery(
`
select
- sum(t.c) as "pageviews",
+ cast(coalesce(sum(t.c), 0) as bigint) as "pageviews",
count(distinct t.session_id) as "visitors",
count(distinct t.visit_id) as "visits",
- sum(case when t.c = 1 then 1 else 0 end) as "bounces",
- sum(${getTimestampDiffSQL('t.min_time', 't.max_time')}) as "totaltime"
+ coalesce(sum(case when t.c = 1 then 1 else 0 end), 0) as "bounces",
+ cast(coalesce(sum(${getTimestampDiffSQL('t.min_time', 't.max_time')}), 0) as bigint) as "totaltime"
from (
select
website_event.session_id,