mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-24 11:01:38 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5a2330ba2a
@ -26,15 +26,7 @@ async function relationalQuery(
|
|||||||
endDate: Date;
|
endDate: Date;
|
||||||
timezone?: string;
|
timezone?: string;
|
||||||
},
|
},
|
||||||
): Promise<
|
) {
|
||||||
{
|
|
||||||
date: string;
|
|
||||||
day: number;
|
|
||||||
visitors: number;
|
|
||||||
returnVisitors: number;
|
|
||||||
percentage: number;
|
|
||||||
}[]
|
|
||||||
> {
|
|
||||||
const { startDate, endDate } = filters;
|
const { startDate, endDate } = filters;
|
||||||
const { rawQuery } = prisma;
|
const { rawQuery } = prisma;
|
||||||
|
|
||||||
@ -44,7 +36,7 @@ async function relationalQuery(
|
|||||||
from website_event
|
from website_event
|
||||||
where website_id = {{websiteId::uuid}}
|
where website_id = {{websiteId::uuid}}
|
||||||
and created_at between {{startDate}} and {{endDate}}
|
and created_at between {{startDate}} and {{endDate}}
|
||||||
and url_query is not null
|
and coalesce(url_query, '') != ''
|
||||||
and event_type = 1
|
and event_type = 1
|
||||||
group by 1
|
group by 1
|
||||||
`,
|
`,
|
||||||
@ -53,9 +45,7 @@ async function relationalQuery(
|
|||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
},
|
},
|
||||||
).then(results => {
|
).then(result => parseParameters(result as any[]));
|
||||||
return results;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clickhouseQuery(
|
async function clickhouseQuery(
|
||||||
@ -65,15 +55,7 @@ async function clickhouseQuery(
|
|||||||
endDate: Date;
|
endDate: Date;
|
||||||
timezone?: string;
|
timezone?: string;
|
||||||
},
|
},
|
||||||
): Promise<
|
) {
|
||||||
{
|
|
||||||
date: string;
|
|
||||||
day: number;
|
|
||||||
visitors: number;
|
|
||||||
returnVisitors: number;
|
|
||||||
percentage: number;
|
|
||||||
}[]
|
|
||||||
> {
|
|
||||||
const { startDate, endDate } = filters;
|
const { startDate, endDate } = filters;
|
||||||
const { rawQuery } = clickhouse;
|
const { rawQuery } = clickhouse;
|
||||||
|
|
||||||
@ -104,11 +86,11 @@ function parseParameters(data: any[]) {
|
|||||||
if (key.match(/^utm_(\w+)$/)) {
|
if (key.match(/^utm_(\w+)$/)) {
|
||||||
const name = safeDecodeURIComponent(value);
|
const name = safeDecodeURIComponent(value);
|
||||||
if (!obj[key]) {
|
if (!obj[key]) {
|
||||||
obj[key] = { [name]: +num };
|
obj[key] = { [name]: Number(num) };
|
||||||
} else if (!obj[key][name]) {
|
} else if (!obj[key][name]) {
|
||||||
obj[key][name] = +num;
|
obj[key][name] = Number(num);
|
||||||
} else {
|
} else {
|
||||||
obj[key][name] += +num;
|
obj[key][name] += Number(num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user