MCPcopy
hub / github.com/umami-software/umami / getCohortQuery

Function getCohortQuery

src/lib/prisma.ts:183–204  ·  view source on GitHub ↗
(filters: QueryFilters = {})

Source from the content-addressed store, hash-verified

181}
182
183function getCohortQuery(filters: QueryFilters = {}) {
184 if (!filters || Object.keys(filters).length === 0) {
185 return '';
186 }
187
188 const cohortMatch = (filters as any).cohort_match;
189 const cohortActionName = (filters as any).cohort_actionName;
190
191 const filterQuery = getFilterQuery(filters, { isCohort: true, cohortMatch, cohortActionName });
192
193 return `join
194 (select distinct website_event.session_id
195 from website_event
196 join session on session.session_id = website_event.session_id
197 and session.website_id = website_event.website_id
198 where website_event.website_id = {{websiteId}}
199 and website_event.created_at between {{cohort_startDate}} and {{cohort_endDate}}
200 ${filterQuery}
201 ) cohort
202 on cohort.session_id = website_event.session_id
203 `;
204}
205
206function getExcludeBounceQuery(filters: Record<string, any>) {
207 if (filters.excludeBounce !== true) {

Callers 1

parseFiltersFunction · 0.70

Calls 1

getFilterQueryFunction · 0.70

Tested by

no test coverage detected