mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
fix realtime queries for stats
This commit is contained in:
parent
174b9e4376
commit
3205b4f0f4
2 changed files with 10 additions and 4 deletions
|
|
@ -47,6 +47,9 @@ async function clickhouseQuery(
|
|||
eventType: EVENT_TYPE.pageView,
|
||||
});
|
||||
|
||||
const table = unit === 'minute' ? 'website_event' : 'website_event_stats_hourly';
|
||||
const columnQuery = unit === 'minute' ? 'count(*)' : 'sum(views)';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select
|
||||
|
|
@ -55,8 +58,8 @@ async function clickhouseQuery(
|
|||
from (
|
||||
select
|
||||
${getDateSQL('created_at', unit, timezone)} as t,
|
||||
sum(views) as y
|
||||
from website_event_stats_hourly website_event
|
||||
${columnQuery} as y
|
||||
from ${table} website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ async function clickhouseQuery(
|
|||
eventType: EVENT_TYPE.pageView,
|
||||
});
|
||||
|
||||
const table = unit === 'minute' ? 'website_event' : 'website_event_stats_hourly';
|
||||
const columnQuery = unit === 'minute' ? 'count(distinct session_id)' : 'uniq(session_id)';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select
|
||||
|
|
@ -55,8 +58,8 @@ async function clickhouseQuery(
|
|||
from (
|
||||
select
|
||||
${getDateSQL('created_at', unit, timezone)} as t,
|
||||
uniq(session_id) as y
|
||||
from website_event_stats_hourly website_event
|
||||
${columnQuery} as y
|
||||
from ${table} website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue