Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
feat: refactor if statements
Caio Carvalhod99b8227c907
diff --git a/src/queries/analytics/reports/getFunnel.ts b/src/queries/analytics/reports/getFunnel.tsindex 53f089972..0a812d8a5 100644--- a/src/queries/analytics/reports/getFunnel.ts+++ b/src/queries/analytics/reports/getFunnel.ts@@ -70,25 +70,18 @@ async function relationalQuery((pv, cv, i) => {const levelNumber = i + 1;const startSum = i > 0 ? 'union ' : '';- const column = cv.type === 'url' ? 'url_path' : 'event_name';+ const isURL = cv.type === 'url';+ const column = isURL ? 'url_path' : 'event_name';- let operator: string;- let paramValue: string;+ let operator = '=';+ let paramValue = cv.value;- if (cv.type === 'url') {- if (cv.value.includes('*')) {- operator = '~';- paramValue = cv.value.replace(/\*/g, '.*');- } else if (cv.value.endsWith('*')) {- operator = 'like';- paramValue = cv.value.replace('*', '%');- } else {- operator = '=';- paramValue = cv.value;- }- } else {- operator = '=';- paramValue = cv.value;+ if (isURL && cv.value.includes('*')) {+ operator = '~';+ paramValue = cv.value.replace(/\*/g, '.*');+ } else if (isURL && cv.value.endsWith('*')) {+ operator = 'like';+ paramValue = cv.value.replace('*', '%');}if (levelNumber === 1) {