mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 15:47:13 +01:00
add daydiff function query
This commit is contained in:
parent
27226d1b0e
commit
979ea33d74
2 changed files with 18 additions and 2 deletions
|
|
@ -33,7 +33,7 @@ async function relationalQuery(
|
|||
}[]
|
||||
> {
|
||||
const { startDate, endDate } = dateRange;
|
||||
const { getDateQuery, rawQuery } = prisma;
|
||||
const { getDateQuery, getDayDiffQuery, rawQuery } = prisma;
|
||||
const timezone = 'utc';
|
||||
const unit = 'day';
|
||||
|
||||
|
|
@ -49,7 +49,10 @@ async function relationalQuery(
|
|||
user_activities AS (
|
||||
select distinct
|
||||
w.session_id,
|
||||
(${getDateQuery('created_at', unit, timezone)}::date - c.cohort_date::date) as day_number
|
||||
(${getDayDiffQuery(
|
||||
getDateQuery('created_at', unit, timezone),
|
||||
'c.cohort_date',
|
||||
)}) as day_number
|
||||
from website_event w
|
||||
join cohort_items c
|
||||
on w.session_id = c.session_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue