mirror of
https://github.com/umami-software/umami.git
synced 2026-02-17 02:55:38 +01:00
Made filters work for all reports.
This commit is contained in:
parent
ea83afbc13
commit
8b64029409
46 changed files with 328 additions and 275 deletions
|
|
@ -28,9 +28,11 @@ async function relationalQuery(
|
|||
criteria: RetentionCriteria,
|
||||
): Promise<RetentionResult[]> {
|
||||
const { startDate, endDate, timezone } = criteria;
|
||||
const { getDateSQL, getDayDiffQuery, getCastColumnQuery, rawQuery } = prisma;
|
||||
const { getDateSQL, getDayDiffQuery, getCastColumnQuery, rawQuery, parseFilters } = prisma;
|
||||
const unit = 'day';
|
||||
|
||||
const { filterQuery, filterParams } = await parseFilters(websiteId, criteria);
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
WITH cohort_items AS (
|
||||
|
|
@ -49,6 +51,7 @@ async function relationalQuery(
|
|||
on w.session_id = c.session_id
|
||||
where website_id = {{websiteId::uuid}}
|
||||
and created_at between {{startDate}} and {{endDate}}
|
||||
${filterQuery}
|
||||
),
|
||||
cohort_size as (
|
||||
select cohort_date,
|
||||
|
|
@ -82,6 +85,7 @@ async function relationalQuery(
|
|||
websiteId,
|
||||
startDate,
|
||||
endDate,
|
||||
...filterParams,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -91,9 +95,11 @@ async function clickhouseQuery(
|
|||
criteria: RetentionCriteria,
|
||||
): Promise<RetentionResult[]> {
|
||||
const { startDate, endDate, timezone } = criteria;
|
||||
const { getDateSQL, rawQuery } = clickhouse;
|
||||
const { getDateSQL, rawQuery, parseFilters } = clickhouse;
|
||||
const unit = 'day';
|
||||
|
||||
const { filterQuery, filterParams } = await parseFilters(websiteId, criteria);
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
WITH cohort_items AS (
|
||||
|
|
@ -114,6 +120,7 @@ async function clickhouseQuery(
|
|||
on w.session_id = c.session_id
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
${filterQuery}
|
||||
),
|
||||
cohort_size as (
|
||||
select cohort_date,
|
||||
|
|
@ -147,6 +154,7 @@ async function clickhouseQuery(
|
|||
websiteId,
|
||||
startDate,
|
||||
endDate,
|
||||
...filterParams,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue