ёбанные удаления надеюсь финальные

This commit is contained in:
2026-08-20 16:55:53 +03:00
parent 770859d1c7
commit c4f71e122a
4 changed files with 256 additions and 13 deletions

View File

@@ -5459,6 +5459,18 @@ class HockeyDataService:
)
if not assigned:
continue
# BUILD96: a prepared penalty must not change numerical strength until
# the operator explicitly starts it. New Runtime snapshots always send
# startedOnce. Legacy snapshots (without the marker) keep the old
# assigned-immediately behaviour for backward compatibility.
has_started_marker = "startedOnce" in item or "started_once" in item
if has_started_marker:
started = bool(item.get("startedOnce", item.get("started_once", False))) or bool(item.get("running", False))
else:
started = bool(item.get("running", False)) or remaining_ms < duration_ms or assigned
if not started:
continue
if side == "home":
home += 1
else:
@@ -5588,6 +5600,10 @@ class HockeyDataService:
"penalty_board": {
"penalties": [],
"history": [],
"advantage_cycle": {
"had_advantage": False,
"last_advantage_side": "",
},
},
}
@@ -5625,6 +5641,15 @@ class HockeyDataService:
history = source_board.get("history")
penalties = [item for item in penalties if isinstance(item, dict)] if isinstance(penalties, list) else []
history = [item for item in history if isinstance(item, dict)] if isinstance(history, list) else []
source_cycle = source_board.get("advantage_cycle")
source_cycle = source_cycle if isinstance(source_cycle, dict) else {}
cycle_side = str(source_cycle.get("last_advantage_side") or "").lower()
if cycle_side not in {"home", "away"}:
cycle_side = ""
advantage_cycle = {
"had_advantage": bool(source_cycle.get("had_advantage", False)) and bool(cycle_side),
"last_advantage_side": cycle_side,
}
normalised = {
"saved": True,
@@ -5638,6 +5663,7 @@ class HockeyDataService:
"penalty_board": {
"penalties": penalties[:64],
"history": history[:64],
"advantage_cycle": advantage_cycle,
},
}
encoded = json.dumps(normalised, ensure_ascii=False, separators=(",", ":"))