From 0844d577ff091d63fd51e9980fc34bcd2f00dd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=A7=D0=B5=D1=80=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Fri, 24 Oct 2025 14:49:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=20Json=5FTeam=5FGeneration=20=D1=81=D0=BE=D1=85=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20Top=5Fteam=20=D0=B8=20Started=5Fteam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- get_data.py | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/get_data.py b/get_data.py index a35c7c9..a55850a 100644 --- a/get_data.py +++ b/get_data.py @@ -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}") + + # ========================== # ---- ДОМЕННАЯ ЛОГИКА