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, startedAtMs: number,
): boolean { ): boolean {
return ( return (
( Number(
db (
.prepare( db
` .prepare(
`
SELECT COUNT(*) AS count SELECT COUNT(*) AS count
FROM imm_sessions FROM imm_sessions
WHERE date(started_at_ms / 1000, 'unixepoch', 'localtime') = date(? / 1000, 'unixepoch', 'localtime') 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 < ?) OR (started_at_ms = ? AND session_id < ?)
) )
`, `,
) )
.get(startedAtMs, startedAtMs, startedAtMs, currentSessionId) as ExistenceRow | null .get(startedAtMs, startedAtMs, startedAtMs, currentSessionId) as ExistenceRow | null
)?.count === 0 )?.count ?? 0,
) === 0;
); );
} }