refacto update ; pretify code

This commit is contained in:
Maxime Réaux 2026-02-02 10:41:16 +01:00
parent 6bd3ee31dc
commit fbb1c913ba
11 changed files with 594 additions and 310 deletions

View file

@ -213,6 +213,10 @@ class War:
camp = self.get_campaign(campaign_id)
return camp.add_round()
def add_battle(self, campaign_id: str) -> Round:
camp = self.get_campaign(campaign_id)
return camp.add_round()
def remove_round(self, round_id: str):
camp = self.get_campaign_by_round(round_id)
camp.remove_round(round_id)
@ -222,6 +226,15 @@ class War:
def create_choice(self, round_id: str, participant_id: str) -> Choice:
camp = self.get_campaign_by_round(round_id)
return camp.create_choice(round_id, participant_id)
def update_choice(self,
round_id: str,
participant_id: str,
priority_sector_id: str | None,
secondary_sector_id: str | None,
comment: str | None):
camp = self.get_campaign_by_round(round_id)
camp.update_choice(participant_id, priority_sector_id, secondary_sector_id, comment)
def remove_choice(self, round_id: str, participant_id: str):
camp = self.get_campaign_by_round(round_id)
@ -233,6 +246,18 @@ class War:
camp = self.get_campaign_by_round(round_id)
return camp.create_battle(round_id, sector_id)
def update_battle(self,
round_id: str,
sector_id: str,
player_1_id: str | None,
player_2_id: str | None,
winner_id: str | None,
score: str | None,
victory_condition: str | None,
comment: str | None):
camp = self.get_campaign_by_round(round_id)
camp.update_battle(sector_id, player_1_id, player_2_id, winner_id, score, victory_condition, comment)
def remove_battle(self, round_id: str, sector_id: str):
camp = self.get_campaign_by_round(round_id)
camp.remove_battle(round_id, sector_id)