From 5d972d731423c98f929b7fc1a36422486e31cb0e Mon Sep 17 00:00:00 2001 From: deploy Date: Fri, 29 May 2026 16:42:23 +0000 Subject: [PATCH] fix: resolve_clans drops unresolved placeholders to allow tag fallback Squads with dash-wrapped tags (e.g. -DSPLA-) store the full tag in the replay's team.squadron field rather than the bare short name. The short lookup fails and returns a placeholder whose short_name blocks the tag lookup, leaving squadron_long as "" and producing no point diffs on scoreboards. Fix: only include successfully resolved clans (clan_id is not None) in results and resolved_shorts so the tag pass still runs for any failed short lookup. Affects all 186 dash-tagged squads. Co-Authored-By: Claude Sonnet 4.6 --- BOT/utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/BOT/utils.py b/BOT/utils.py index 3e0c22e..6f1a5a9 100644 --- a/BOT/utils.py +++ b/BOT/utils.py @@ -986,19 +986,23 @@ async def resolve_clans(shorts: Optional[List[str]] = None, tags: Optional[List[ shorts = shorts or [] tags = tags or [] - # Process shorts first + # Process shorts first — only keep successful resolutions (clan_id present). + # Unresolved placeholders must not block the tag pass below, because some + # replays store the tagged form (e.g. "-DSPLA-") in the squadron field + # rather than the bare short name ("DSPLA"), causing the short lookup to + # miss even though the tag lookup would succeed. for short in shorts: if short: result = await resolve_clan(short=short) - if result: + if result and result.get("clan_id") is not None: results.append(result) - # Then process tags (for any not already resolved) + # Then process tags (for any not already resolved by a successful short lookup) resolved_shorts = {r["short_name"].lower() for r in results} for tag in tags: if tag and tag.lower() not in resolved_shorts: result = await resolve_clan(tag=tag) - if result: + if result and result.get("clan_id") is not None: results.append(result) return results