try fix bugs

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-28 21:24:29 +01:00
parent 888ede680e
commit 93cf5dbc0a
4 changed files with 11 additions and 11 deletions

View File

@@ -201,9 +201,9 @@ async function createSessionEnd(
) {
const properties: Record<string, unknown> = {};
if (options.screenViews === 1) {
properties._bounce = true;
properties.__bounce = true;
} else {
properties._bounce = false;
properties.__bounce = false;
}
const session: IServiceCreateEventPayload = {

View File

@@ -164,16 +164,11 @@ export async function postEvent(
return reply.status(200).send('');
}
const [geo, eventsJobs, events] = await Promise.all([
const [geo, eventsJobs] = await Promise.all([
parseIp(ip),
eventsQueue.getJobs(['delayed']),
getEvents(
`SELECT * FROM events WHERE name = 'session_start' AND profile_id = '${profileId}' AND project_id = '${projectId}' ORDER BY created_at DESC LIMIT 1`
),
]);
const sessionStartEvent = events[0];
// find session_end job
const sessionEndJobCurrentDeviceId = findJobByPrefix(
eventsJobs,
@@ -216,6 +211,10 @@ export async function postEvent(
);
}
const [sessionStartEvent] = await getEvents(
`SELECT * FROM events WHERE name = 'session_start' AND device_id = '${deviceId}' AND project_id = '${projectId}' ORDER BY created_at DESC LIMIT 1`
);
request.log.info(
{
ip,
@@ -228,7 +227,8 @@ export async function postEvent(
deviceId,
bot,
geo,
events,
sessionStartEvent,
path,
},
'incoming event'
);

View File

@@ -108,7 +108,7 @@ export function EventListItem(props: EventListItemProps) {
},
},
{
name: 'OS cersion',
name: 'OS version',
value: osVersion,
onClick() {
setFilter('os_version', osVersion ?? '');

View File

@@ -60,7 +60,7 @@ export async function createSessionEnd(
...sessionStart,
properties: {
...sessionStart.properties,
_bounce: screenViews.length <= 1,
__bounce: screenViews.length <= 1,
},
name: 'session_end',
duration: sessionDuration,