fix(ci): normalize session-day count comparison

This commit is contained in:
2026-03-28 13:24:44 -07:00
parent a96df287d1
commit e4c8c60b3e

View File

@@ -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;
);
}