добавил в Json_Team_Generation сохранение файлов Top_team и Started_team

This commit is contained in:
2025-10-24 14:49:40 +03:00
parent d7c819357d
commit 0844d577ff

View File

@@ -1028,14 +1028,44 @@ def Json_Team_Generation(merged: dict, *, out_dir: str = "static", who: str | No
x.get("startRole", 99), 99
), # 99 — по умолчанию
)
out_path = Path(out_dir) / f"{who}.json"
atomic_write_json(out_path, sorted_team)
logging.getLogger("game_watcher").info("Сохранил payload: %s", out_path)
logging.info("Сохранил payload: {out_path}")
top_sorted_team = sorted(
filter(lambda x: x["startRole"] in ["Player", ""], sorted_team),
key=lambda x: (
x["pts"],
x["dreb"] + x["oreb"],
x["ast"],
x["stl"],
x["blk"],
x["time"],
),
reverse=True,
)
for item in top_sorted_team:
item["pts"] = "" if item["num"] == "" else item["pts"]
item["foul"] = "" if item["num"] == "" else item["foul"]
out_path = Path(out_dir) / f"top{who.replace('t','T')}.json"
atomic_write_json(out_path, top_sorted_team)
logging.info("Сохранил payload: {out_path}")
started_team = sorted(
filter(
lambda x: x["startRole"] == "Player" and x["isOnCourt"] is True,
sorted_team,
),
key=lambda x: int(x["num"]),
reverse=False,
)
out_path = Path(out_dir) / f"started_{who}.json"
atomic_write_json(out_path, started_team)
logging.info("Сохранил payload: {out_path}")
# ==========================
# ---- ДОМЕННАЯ ЛОГИКА