поправлены удаления, и поправлено отображение в настройках SQL

This commit is contained in:
2026-08-20 13:40:20 +03:00
parent 381e630c77
commit 9422719ea6
6 changed files with 216 additions and 19 deletions

View File

@@ -4143,6 +4143,8 @@ function startCustomTooltips() {
const home = penalties.filter((item) => item.side === "home").map(penaltyRuntimeItem).sort(bySoonest);
const away = penalties.filter((item) => item.side === "away").map(penaltyRuntimeItem).sort(bySoonest);
const flags = getByPath(state.data, "hockey.game_control.flags") || {};
// Legacy BUILD43 shortest-timer behaviour was allEntries.slice(0, 1);
// `take()` preserves that rule while routing the timer to the advantage side.
const strength = getByPath(state.data, "hockey.game_control.strength") || {};
return {
sequence: sequence ? clone(sequence) : null,
@@ -4635,32 +4637,43 @@ function startCustomTooltips() {
|| Number(a.event.createdAt || 0) - Number(b.event.createdAt || 0));
}
// BUILD83: HOME/AWAY penalty targets describe where the extra scorebug plate
// is drawn, not which bench committed the penalty. While both teams have an
// active penalty we keep the traditional one-per-side display (coincidental
// penalties). As soon as only one team still has a penalty, its timer must
// move to the OPPOSITE target because that is the team playing on the power
// play. Example: HOME 1:43 + HOME 2:00 + AWAY 1:43 -> after the coincidental
// 1:43 pair expires, the remaining HOME 2:00 is shown through the AWAY input.
// BUILD85: HOME/AWAY penalty targets describe the TEAM THAT HAS THE NUMERICAL
// ADVANTAGE, not the bench that committed the penalty. This matters not only
// for a normal 5x4/5x3 power play, but also for 4x3 and 3x4 when both benches
// still have active penalties. The authoritative advantage_side is calculated
// by the hockey strength engine. When strength is equal (4x4 / 3x3), keep the
// traditional one-per-side coincidental display. If the strength payload has
// not arrived yet, the single-penalty fallback still routes to the opposite
// target exactly as BUILD83 did.
function penaltyDisplayEntriesByTargetSide(step) {
const home = sortedPenaltyEntries("home");
const away = sortedPenaltyEntries("away");
const soonestOnly = String(step?.penalty_display_mode || "soonest") !== "all";
// Legacy BUILD43 equivalent was `allEntries.slice(0, 1)`; routing is now
// calculated for both sides together so the remaining penalty can move to
// the power-play team target without losing the shortest-time behaviour.
if (!soonestOnly) return { home, away, routedToAdvantage: false };
const strength = getByPath(state.data, "hockey.game_control.strength") || {};
const advantageSide = String(strength.advantage_side || "").trim().toLowerCase();
const take = (items) => soonestOnly ? items.slice(0, 1) : items;
if (advantageSide === "home") {
// HOME has more skaters, therefore an AWAY penalty controls the PP clock.
return { home: take(away), away: [], routedToAdvantage: true, advantageSide: "home" };
}
if (advantageSide === "away") {
// AWAY has more skaters, therefore a HOME penalty controls the PP clock.
return { home: [], away: take(home), routedToAdvantage: true, advantageSide: "away" };
}
if (home.length && away.length) {
return { home: home.slice(0, 1), away: away.slice(0, 1), routedToAdvantage: false };
return { home: take(home), away: take(away), routedToAdvantage: false, advantageSide: "" };
}
if (home.length) {
return { home: [], away: home.slice(0, 1), routedToAdvantage: true };
if (soonestOnly) return { home: [], away: home.slice(0, 1), routedToAdvantage: true };
return { home: [], away: home, routedToAdvantage: true, advantageSide: "away" };
}
if (away.length) {
return { home: away.slice(0, 1), away: [], routedToAdvantage: true };
if (soonestOnly) return { home: away.slice(0, 1), away: [], routedToAdvantage: true };
return { home: away, away: [], routedToAdvantage: true, advantageSide: "home" };
}
return { home: [], away: [], routedToAdvantage: false };
return { home: [], away: [], routedToAdvantage: false, advantageSide: "" };
}
function hockeyPenaltySideMappingDetail(item, side) {