mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
Refactored startDate usage.
This commit is contained in:
parent
0f98fb5959
commit
a0aaeeeb57
9 changed files with 30 additions and 53 deletions
|
|
@ -3,6 +3,7 @@ import clickhouse from 'lib/clickhouse';
|
|||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import { loadWebsite } from 'lib/query';
|
||||
import { DEFAULT_RESET_DATE } from 'lib/constants';
|
||||
import { max } from 'date-fns';
|
||||
|
||||
export async function getWebsiteDateRange(...args: [websiteId: string]) {
|
||||
return runQuery({
|
||||
|
|
@ -40,8 +41,8 @@ async function clickhouseQuery(websiteId: string) {
|
|||
max(created_at) as max
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at >= {dataStartDate:DateTime}
|
||||
and created_at >= {startDate:DateTime}
|
||||
`,
|
||||
{ websiteId, dataStartDate: website.dataStartDate },
|
||||
{ websiteId, startDate: max([new Date('2000-01-01'), website.resetAt]) },
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue