fix filter params

This commit is contained in:
Francis Cao 2023-07-31 11:42:47 -07:00
parent 95d824542f
commit 7e112b8469
6 changed files with 11 additions and 5 deletions

View File

@ -70,7 +70,7 @@ function getFilterQuery(filters = {}, params = []): string {
if (filter !== undefined) {
const column = FILTER_COLUMNS[key] || key;
arr.push(`and ${column}=$${params.length + 1}`);
arr.push(`and ${column}={{${key}}}`);
params.push(decodeURIComponent(filter));
}

View File

@ -47,11 +47,11 @@ async function relationalQuery(websiteId: string, criteria: GetEventMetricsCrite
order by 2
`,
{
...filters,
websiteId,
startDate: maxDate(startDate, website.resetAt),
endDate,
eventType: EVENT_TYPE.customEvent,
...filters,
},
);
}

View File

@ -39,6 +39,7 @@ async function relationalQuery(
startDate: maxDate(startDate, website.resetAt),
endDate,
eventType: column === 'event_name' ? EVENT_TYPE.customEvent : EVENT_TYPE.pageView,
...filters,
};
let excludeDomain = '';

View File

@ -52,11 +52,11 @@ async function relationalQuery(websiteId: string, criteria: PageviewStatsCriteri
group by 1
`,
{
...filters,
websiteId,
startDate: maxDate(startDate, website.resetAt),
endDate,
eventType: EVENT_TYPE.pageView,
...filters,
},
);
}

View File

@ -42,7 +42,12 @@ async function relationalQuery(
group by 1
order by 2 desc
limit 100`,
{ ...filters, websiteId, startDate: maxDate(startDate, website.resetAt), endDate },
{
websiteId,
startDate: maxDate(startDate, website.resetAt),
endDate,
...filters,
},
);
}

View File

@ -51,11 +51,11 @@ async function relationalQuery(
) as t
`,
{
...filters,
websiteId,
startDate: maxDate(startDate, website.resetAt),
endDate,
eventType: EVENT_TYPE.pageView,
...filters,
},
);
}