I tracked down the problem to `dataclass.replace` because it generates a new object.
Turns out the check for "claimed" squadrons is somehow linked to the original object.
Simply overwriting the original object fixes the problem.
This commit is contained in:
Raffson 2022-07-24 19:30:30 +02:00
parent 18057af9ad
commit 6e555167e0
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -158,12 +158,11 @@ class DefaultSquadronAssigner:
if squadron_def is None: if squadron_def is None:
return None return None
overrides: Dict[str, Union[str, int]] = {}
if config.name is not None: if config.name is not None:
overrides["name"] = config.name squadron_def.name = config.name
if config.nickname is not None: if config.nickname is not None:
overrides["nickname"] = config.nickname squadron_def.nickname = config.nickname
if config.female_pilot_percentage is not None: if config.female_pilot_percentage is not None:
overrides["female_pilot_percentage"] = config.female_pilot_percentage squadron_def.female_pilot_percentage = config.female_pilot_percentage
return dataclasses.replace(squadron_def, **overrides) return squadron_def