fix unique participant in war & campaign

This commit is contained in:
Maxime Réaux 2026-02-03 09:01:17 +01:00
parent 49bf6d7ea8
commit 87670329c2
3 changed files with 15 additions and 10 deletions

View file

@ -123,7 +123,6 @@ class Model:
return war
raise KeyError(f"Objective {objective_id} not found in any War")
# TODO don't use this method as participant with same ID (player) can be in several wars!
def get_war_by_war_participant(self, participant_id: str) -> War:
for war in self.wars.values():
if war.has_participant(participant_id):
@ -174,9 +173,7 @@ class Model:
def get_available_players(self, war_id: str) -> list[Player]:
war = self.get_war(war_id)
return [
player
for player in self.players.values()
if not war.has_participant(player.id)
player for player in self.players.values() if not war.has_player(player.id)
]
def add_war_participant(