mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
Add table alias to filterQuery. Closed #3869
Some checks are pending
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run
Some checks are pending
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run
This commit is contained in:
parent
86d2672c47
commit
3072f02f1b
2 changed files with 14 additions and 7 deletions
|
|
@ -74,15 +74,21 @@ function getSearchSQL(column: string, param: string = 'search'): string {
|
|||
function mapFilter(column: string, operator: string, name: string, type: string = '') {
|
||||
const value = `{{${name}${type ? `::${type}` : ''}}}`;
|
||||
|
||||
if (name.startsWith('cohort_')) {
|
||||
name = name.slice('cohort_'.length);
|
||||
}
|
||||
|
||||
const table = SESSION_COLUMNS.includes(name) ? 'session' : 'website_event';
|
||||
|
||||
switch (operator) {
|
||||
case OPERATORS.equals:
|
||||
return `${column} = ${value}`;
|
||||
return `${table}.${column} = ${value}`;
|
||||
case OPERATORS.notEquals:
|
||||
return `${column} != ${value}`;
|
||||
return `${table}.${column} != ${value}`;
|
||||
case OPERATORS.contains:
|
||||
return `${column} ilike ${value}`;
|
||||
return `${table}.${column} ilike ${value}`;
|
||||
case OPERATORS.doesNotContain:
|
||||
return `${column} not ilike ${value}`;
|
||||
return `${table}.${column} not ilike ${value}`;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue