fix: freeze PP clock during intermission so it stops ticking toward zero
CI / Lint (push) Successful in 16s
CI / Test (push) Successful in 11s
CI / Build & Push (push) Successful in 25s

tickClocks iterates every [data-seconds][data-received-at] element. Rendering the PP indicator with those attrs during an intermission made the clock bleed seconds even though play is paused and the penalty isn't running. Drop the ticking attrs when game['Intermission'] is true — render a plain static "PP MM:SS" that resumes ticking on the next live payload.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 18:51:12 -04:00
parent b5ab318e05
commit e0a1c033cf
+7 -2
View File
@@ -244,7 +244,9 @@ function teamRow(game, side, state) {
const sogHtml = (state === 'live' || state === 'final') && sog !== undefined const sogHtml = (state === 'live' || state === 'final') && sog !== undefined
? `<span class="team-sog">${sog} SOG</span>` : ''; ? `<span class="team-sog">${sog} SOG</span>` : '';
const ppHtml = state === 'live' && pp ? teamPpIndicator(pp) : ''; const ppHtml = state === 'live' && pp
? teamPpIndicator(pp, game['Intermission'])
: '';
const subParts = [sogHtml, ppHtml].filter(Boolean).join(''); const subParts = [sogHtml, ppHtml].filter(Boolean).join('');
const subline = subParts ? `<div class="team-subline">${subParts}</div>` : ''; const subline = subParts ? `<div class="team-subline">${subParts}</div>` : '';
@@ -264,8 +266,11 @@ function teamRow(game, side, state) {
</div>`; </div>`;
} }
function teamPpIndicator(pp) { function teamPpIndicator(pp, intermission) {
const timeStr = pp.replace('PP ', ''); const timeStr = pp.replace('PP ', '');
if (intermission) {
return `<span class="team-pp">PP ${timeStr}</span>`;
}
const seconds = timeToSeconds(timeStr); const seconds = timeToSeconds(timeStr);
const attrs = `data-seconds="${seconds}" data-received-at="${Date.now()}" data-pp-clock`; const attrs = `data-seconds="${seconds}" data-received-at="${Date.now()}" data-pp-clock`;
return `<span class="team-pp">PP <span ${attrs}>${timeStr}</span></span>`; return `<span class="team-pp">PP <span ${attrs}>${timeStr}</span></span>`;