fix: apply per-team resolution to process_session clan lookup
Same order-inversion bug as build_scoreboard_context existed in process_session's resolve_clans call. The inverted squadron_long caused the scoreboard renderer to find the opponent's diff entry for a dash-tagged squad's players, producing ??? for every player since their UIDs weren't in the wrong squad's points_diff dict. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+17
-10
@@ -1002,16 +1002,23 @@ async def process_session(
|
||||
player["vehicle"] = "DISCONNECTED"
|
||||
player["vehicle_new"] = "DISCONNECTED"
|
||||
|
||||
# Clan resolution
|
||||
squads = [team.get("squadron") for team in replay_data.get("teams", []) if team.get("squadron")]
|
||||
squads_tagged = [team.get("squadron_tagged") for team in replay_data.get("teams", []) if team.get("squadron_tagged")]
|
||||
|
||||
resolved = await resolve_clans(shorts=squads, tags=squads_tagged)
|
||||
long_clans = [c["long_name"] for c in resolved]
|
||||
|
||||
for team, long_name in zip(replay_data.get("teams", []), long_clans):
|
||||
if team and long_name:
|
||||
team["squadron_long"] = long_name
|
||||
# Clan resolution — resolve each team independently to preserve index order.
|
||||
# Batching all teams into one resolve_clans call inverts results when one
|
||||
# team resolves via the short-name pass and another via the tag pass.
|
||||
for team in replay_data.get("teams", []):
|
||||
if not team:
|
||||
continue
|
||||
sq = str(team.get("squadron") or "")
|
||||
tag = str(team.get("squadron_tagged") or "")
|
||||
if not sq and not tag:
|
||||
continue
|
||||
_results = await resolve_clans(shorts=[sq] if sq else [], tags=[tag] if tag else [])
|
||||
if _results:
|
||||
r = _results[0]
|
||||
if r.get("long_name") and r["long_name"] != "<unresolved>":
|
||||
team["squadron_long"] = r["long_name"]
|
||||
if r.get("short_name"):
|
||||
team["squadron_short"] = r["short_name"]
|
||||
|
||||
# Prep scoreboard params
|
||||
if session_context and session_context.get("match_details"):
|
||||
|
||||
Reference in New Issue
Block a user