Add configurable manifest-driven race audio system

This commit is contained in:
larssand committed 2026-08-28 13:29:27 +02:00
1 parent 3f3b410869
commit 5f79228941
22 files changed
+1133 -109

No files matched your search

+6 -2
View File
@@ -78,11 +78,15 @@ export function getPassingValidationLabel(passing, { t }) {
export function getSessionTiming(session, nowTs = Date.now(), { getSessionTargetMs }) {
const targetMs = getSessionTargetMs(session);
const startedAt = Number(session?.startedAt || 0);
const elapsedMs = startedAt ? Math.max(0, nowTs - startedAt) : 0;
const pausedAt = Number(session?.pausedAt || 0) || 0;
const clockNow = pausedAt || nowTs;
const totalPausedMs = Math.max(0, Number(session?.totalPausedMs || 0) || 0);
const elapsedMs = startedAt ? Math.max(0, clockNow - startedAt - totalPausedMs) : 0;
const followUpMs = Math.max(0, Number(session?.followUpSec || 0) || 0) * 1000;
const followUpStartedAt = Number(session?.followUpStartedAt || 0) || 0;
const followUpPausedMs = Math.max(0, Number(session?.followUpPausedMs || 0) || 0);
const followUpActive = Boolean(followUpStartedAt && followUpMs > 0);
const followUpRemainingMs = followUpActive ? Math.max(0, followUpMs - Math.max(0, nowTs - followUpStartedAt)) : 0;
const followUpRemainingMs = followUpActive ? Math.max(0, followUpMs - Math.max(0, clockNow - followUpStartedAt - followUpPausedMs)) : 0;
return {
targetMs,
elapsedMs,