fix stats query

This commit is contained in:
Brian Cao 2022-07-22 17:47:26 -07:00
parent 810ae101ed
commit aa8057f9fe
3 changed files with 2 additions and 5 deletions

View File

@ -146,11 +146,11 @@ export function getTimestampInterval(maxColumn, minColumn) {
const db = getDatabase();
if (db === POSTGRESQL) {
return `floor(extract(epoch from max(${maxColumn}) - min(${minColumn})))`;
return `floor(extract(epoch from (${maxColumn}) - (${minColumn})))`;
}
if (db === MYSQL) {
return `floor(unix_timestamp(max(${maxColumn})) - unix_timestamp(min(${minColumn})))`;
return `floor(unix_timestamp(${maxColumn}) - unix_timestamp(${minColumn}))`;
}
}

View File

@ -52,8 +52,6 @@ export async function getSession(req) {
device,
});
console.log(session);
if (!session) {
return null;
}

View File

@ -35,7 +35,6 @@ async function relationalQuery(website_id, start_at, end_at, filters = {}) {
'm2',
'm1',
)} else 0 end) as "totaltime"
sum(t.time) as "totaltime"
from (
select
pageview.session_id,