mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
fix monthly and all time charts
This commit is contained in:
parent
a219f5dbe3
commit
b1caf6edb7
4 changed files with 11 additions and 11 deletions
|
|
@ -42,7 +42,7 @@ async function clickhouseQuery(
|
|||
filters: QueryFilters,
|
||||
): Promise<{ x: string; y: number }[]> {
|
||||
const { timezone = 'utc', unit = 'day' } = filters;
|
||||
const { parseFilters, rawQuery } = clickhouse;
|
||||
const { parseFilters, rawQuery, getDateSQL } = clickhouse;
|
||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
|
|
@ -57,7 +57,7 @@ async function clickhouseQuery(
|
|||
g.y as y
|
||||
from (
|
||||
select
|
||||
date_trunc('${unit}', created_at, '${timezone}') as t,
|
||||
${getDateSQL('website_event.created_at', unit, timezone)} as t,
|
||||
count(*) as y
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
@ -75,7 +75,7 @@ async function clickhouseQuery(
|
|||
g.y as y
|
||||
from (
|
||||
select
|
||||
date_trunc('${unit}', created_at, '${timezone}') as t,
|
||||
${getDateSQL('website_event.created_at', unit, timezone)} as t,
|
||||
sum(views)as y
|
||||
from website_event_stats_hourly website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ async function clickhouseQuery(
|
|||
filters: QueryFilters,
|
||||
): Promise<{ x: string; y: number }[]> {
|
||||
const { timezone = 'utc', unit = 'day' } = filters;
|
||||
const { parseFilters, rawQuery } = clickhouse;
|
||||
const { parseFilters, rawQuery, getDateSQL } = clickhouse;
|
||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
|
|
@ -53,11 +53,11 @@ async function clickhouseQuery(
|
|||
if (EVENT_COLUMNS.some(item => Object.keys(filters).includes(item)) || unit === 'minute') {
|
||||
sql = `
|
||||
select
|
||||
g.t as x,
|
||||
g.t as x,
|
||||
g.y as y
|
||||
from (
|
||||
select
|
||||
date_trunc('${unit}', created_at, '${timezone}') as t,
|
||||
${getDateSQL('website_event.created_at', unit, timezone)} as t,
|
||||
count(distinct session_id) as y
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
@ -71,11 +71,11 @@ async function clickhouseQuery(
|
|||
} else {
|
||||
sql = `
|
||||
select
|
||||
g.t as x,
|
||||
g.t as x,
|
||||
g.y as y
|
||||
from (
|
||||
select
|
||||
date_trunc('${unit}', created_at, '${timezone}') as t,
|
||||
${getDateSQL('website_event.created_at', unit, timezone)} as t,
|
||||
uniq(session_id) as y
|
||||
from website_event_stats_hourly website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue