wip close round/campaign/war + refacto json None
This commit is contained in:
parent
4c8086caf4
commit
6cbb7c6534
26 changed files with 474 additions and 108 deletions
|
|
@ -182,7 +182,9 @@ class Model:
|
|||
|
||||
# Objective methods
|
||||
|
||||
def add_objective(self, war_id: str, name: str, description: str) -> Objective:
|
||||
def add_objective(
|
||||
self, war_id: str, name: str, description: str | None
|
||||
) -> Objective:
|
||||
war = self.get_war(war_id)
|
||||
return war.add_objective(name, description)
|
||||
|
||||
|
|
@ -195,7 +197,7 @@ class Model:
|
|||
raise KeyError("Objective not found")
|
||||
|
||||
def update_objective(
|
||||
self, objective_id: str, *, name: str, description: str
|
||||
self, objective_id: str, *, name: str, description: str | None
|
||||
) -> None:
|
||||
war = self.get_war_by_objective(objective_id)
|
||||
war.update_objective(objective_id, name=name, description=description)
|
||||
|
|
@ -229,6 +231,11 @@ class Model:
|
|||
def get_player_from_war_participant(self, war_part: WarParticipant) -> Player:
|
||||
return self.get_player(war_part.player_id)
|
||||
|
||||
def get_participant_name(self, participant_id: str) -> str:
|
||||
war = self.get_war_by_war_participant(participant_id)
|
||||
war_part = war.get_war_participant(participant_id)
|
||||
return self.players[war_part.player_id].name
|
||||
|
||||
def update_war_participant(self, participant_id: str, *, faction: str) -> None:
|
||||
war = self.get_war_by_war_participant(participant_id)
|
||||
war.update_war_participant(participant_id, faction=faction)
|
||||
|
|
@ -290,10 +297,10 @@ class Model:
|
|||
self,
|
||||
campaign_id: str,
|
||||
name: str,
|
||||
round_id: str,
|
||||
major_id: str,
|
||||
minor_id: str,
|
||||
influence_id: str,
|
||||
round_id: str | None,
|
||||
major_id: str | None,
|
||||
minor_id: str | None,
|
||||
influence_id: str | None,
|
||||
) -> Sector:
|
||||
camp = self.get_campaign(campaign_id)
|
||||
return camp.add_sector(name, round_id, major_id, minor_id, influence_id)
|
||||
|
|
@ -312,10 +319,10 @@ class Model:
|
|||
sector_id: str,
|
||||
*,
|
||||
name: str,
|
||||
round_id: str,
|
||||
major_id: str,
|
||||
minor_id: str,
|
||||
influence_id: str,
|
||||
round_id: str | None,
|
||||
major_id: str | None,
|
||||
minor_id: str | None,
|
||||
influence_id: str | None,
|
||||
) -> None:
|
||||
war = self.get_war_by_sector(sector_id)
|
||||
war.update_sector(
|
||||
|
|
@ -343,11 +350,6 @@ class Model:
|
|||
camp = self.get_campaign(camp_id)
|
||||
return camp.add_campaign_participant(player_id, leader, theme)
|
||||
|
||||
def get_participant_name(self, participant_id: str) -> str:
|
||||
war = self.get_war_by_war_participant(participant_id)
|
||||
war_part = war.get_war_participant(participant_id)
|
||||
return self.players[war_part.player_id].name
|
||||
|
||||
# TODO replace multiloops by internal has_* method
|
||||
def get_campaign_participant(self, participant_id: str) -> CampaignParticipant:
|
||||
for war in self.wars.values():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue