mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
Split out session query.
This commit is contained in:
parent
7b9c29e039
commit
4497951000
9 changed files with 139 additions and 56 deletions
|
|
@ -61,14 +61,13 @@ function getDateFormat(date) {
|
|||
return `'${dateFormat(date, 'UTC:yyyy-mm-dd HH:MM:ss')}'`;
|
||||
}
|
||||
|
||||
function getFilterQuery(filters = {}, params = {}) {
|
||||
function getFilterQuery(filters = {}) {
|
||||
const query = Object.keys(filters).reduce((arr, key) => {
|
||||
const filter = filters[key];
|
||||
|
||||
if (filter !== undefined) {
|
||||
const column = FILTER_COLUMNS[key] || key;
|
||||
arr.push(`and ${column} = {${key}:String}`);
|
||||
params[key] = decodeURIComponent(filter);
|
||||
}
|
||||
|
||||
return arr;
|
||||
|
|
@ -77,9 +76,9 @@ function getFilterQuery(filters = {}, params = {}) {
|
|||
return query.join('\n');
|
||||
}
|
||||
|
||||
function parseFilters(filters: WebsiteMetricFilter = {}, params: any = {}) {
|
||||
function parseFilters(filters: WebsiteMetricFilter = {}) {
|
||||
return {
|
||||
filterQuery: getFilterQuery(filters, params),
|
||||
filterQuery: getFilterQuery(filters),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue