mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 12:05:41 +01:00
Merge branch 'umami-software:master' into master
This commit is contained in:
commit
712d3026de
21 changed files with 308 additions and 324 deletions
|
|
@ -41,8 +41,8 @@ async function clickhouseQuery(
|
|||
websiteId: string,
|
||||
filters: QueryFilters,
|
||||
): Promise<{ x: string; y: number }[]> {
|
||||
const { unit = 'day' } = filters;
|
||||
const { parseFilters, rawQuery } = clickhouse;
|
||||
const { timezone = 'utc', unit = 'day' } = filters;
|
||||
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) 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) 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}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ async function clickhouseQuery(
|
|||
}[]
|
||||
> {
|
||||
const { startDate, endDate, timezone = 'UTC' } = filters;
|
||||
const { getDateSQL, getDateStringSQL, rawQuery } = clickhouse;
|
||||
const { getDateSQL, rawQuery } = clickhouse;
|
||||
const unit = 'day';
|
||||
|
||||
return rawQuery(
|
||||
|
|
@ -152,7 +152,7 @@ async function clickhouseQuery(
|
|||
group by 1, 2
|
||||
)
|
||||
select
|
||||
${getDateStringSQL('c.cohort_date', unit)} as date,
|
||||
c.cohort_date as date,
|
||||
c.day_number as day,
|
||||
s.visitors as visitors,
|
||||
c.visitors returnVisitors,
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ async function clickhouseQuery(
|
|||
websiteId: string,
|
||||
filters: QueryFilters,
|
||||
): Promise<{ x: string; y: number }[]> {
|
||||
const { unit = 'day' } = filters;
|
||||
const { parseFilters, rawQuery } = clickhouse;
|
||||
const { timezone = 'utc', unit = 'day' } = filters;
|
||||
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) 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) 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