mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 09:35:36 +01:00
Added parseDateRangeQuery function.
This commit is contained in:
parent
a0aaeeeb57
commit
09af33c77e
15 changed files with 139 additions and 98 deletions
|
|
@ -2,8 +2,8 @@ import prisma from 'lib/prisma';
|
|||
import clickhouse from 'lib/clickhouse';
|
||||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import { EVENT_TYPE } from 'lib/constants';
|
||||
import { loadWebsite } from 'lib/query';
|
||||
import { max } from 'date-fns';
|
||||
import { loadWebsite } from 'lib/load';
|
||||
import { maxDate } from 'lib/date';
|
||||
|
||||
export async function getPageviewMetrics(
|
||||
...args: [
|
||||
|
|
@ -36,7 +36,7 @@ async function relationalQuery(
|
|||
const website = await loadWebsite(websiteId);
|
||||
const params: any = {
|
||||
websiteId,
|
||||
startDate: max([startDate, website.resetAt]),
|
||||
startDate: maxDate(startDate, website.resetAt),
|
||||
endDate,
|
||||
eventType: column === 'event_name' ? EVENT_TYPE.customEvent : EVENT_TYPE.pageView,
|
||||
};
|
||||
|
|
@ -84,7 +84,7 @@ async function clickhouseQuery(
|
|||
const website = await loadWebsite(websiteId);
|
||||
const params = {
|
||||
websiteId,
|
||||
startDate: max([startDate, website.resetAt]),
|
||||
startDate: maxDate(startDate, website.resetAt),
|
||||
endDate,
|
||||
eventType: column === 'event_name' ? EVENT_TYPE.customEvent : EVENT_TYPE.pageView,
|
||||
domain: undefined,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import clickhouse from 'lib/clickhouse';
|
|||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import prisma from 'lib/prisma';
|
||||
import { DEFAULT_RESET_DATE, EVENT_TYPE } from 'lib/constants';
|
||||
import { loadWebsite } from 'lib/query';
|
||||
import { max } from 'date-fns';
|
||||
import { loadWebsite } from 'lib/load';
|
||||
import { maxDate } from 'lib/date';
|
||||
|
||||
export async function getPageviewStats(
|
||||
...args: [
|
||||
|
|
@ -66,7 +66,7 @@ async function relationalQuery(
|
|||
{
|
||||
...filters,
|
||||
websiteId,
|
||||
startDate: max([startDate, website.resetAt]),
|
||||
startDate: maxDate(startDate, website.resetAt),
|
||||
endDate,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
},
|
||||
|
|
@ -118,7 +118,7 @@ async function clickhouseQuery(
|
|||
{
|
||||
...filters,
|
||||
websiteId,
|
||||
startDate: max([startDate, website.resetAt]),
|
||||
startDate: maxDate(startDate, website.resetAt),
|
||||
endDate,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue