удаления еще раз 2
This commit is contained in:
@@ -14,7 +14,7 @@ from sqlalchemy import and_, delete, desc, func, or_, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from .client import Stat2TVClient, Stat2TVNotFoundError
|
||||
from .config import DEFAULT_PERIOD_STATUS_LABELS, HockeySettingsStore
|
||||
from .config import DEFAULT_PERIOD_STATUS_LABELS, DEFAULT_STRENGTH_STATE_LABELS, HockeySettingsStore
|
||||
from .database import HockeyDatabase
|
||||
from .iso_country_codes import iso2_from_code
|
||||
from .localization import (
|
||||
@@ -5524,40 +5524,28 @@ class HockeyDataService:
|
||||
configured_state = phase_labels_map.get(state_key)
|
||||
state_labels = configured_state if isinstance(configured_state, dict) else {}
|
||||
language_key = "en" if language == "en" else "ru"
|
||||
has_configured_label = language_key in state_labels
|
||||
state_label = str(state_labels.get(language_key) or "").strip()
|
||||
|
||||
# Backwards-compatible fallback only when an old configuration does not
|
||||
# contain this matrix cell at all. An explicitly empty cell means that
|
||||
# the operator wants no extra caption for that numerical state.
|
||||
if not has_configured_label:
|
||||
legacy_pp = str(settings.get("strength_powerplay_label") or "PP").strip() or "PP"
|
||||
if advantage_side and state_key == "5x4":
|
||||
state_label = legacy_pp
|
||||
elif state_key not in {"5x5", ""}:
|
||||
state_label = state_key.replace("x", " on " if language_key == "en" else " на ")
|
||||
# BUILD94: the captions configured in "Таймеры и численные составы" are
|
||||
# the single source of truth for strength text everywhere: Runtime,
|
||||
# Mapping and vMix. Do not synthesize a second caption from state_key and
|
||||
# do not silently substitute the legacy PP/PK strings. When a raw/legacy
|
||||
# settings dictionary is missing a matrix cell, use the same default
|
||||
# matrix that the settings UI/store uses. An explicitly present empty
|
||||
# value stays empty.
|
||||
if language_key in state_labels:
|
||||
state_label = str(state_labels.get(language_key) or "").strip()
|
||||
else:
|
||||
default_phase = DEFAULT_STRENGTH_STATE_LABELS.get(label_phase, {})
|
||||
default_state = default_phase.get(state_key, {}) if isinstance(default_phase, dict) else {}
|
||||
state_label = str(default_state.get(language_key) or "").strip()
|
||||
|
||||
# BUILD92: Mapping captions describe the current numerical condition.
|
||||
# The advantage side keeps its configured state caption (PP, "Power play",
|
||||
# etc.), while a penalized non-advantage side receives the numerical
|
||||
# condition itself (5 на 4 / 5 on 4, 5 на 3 / 5 on 3, ...). For an
|
||||
# equal coincidental state both penalized sides receive the same numerical
|
||||
# condition. This is Mapping-only data; television output still follows
|
||||
# the single-penalty-plate runtime logic.
|
||||
numerical_state_label = (
|
||||
state_key.replace("x", " on " if language_key == "en" else " на ")
|
||||
if state_key else ""
|
||||
)
|
||||
home_label = (
|
||||
state_label if advantage_side == "home"
|
||||
else numerical_state_label if home_penalties > 0
|
||||
else ""
|
||||
)
|
||||
away_label = (
|
||||
state_label if advantage_side == "away"
|
||||
else numerical_state_label if away_penalties > 0
|
||||
else ""
|
||||
)
|
||||
# HOME/AWAY are separate Mapping destinations, but their text must come
|
||||
# from the same configured state caption. If penalties are active, both
|
||||
# side-label identifiers expose that configured caption; the one-plate
|
||||
# television routing still decides which side is actually shown on air.
|
||||
penalty_state_active = bool(state_key and (home_penalties > 0 or away_penalties > 0))
|
||||
home_label = state_label if penalty_state_active else ""
|
||||
away_label = state_label if penalty_state_active else ""
|
||||
phase_labels = {
|
||||
"regulation": ("Основное время", "Regulation"),
|
||||
"regular_overtime": ("Овертайм регулярки", "Regular OT"),
|
||||
|
||||
Reference in New Issue
Block a user