diff --git a/get_data.py b/get_data.py index 1443125..412eeeb 100644 --- a/get_data.py +++ b/get_data.py @@ -354,11 +354,29 @@ def merge_online_payloads( # нормализация/дедуп # plays = _dedup_plays(plays_raw) - # print(game) + # print(game["teams"]) + # print(box_score) + for index_team, team in enumerate(game["teams"][1:]): + box_team = box_score["result"]["teams"][index_team] + for player in team.get("starts", []): + stat = next( + ( + s + for s in box_team.get("starts", []) + if s.get("startNum") == player.get("startNum") + ), + None, + ) + if stat: + player["stats"] = stat + + team["total"] = box_team.get("total", {}) + game["plays"] = play_by_play.get("result", []) game["scoreByPeriods"] = box_score["result"].get("scoreByPeriods", []) game["fullScore"] = box_score["result"].get("fullScore", {}) game["live_status"] = live_status["result"] + # game[""] merged: Dict[str, Any] = { "meta": { "generatedAt": _now_iso(),