mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
6bd9916310
161 changed files with 4117 additions and 1753 deletions
|
|
@ -142,6 +142,7 @@ export async function getReports(
|
|||
...pageFilters,
|
||||
...(options?.include && { include: options.include }),
|
||||
});
|
||||
|
||||
const count = await prisma.client.report.count({
|
||||
where,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ export async function getTeams(
|
|||
...pageFilters,
|
||||
...(options?.include && { include: options?.include }),
|
||||
});
|
||||
|
||||
const count = await prisma.client.team.count({ where });
|
||||
|
||||
return { data: teams, count, ...getParameters };
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@ export async function getWebsites(
|
|||
...pageFilters,
|
||||
...(options?.include && { include: options.include }),
|
||||
});
|
||||
const count = await prisma.client.website.count({ where });
|
||||
|
||||
const count = await prisma.client.website.count({ where: { ...where, deletedAt: null } });
|
||||
|
||||
return { data: websites, count, ...getParameters };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,10 +137,15 @@ async function clickhouseQuery(data: {
|
|||
website_id: websiteId,
|
||||
session_id: sessionId,
|
||||
event_id: uuid(),
|
||||
country: country ? country : null,
|
||||
subdivision1: subdivision1 ?? null,
|
||||
subdivision2: subdivision2 ?? null,
|
||||
city: city ? city : null,
|
||||
country: country,
|
||||
subdivision1:
|
||||
country && subdivision1
|
||||
? subdivision1.includes('-')
|
||||
? subdivision1
|
||||
: `${country}-${subdivision1}`
|
||||
: null,
|
||||
subdivision2: subdivision2,
|
||||
city: city,
|
||||
url_path: urlPath?.substring(0, URL_LENGTH),
|
||||
url_query: urlQuery?.substring(0, URL_LENGTH),
|
||||
referrer_path: referrerPath?.substring(0, URL_LENGTH),
|
||||
|
|
|
|||
|
|
@ -24,6 +24,12 @@ async function relationalQuery(websiteId: string, column: string, filters: Query
|
|||
{ joinSession: SESSION_COLUMNS.includes(column) },
|
||||
);
|
||||
|
||||
let excludeDomain = '';
|
||||
if (column === 'referrer_domain') {
|
||||
excludeDomain =
|
||||
'and (website_event.referrer_domain != {{websiteDomain}} or website_event.referrer_domain is null)';
|
||||
}
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select ${column} x, count(*) y
|
||||
|
|
@ -32,6 +38,7 @@ async function relationalQuery(websiteId: string, column: string, filters: Query
|
|||
where website_event.website_id = {{websiteId::uuid}}
|
||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||
and event_type = {{eventType}}
|
||||
${excludeDomain}
|
||||
${filterQuery}
|
||||
group by 1
|
||||
order by 2 desc
|
||||
|
|
@ -48,6 +55,11 @@ async function clickhouseQuery(websiteId: string, column: string, filters: Query
|
|||
eventType: column === 'event_name' ? EVENT_TYPE.customEvent : EVENT_TYPE.pageView,
|
||||
});
|
||||
|
||||
let excludeDomain = '';
|
||||
if (column === 'referrer_domain') {
|
||||
excludeDomain = 'and referrer_domain != {websiteDomain:String}';
|
||||
}
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select ${column} x, count(*) y
|
||||
|
|
@ -55,6 +67,7 @@ async function clickhouseQuery(websiteId: string, column: string, filters: Query
|
|||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime} and {endDate:DateTime}
|
||||
and event_type = {eventType:UInt32}
|
||||
${excludeDomain}
|
||||
${filterQuery}
|
||||
group by x
|
||||
order by y desc
|
||||
|
|
|
|||
|
|
@ -25,13 +25,14 @@ async function relationalQuery(websiteId: string, column: string, filters: Query
|
|||
joinSession: SESSION_COLUMNS.includes(column),
|
||||
},
|
||||
);
|
||||
const includeCountry = column === 'city' || column === 'subdivision1';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select
|
||||
${column} x,
|
||||
count(*) y
|
||||
${column === 'city' ? ', country' : ''}
|
||||
count(distinct website_event.session_id) y
|
||||
${includeCountry ? ', country' : ''}
|
||||
from website_event
|
||||
${joinSession}
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
|
|
@ -39,7 +40,7 @@ async function relationalQuery(websiteId: string, column: string, filters: Query
|
|||
and website_event.event_type = {{eventType}}
|
||||
${filterQuery}
|
||||
group by 1
|
||||
${column === 'city' ? ', 3' : ''}
|
||||
${includeCountry ? ', 3' : ''}
|
||||
order by 2 desc
|
||||
limit 100`,
|
||||
params,
|
||||
|
|
@ -52,20 +53,21 @@ async function clickhouseQuery(websiteId: string, column: string, filters: Query
|
|||
...filters,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
});
|
||||
const includeCountry = column === 'city' || column === 'subdivision1';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select
|
||||
${column} x,
|
||||
count(distinct session_id) y
|
||||
${column === 'city' ? ', country' : ''}
|
||||
${includeCountry ? ', country' : ''}
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime} and {endDate:DateTime}
|
||||
and event_type = {eventType:UInt32}
|
||||
${filterQuery}
|
||||
group by x
|
||||
${column === 'city' ? ', country' : ''}
|
||||
${includeCountry ? ', country' : ''}
|
||||
order by y desc
|
||||
limit 100
|
||||
`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue