Bugfix: to_map_input_name case issue (#4433)

After bugfixes #4423 logic in the function changed and on the line where CAMPAIGN_ is removed the name is actually in lower case. Moved upper case manupulation in order to ensure correct case. 
Upper was not removed considering the function should turn d3 into D3.
Before this bugfix incrementing to the next stage was unusable (eg. 12-2 would be incremented to a strange "n2")

Co-authored-by: LmeSzinc <lmeszincsales@gmail.com>
This commit is contained in:
Shane (Treasure) Xue 2024-12-16 00:05:50 +08:00 committed by GitHub
parent eb836d1b4f
commit 27b92c9b58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,13 +52,14 @@ def to_map_input_name(name: str) -> str:
campaign_7_2 -> 7-2
d3 -> D3
"""
name = str(name).upper()
# Remove whitespaces
name = re.sub('[ \t\n]', '', name).lower()
# B-1 -> B1
res = re.match(r'([a-zA-Z])+[- ]+(\d+)', name)
if res:
name = f'{res.group(1)}{res.group(2)}'
# Change back to upper case for campaign removal
name = str(name).upper()
# campaign_7_2 -> 7-2
name = name.replace('CAMPAIGN_', '').replace('_', '-')
return name