исправил данные из box-score, которые успешно проебал

This commit is contained in:
2025-10-24 19:09:18 +03:00
parent 58bff8ba53
commit 8f34737186

View File

@@ -354,11 +354,29 @@ def merge_online_payloads(
# нормализация/дедуп # нормализация/дедуп
# plays = _dedup_plays(plays_raw) # 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["plays"] = play_by_play.get("result", [])
game["scoreByPeriods"] = box_score["result"].get("scoreByPeriods", []) game["scoreByPeriods"] = box_score["result"].get("scoreByPeriods", [])
game["fullScore"] = box_score["result"].get("fullScore", {}) game["fullScore"] = box_score["result"].get("fullScore", {})
game["live_status"] = live_status["result"] game["live_status"] = live_status["result"]
# game[""]
merged: Dict[str, Any] = { merged: Dict[str, Any] = {
"meta": { "meta": {
"generatedAt": _now_iso(), "generatedAt": _now_iso(),