mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
fix collect
This commit is contained in:
parent
61df707765
commit
07d003e858
11 changed files with 41 additions and 27 deletions
|
|
@ -18,7 +18,7 @@ async function relationalQuery(websiteId, data) {
|
|||
...data,
|
||||
},
|
||||
select: {
|
||||
sessionId: true,
|
||||
id: true,
|
||||
sessionUuid: true,
|
||||
hostname: true,
|
||||
browser: true,
|
||||
|
|
@ -31,7 +31,7 @@ async function relationalQuery(websiteId, data) {
|
|||
})
|
||||
.then(async res => {
|
||||
if (redis.client && res) {
|
||||
await redis.client.set(`session:${res.sessionUuid}`, res.id);
|
||||
await redis.client.set(`session:${res.sessionUuid}`, 1);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ async function relationalQuery(sessionUuid) {
|
|||
})
|
||||
.then(async res => {
|
||||
if (redis.client && res) {
|
||||
await redis.client.set(`session:${res.sessionUuid}`, res.sessionId);
|
||||
await redis.client.set(`session:${res.sessionUuid}`, 1);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -32,7 +32,7 @@ async function clickhouseQuery(sessionUuid) {
|
|||
|
||||
return rawQuery(
|
||||
`select distinct
|
||||
session_uuid,
|
||||
session_id,
|
||||
website_id,
|
||||
created_at,
|
||||
hostname,
|
||||
|
|
@ -43,7 +43,7 @@ async function clickhouseQuery(sessionUuid) {
|
|||
language,
|
||||
country
|
||||
from event
|
||||
where session_uuid = $1`,
|
||||
where session_id = $1`,
|
||||
params,
|
||||
)
|
||||
.then(result => findFirst(result))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ async function relationalQuery(websites, start_at) {
|
|||
...(websites && websites.length > 0
|
||||
? {
|
||||
website: {
|
||||
id: {
|
||||
websiteUuid: {
|
||||
in: websites,
|
||||
},
|
||||
},
|
||||
|
|
@ -29,11 +29,11 @@ async function relationalQuery(websites, start_at) {
|
|||
}
|
||||
|
||||
async function clickhouseQuery(websites, start_at) {
|
||||
const { rawQuery, getDateFormat } = clickhouse;
|
||||
const { rawQuery, getDateFormat, getCommaSeparatedStringFormat } = clickhouse;
|
||||
|
||||
return rawQuery(
|
||||
`select distinct
|
||||
session_uuid,
|
||||
session_id,
|
||||
website_id,
|
||||
created_at,
|
||||
hostname,
|
||||
|
|
@ -44,7 +44,11 @@ async function clickhouseQuery(websites, start_at) {
|
|||
language,
|
||||
country
|
||||
from event
|
||||
where ${websites && websites.length > 0 ? `website_id in (${websites.join(',')})` : '0 = 0'}
|
||||
where ${
|
||||
websites && websites.length > 0
|
||||
? `website_id in (${getCommaSeparatedStringFormat(websites)})`
|
||||
: '0 = 0'
|
||||
}
|
||||
and created_at >= ${getDateFormat(start_at)}`,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue