rediction-baren är nu färgkodad

This commit is contained in:
larssand
2026-03-14 19:39:27 +01:00
parent 3069878167
commit 2d95d005cd
2 changed files with 20 additions and 2 deletions

View File

@@ -3804,7 +3804,7 @@ function renderOverlayLeaderboard(rows) {
<span>${row.predictedRemainingMs !== null ? formatLap(row.predictedRemainingMs) : "-"}</span>
</div>
<div class="overlay-prediction-track">
<div class="overlay-prediction-fill" style="width:${Math.max(0, Math.min(100, Math.round((row.predictedProgress || 0) * 100)))}%"></div>
<div class="overlay-prediction-fill overlay-prediction-${escapeHtml(row.predictionTone || "good")}" style="width:${Math.max(0, Math.min(100, Math.round((row.predictedProgress || 0) * 100)))}%"></div>
</div>
</div>
</div>
@@ -4540,6 +4540,12 @@ function buildLeaderboard(session) {
const currentLapElapsedMs = row.lastTimestamp ? Math.max(0, nowTs - row.lastTimestamp) : 0;
const predictedRemainingMs = predictionBaseMs ? Math.max(0, predictionBaseMs - currentLapElapsedMs) : null;
const predictedProgress = predictionBaseMs ? Math.min(1.25, currentLapElapsedMs / predictionBaseMs) : 0;
const predictionTone =
!predictionBaseMs || predictedProgress <= 0.85
? "good"
: predictedProgress <= 1
? "warn"
: "late";
return {
...row,
totalElapsedMs,
@@ -4549,6 +4555,7 @@ function buildLeaderboard(session) {
lapDeltaMs,
predictedRemainingMs,
predictedProgress,
predictionTone,
comparisonMs:
isRollingPractice
? row.bestLapMs || row.lastLapMs || Number.MAX_SAFE_INTEGER