fix(ci): normalize daily session count extraction

This commit is contained in:
2026-03-28 13:26:36 -07:00
parent b1638afe21
commit 13a88a8382

View File

@@ -93,11 +93,9 @@ function isFirstSessionForLocalDay(
currentSessionId: number, currentSessionId: number,
startedAtMs: number, startedAtMs: number,
): boolean { ): boolean {
return Number( const sameDayCount = Number(
( (
db db.prepare(`
.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')
@@ -109,7 +107,8 @@ function isFirstSessionForLocalDay(
) )
.get(startedAtMs, startedAtMs, startedAtMs, currentSessionId) as ExistenceRow | null, .get(startedAtMs, startedAtMs, startedAtMs, currentSessionId) as ExistenceRow | null,
)?.count ?? 0 )?.count ?? 0
) === 0; );
return sameDayCount === 0;
} }
function resetLifetimeSummaries(db: DatabaseSync, nowMs: string): void { function resetLifetimeSummaries(db: DatabaseSync, nowMs: string): void {