mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
implement filtering and cohorts to all relevant queries
This commit is contained in:
parent
789b8b36d8
commit
2f1f704728
34 changed files with 311 additions and 167 deletions
|
|
@ -14,9 +14,12 @@ export async function getWebsiteSessionsWeekly(
|
|||
}
|
||||
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { timezone = 'utc' } = filters;
|
||||
const timezone = 'utc';
|
||||
const { rawQuery, getDateWeeklySQL, parseFilters } = prisma;
|
||||
const { queryParams } = parseFilters(filters);
|
||||
const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters({
|
||||
...filters,
|
||||
websiteId,
|
||||
});
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
|
|
@ -24,8 +27,11 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
|||
${getDateWeeklySQL('created_at', timezone)} as time,
|
||||
count(distinct session_id) as value
|
||||
from website_event
|
||||
${cohortQuery}
|
||||
${joinSessionQuery}
|
||||
where website_id = {{websiteId::uuid}}
|
||||
and created_at between {{startDate}} and {{endDate}}
|
||||
${filterQuery}
|
||||
group by time
|
||||
order by 2
|
||||
`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue