diff --git a/src/core/services/immersion-tracker/lifetime.ts b/src/core/services/immersion-tracker/lifetime.ts index 2f3abf99..dc3a99f3 100644 --- a/src/core/services/immersion-tracker/lifetime.ts +++ b/src/core/services/immersion-tracker/lifetime.ts @@ -94,10 +94,11 @@ function isFirstSessionForLocalDay( startedAtMs: number, ): boolean { return ( - ( - db - .prepare( - ` + Number( + ( + db + .prepare( + ` SELECT COUNT(*) AS count FROM imm_sessions WHERE date(started_at_ms / 1000, 'unixepoch', 'localtime') = date(? / 1000, 'unixepoch', 'localtime') @@ -106,9 +107,10 @@ function isFirstSessionForLocalDay( OR (started_at_ms = ? AND session_id < ?) ) `, - ) - .get(startedAtMs, startedAtMs, startedAtMs, currentSessionId) as ExistenceRow | null - )?.count === 0 + ) + .get(startedAtMs, startedAtMs, startedAtMs, currentSessionId) as ExistenceRow | null + )?.count ?? 0, + ) === 0; ); }