создан механизм для создания меню для разных сравнений через drap-and-drop

This commit is contained in:
2026-08-20 12:29:07 +03:00
parent 3f2d5caa4a
commit 81fd030846
6 changed files with 727 additions and 22 deletions

9
app.py
View File

@@ -29,7 +29,8 @@ 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.08.19.28"
BUILD_VERSION = "2026.08.20.01"
# compatibility: BUILD_VERSION = "2026.08.19.28"
# compatibility: BUILD_VERSION = "2026.08.19.24"
# compatibility: BUILD_VERSION = "2026.08.19.22"
load_dotenv(BASE_DIR / ".env.local", override=False)
@@ -261,12 +262,15 @@ async def save_hockey_prematch_buttons(payload: dict[str, Any]) -> dict[str, Any
buttons = payload.get("prematch_buttons")
groups = payload.get("prematch_groups", [])
selectors = payload.get("quick_panel_selectors", [])
player_panels = payload.get("player_selection_panels", [])
if not isinstance(buttons, list):
raise HTTPException(status_code=422, detail="prematch_buttons must be a list")
if not isinstance(groups, list):
raise HTTPException(status_code=422, detail="prematch_groups must be a list")
if not isinstance(selectors, list):
raise HTTPException(status_code=422, detail="quick_panel_selectors must be a list")
if not isinstance(player_panels, list):
raise HTTPException(status_code=422, detail="player_selection_panels must be a list")
draft_manager = app.state.ui_builder_draft_manager
published_manager = app.state.ui_builder_published_manager
@@ -275,12 +279,14 @@ async def save_hockey_prematch_buttons(payload: dict[str, Any]) -> dict[str, Any
draft_config["prematch_groups"] = groups
draft_config["prematch_buttons"] = buttons
draft_config["quick_panel_selectors"] = selectors
draft_config["player_selection_panels"] = player_panels
saved_draft = draft_manager.save(draft_config)
published_config = published_manager.load()
published_config["prematch_groups"] = saved_draft.get("prematch_groups", [])
published_config["prematch_buttons"] = saved_draft.get("prematch_buttons", [])
published_config["quick_panel_selectors"] = saved_draft.get("quick_panel_selectors", [])
published_config["player_selection_panels"] = saved_draft.get("player_selection_panels", [])
saved_published = published_manager.save(published_config, create_backup=True)
return {
@@ -288,6 +294,7 @@ async def save_hockey_prematch_buttons(payload: dict[str, Any]) -> dict[str, Any
"prematch_groups": saved_published.get("prematch_groups", []),
"prematch_buttons": saved_published.get("prematch_buttons", []),
"quick_panel_selectors": saved_published.get("quick_panel_selectors", []),
"player_selection_panels": saved_published.get("player_selection_panels", []),
"config": saved_published,
}