mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 01:35:17 +01:00
Fix MySQL query.
This commit is contained in:
parent
41eeb1a5f1
commit
2d69b3087f
@ -369,6 +369,10 @@ export function getRankings(website_id, start_at, end_at, type, table) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getActiveVisitors(website_id) {
|
export function getActiveVisitors(website_id) {
|
||||||
|
const db = getDatabase();
|
||||||
|
const date = subMinutes(new Date(), 5);
|
||||||
|
|
||||||
|
if (db === POSTGRESQL) {
|
||||||
return prisma.$queryRaw(
|
return prisma.$queryRaw(
|
||||||
`
|
`
|
||||||
select count(distinct session_id) x
|
select count(distinct session_id) x
|
||||||
@ -377,6 +381,22 @@ export function getActiveVisitors(website_id) {
|
|||||||
and created_at >= $2
|
and created_at >= $2
|
||||||
`,
|
`,
|
||||||
website_id,
|
website_id,
|
||||||
subMinutes(new Date(), 5),
|
date,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db === MYSQL) {
|
||||||
|
return prisma.$queryRaw(
|
||||||
|
`
|
||||||
|
select count(distinct session_id) x
|
||||||
|
from pageview
|
||||||
|
where website_id=?
|
||||||
|
and created_at >= ?
|
||||||
|
`,
|
||||||
|
website_id,
|
||||||
|
date,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user