mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Updated date range handling.
This commit is contained in:
parent
6d1603fa28
commit
5ca51b3e8f
19 changed files with 101 additions and 99 deletions
|
|
@ -12,6 +12,7 @@ export async function getActiveVisitors(...args: [websiteId: string]) {
|
|||
|
||||
async function relationalQuery(websiteId: string) {
|
||||
const { rawQuery } = prisma;
|
||||
const startDate = subMinutes(new Date(), 5);
|
||||
|
||||
const result = await rawQuery(
|
||||
`
|
||||
|
|
@ -20,7 +21,7 @@ async function relationalQuery(websiteId: string) {
|
|||
where website_id = {{websiteId::uuid}}
|
||||
and created_at >= {{startDate}}
|
||||
`,
|
||||
{ websiteId, startDate: subMinutes(new Date(), 5) },
|
||||
{ websiteId, startDate },
|
||||
);
|
||||
|
||||
return result[0] ?? null;
|
||||
|
|
@ -28,6 +29,7 @@ async function relationalQuery(websiteId: string) {
|
|||
|
||||
async function clickhouseQuery(websiteId: string): Promise<{ x: number }> {
|
||||
const { rawQuery } = clickhouse;
|
||||
const startDate = subMinutes(new Date(), 5);
|
||||
|
||||
const result = await rawQuery(
|
||||
`
|
||||
|
|
@ -37,7 +39,7 @@ async function clickhouseQuery(websiteId: string): Promise<{ x: number }> {
|
|||
where website_id = {websiteId:UUID}
|
||||
and created_at >= {startDate:DateTime64}
|
||||
`,
|
||||
{ websiteId, startDate: subMinutes(new Date(), 5) },
|
||||
{ websiteId, startDate },
|
||||
);
|
||||
|
||||
return result[0] ?? null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue