mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Fix metrics.
This commit is contained in:
parent
2172dddd1c
commit
d2687b6580
3 changed files with 15 additions and 6 deletions
|
|
@ -106,7 +106,7 @@ function getEventDataFilterQuery(
|
|||
return query.join('\n');
|
||||
}
|
||||
|
||||
function getFilterQuery(filters = {}, params = []): string {
|
||||
function getFilterQuery(filters = {}, params = [], field: string): string {
|
||||
const query = Object.keys(filters).reduce((arr, key) => {
|
||||
const filter = filters[key];
|
||||
|
||||
|
|
@ -114,6 +114,10 @@ function getFilterQuery(filters = {}, params = []): string {
|
|||
return arr;
|
||||
}
|
||||
|
||||
if (key === field) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case 'url':
|
||||
arr.push(`and url_path=$${params.length + 1}`);
|
||||
|
|
@ -162,6 +166,7 @@ function getFilterQuery(filters = {}, params = []): string {
|
|||
function parseFilters(
|
||||
filters: { [key: string]: any } = {},
|
||||
params = [],
|
||||
field?: string,
|
||||
sessionKey = 'session_id',
|
||||
) {
|
||||
const {
|
||||
|
|
@ -194,7 +199,7 @@ function parseFilters(
|
|||
os || browser || device || country || subdivision1 || subdivision2 || city
|
||||
? `inner join session on website_event.${sessionKey} = session.${sessionKey}`
|
||||
: '',
|
||||
filterQuery: getFilterQuery(filters, params),
|
||||
filterQuery: getFilterQuery(filters, params, field),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue