BUILD150 — кнопка ОНЛАЙН для расписания
This commit is contained in:
32
app.py
32
app.py
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from datetime import date
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
@@ -29,7 +30,7 @@ from ui_builder import install_ui_builder
|
||||
from khl_site.khl_data_center import APP as khl_site_app
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent
|
||||
BUILD_VERSION = "2026.09.18.7"
|
||||
BUILD_VERSION = "2026.09.18.8"
|
||||
# compatibility: BUILD_VERSION = "2026.08.26.1"
|
||||
# compatibility: BUILD_VERSION = "2026.08.25.1"
|
||||
# compatibility: BUILD_VERSION = "2026.08.24.15"
|
||||
@@ -379,6 +380,35 @@ app.include_router(
|
||||
)
|
||||
|
||||
|
||||
@app.post(
|
||||
"/api/hockey/tournaments/{external_id}/games/online-sync",
|
||||
dependencies=[Depends(hockey_auth.require_user)],
|
||||
tags=["Hockey"],
|
||||
)
|
||||
async def refresh_tournament_schedule_online(
|
||||
external_id: str,
|
||||
on_date: date = Query(...),
|
||||
language: str = Query("ru", pattern="^(ru|en)$"),
|
||||
) -> dict[str, Any]:
|
||||
"""Refresh score/status for every game on one schedule date from match JSON.
|
||||
|
||||
RU explicitly reads ``json/{game_id}.json`` and EN explicitly reads
|
||||
``json_en/{game_id}.json``. No schedule XML is fetched by this button.
|
||||
"""
|
||||
if hockey_service.tournament(external_id, language=language) is None:
|
||||
raise HTTPException(status_code=404, detail="Турнир не найден")
|
||||
try:
|
||||
return await hockey_service.refresh_schedule_from_match_json(
|
||||
tournament_external_id=external_id,
|
||||
on_date=on_date,
|
||||
language=language,
|
||||
)
|
||||
except ValueError as error:
|
||||
raise HTTPException(status_code=400, detail=str(error)) from error
|
||||
except Exception as error:
|
||||
raise HTTPException(status_code=502, detail=str(error)) from error
|
||||
|
||||
|
||||
@app.post(
|
||||
"/api/hockey/tournaments/{external_id}/standings/force-sync",
|
||||
dependencies=[Depends(hockey_auth.require_user)],
|
||||
|
||||
Reference in New Issue
Block a user