fix: strip tag decorators from squadron names in comp writer and /comp lookup
Squads with dash or underscore tags (e.g. -DSPLA-, _APS_) had their raw replay team.squadron value written directly to COMPS filenames, producing -DSPLA-.json / _APS_.json. The /comp autocomplete returns the clean DB short_name (DSPLA) so the file lookup never matched. Fix: strip leading/trailing non-alphanumeric characters and uppercase in both the writer and the /comp command lookup. Also renamed the 8 existing decorated COMPS files to their clean equivalents on disk. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -1757,8 +1757,8 @@ async def process_comps(new_games):
|
||||
|
||||
# Compare to existing comps and write new/updated ones
|
||||
for team in replay_data.get("teams", []):
|
||||
squadron = team.get("squadron", "UNKNOWN")
|
||||
squadron = squadron.upper()
|
||||
squadron = re.sub(r'^[^A-Za-z0-9]+|[^A-Za-z0-9]+$', '',
|
||||
team.get("squadron", "UNKNOWN")).upper() or "UNKNOWN"
|
||||
squad_file = comp_dir / f"{squadron}.json"
|
||||
|
||||
# Load existing comps_data (or start fresh)
|
||||
|
||||
Reference in New Issue
Block a user