mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 09:57:00 +01:00
Fix UTM report for postgres. udpate parseParameters to work with bigInt
This commit is contained in:
parent
314bbee717
commit
7ec4e5dfa2
@ -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