тест 8

This commit is contained in:
2026-08-24 18:17:26 +03:00
parent 65a2521156
commit aac9e5b8bc
7 changed files with 170 additions and 38 deletions

View File

@@ -3484,6 +3484,7 @@ class HockeyDataService:
language: str = "ru",
allow_create: bool = False,
force_optional_shots: bool = False,
skip_optional_shots: bool = False,
) -> dict[str, Any]:
settings = self.settings.public()
templates = {
@@ -3590,15 +3591,16 @@ class HockeyDataService:
now=now,
)
shots_meta: dict[str, Any] = {"available": False}
try:
shots_meta = await self._sync_optional_shots(
tournament_external_id=tournament_external_id,
game_external_id=game_external_id,
force=force_optional_shots,
)
except Exception as error:
warnings.append(f"Дополнительные данные shots недоступны: {error}")
shots_meta: dict[str, Any] = {"available": False, "skipped": bool(skip_optional_shots)}
if not skip_optional_shots:
try:
shots_meta = await self._sync_optional_shots(
tournament_external_id=tournament_external_id,
game_external_id=game_external_id,
force=force_optional_shots,
)
except Exception as error:
warnings.append(f"Дополнительные данные shots недоступны: {error}")
payload = self.game_details(game_external_id, language=language)
if payload is None:
@@ -3948,33 +3950,40 @@ class HockeyDataService:
tournament_external_id: str,
game_external_id: str,
language: str = "ru",
opening: bool = False,
) -> dict[str, Any]:
schedule: dict[str, Any] | None = None
schedule_warning = ""
try:
schedule = await self.sync_selected_game(
tournament_external_id=tournament_external_id,
game_external_id=game_external_id,
language=language,
)
except Exception as error:
if self.game(game_external_id, language=language) is None:
raise
schedule_warning = str(error)
if opening:
# BUILD110: the operator clicked a row that already came from the
# local schedule. Do not spend the critical roster-loading window on
# another schedule round-trip; live polling refreshes it afterwards.
schedule = self.game(game_external_id, language=language)
else:
try:
schedule = await self.sync_selected_game(
tournament_external_id=tournament_external_id,
game_external_id=game_external_id,
language=language,
)
except Exception as error:
if self.game(game_external_id, language=language) is None:
raise
schedule_warning = str(error)
details_warning = ""
try:
# Opening a match must not depend on every optional Stat2TV resource.
# Some schedule entries exist before/without a full match JSON card.
# Keep the operator UI usable and enrich the selected match when the
# card becomes available instead of failing the whole selection.
# Opening a match waits only for the core card/rosters. Optional
# shots are deliberately deferred to live/background refresh so a
# slow auxiliary feed cannot keep the loading overlay open.
payload = await asyncio.wait_for(
self.sync_match_details(
tournament_external_id=tournament_external_id,
game_external_id=game_external_id,
language=language,
allow_create=True,
force_optional_shots=True,
force_optional_shots=not opening,
skip_optional_shots=opening,
),
timeout=12.0,
)