mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-06 01:15:42 +01:00
fix realtime queries for stats
This commit is contained in:
parent
174b9e4376
commit
3205b4f0f4
@ -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…
Reference in New Issue
Block a user