Fix realtime countries / visitors

This commit is contained in:
Francis Cao 2023-04-20 12:07:04 -07:00
parent fa3659fcf6
commit cce966c48c
2 changed files with 3 additions and 3 deletions

View File

@ -63,7 +63,7 @@ export default function RealtimeDashboard({ websiteId }) {
currentData.countries = percentFilter(
currentData.sessions
.reduce((arr, data) => {
if (!arr.find(({ sessionId }) => sessionId === data.sessionId)) {
if (!arr.find(({ id }) => id === data.id)) {
return arr.concat(data);
}
return arr;
@ -84,7 +84,7 @@ export default function RealtimeDashboard({ websiteId }) {
);
currentData.visitors = currentData.sessions.reduce((arr, val) => {
if (!arr.find(({ sessionId }) => sessionId === val.sessionId)) {
if (!arr.find(({ id }) => id === val.id)) {
return arr.concat(val);
}
return arr;

View File

@ -25,7 +25,7 @@ async function clickhouseQuery(websiteId: string, startAt: Date) {
return rawQuery(
`select distinct
session_id as sessionId,
session_id as id,
website_id as websiteId,
created_at as createdAt,
toUnixTimestamp(created_at) as timestamp,