BUILD196 — обновлять большинство и составы, задерживать связанные плашки

This commit is contained in:
2026-10-22 11:51:28 +03:00
parent 6491e95143
commit f3018b97c3
31 changed files with 3226 additions and 81 deletions

View File

@@ -8,11 +8,13 @@ const names=['currentHockeyPenaltyEntries','activeHockeyPenaltyEntries','hockeyP
'shortcutSequenceIsOnAir','sequenceMatchesRuntimeOverlay','runtimeOverlayMatchesInput',
'normalizeRuntimeVmixInputRef','runtimeOverlayInputRefs',
'hockeyScoreboardSequenceIsLive','hockeyScoreboardPrimaryOverlayTargets','hockeyTeamStateSequenceStep',
'hockeyScoreboardDelaySeconds','hockeyScoreboardPresentationContext','hockeyObserveScoreboardPresentation','hockeyScoreboardAuxiliaryReady',
'buildShortcutRuntimeContext','isTimerComponent','getByPath','formatValue','templateValue','templateSequenceValue',
'vmixOverlayLayer','vmixInputByRef','vmixInventoryInputs','hockeyStoreGameControl',
'hockeyReadyPenaltyCounts','hockeyHasPendingPenaltyInteractions','hockeyFlushPendingPenaltyInteractions',
'hockeyStrengthMappingSignature','hockeyTeamStateFlagSignature','hockeyTimerSelectedGameId'];
const definitions=names.map(name=>{const start=source.search(new RegExp(' (?:async )?function '+name+'\\('));
const clampDefinition=source.match(/^ const clamp = .+;$/m);assert.ok(clampDefinition,'actual production clamp');
const definitions=clampDefinition[0]+'\n'+names.map(name=>{const start=source.search(new RegExp(' (?:async )?function '+name+'\\('));
assert.ok(start>=0,name);return source.slice(start,source.indexOf('\n }',start)+4);}).join('\n');
const target={id:'home-slot',input:'home-penalty',selected_name:'Time.Text',overlay:'2'};
const step={id:'timers',type:'hockey_vmix_timers_start',sync_vmix_penalties:true,home_penalty_targets:[target],away_penalty_targets:[]};
@@ -28,7 +30,8 @@ const state={config:{components:[component],shortcut_sequences:[scoreboard,{id:'
vmixOverlayRuntime:new Map([['1',{input:'score-input'}]]),shortcutSequenceOverlayState:new Map(),
quickPanelServerOnAirSequences:new Set(),quickPanelOnAirSequences:new Set()};
const noop=()=>{};
const ctx={console,state,performance,Date,window:{UIBuilderRuntime:{patchData:noop},dispatchEvent:noop},clone:value=>JSON.parse(JSON.stringify(value)),ensureHockeyBoardState:()=>board,hockeyCanControl:()=>allowed,
const ctx={console,state,performance,Date,setTimeout,clearTimeout,window:{UIBuilderRuntime:{patchData:patch=>Object.assign(state.data.hockey,patch.hockey)},dispatchEvent:noop},clone:value=>JSON.parse(JSON.stringify(value)),ensureHockeyBoardState:()=>board,hockeyCanControl:()=>allowed,
currentRuntimeVmixDeviceId:()=> 'd',currentRuntimeHockeySessionToken:()=> 's',
padTimer:n=>String(n).padStart(2,'0'),sequencePenaltyTargets:(s,side)=>s[side+'_penalty_targets'],
getByPath:()=>({}),rememberPenaltyAdvantagePlan:noop,emitInteraction:(_component,name)=>timeline.push(name),hockeyPenaltyContext:()=>({}),
addHockeyHistory:noop,hockeyInfractionWebLabel:()=>'',hockeySyncPenaltySideMappingContext:()=>Promise.resolve(),
@@ -42,7 +45,7 @@ const ctx={console,state,performance,Date,window:{UIBuilderRuntime:{patchData:no
vm.createContext(ctx);vm.runInContext(definitions,ctx);
const functions=()=>sent.map(c=>c.Function);
const settle=async()=>{for(let i=0;i<12;i++)await Promise.resolve();};
const serverState=()=>({game_id:'g',current_period:'1',strength:{home_penalties:0,away_penalties:1}});
const serverState=()=>({game_id:'g',current_period:'1',strength:{home_penalties:0,away_penalties:1,advantage_side:'home'}});
const afterSave=async()=>{ctx.hockeyStoreGameControl('g',serverState(),{render:false,dispatch:false});await settle();};
(async()=>{
// No local ON AIR latch, only authoritative vMix tally (e.g. after reload).
@@ -79,6 +82,7 @@ const afterSave=async()=>{ctx.hockeyStoreGameControl('g',serverState(),{render:f
sent.length=0;state.vmixPenaltyTargetAssignments.clear();state.activeHockeyVmixTimerSteps.clear();
ctx.emitHockeyEventUpdated(component,event,'preset');assert.deepEqual(functions(),[],'cold off-air draft sends nothing');
ctx.activateConfiguredPenaltyCountdowns();
state.vmixOverlayRuntime.set('1',{input:'score-input'}); // F1's upper-score ACK/tally, before its auxiliary reconciliation.
await ctx.rebalanceVmixPenaltyTargets({scoreboardActive:true,forceOverlay:true});
assert.deepEqual(functions(),['SetCountdown','StopCountdown','OverlayInput2In']);
assert.equal(sent[0].Value,'00:05:00');