exceptions adding in closed elements
This commit is contained in:
parent
88bd28e949
commit
a2b6c7c684
10 changed files with 179 additions and 82 deletions
19
src/warchron/model/closure_workflow.py
Normal file
19
src/warchron/model/closure_workflow.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from warchron.model.war import War
|
||||
from warchron.model.war import War
|
||||
from warchron.model.war import War
|
||||
from warchron.model.closure_service import ClosureService
|
||||
|
||||
|
||||
class RoundClosureWorkflow:
|
||||
|
||||
def close_round(self, round_id):
|
||||
rnd = repo.get_round(round_id)
|
||||
|
||||
ties = ClosureService.close_round(rnd)
|
||||
|
||||
repo.save()
|
||||
|
||||
return ties
|
||||
|
|
@ -159,6 +159,8 @@ class Model:
|
|||
|
||||
def update_war(self, war_id: str, *, name: str, year: int) -> None:
|
||||
war = self.get_war(war_id)
|
||||
if war.is_over:
|
||||
raise ForbiddenOperation("Can't update a closed war.")
|
||||
war.set_name(name)
|
||||
war.set_year(year)
|
||||
|
||||
|
|
|
|||
|
|
@ -37,3 +37,9 @@ class ScoreService:
|
|||
if sector.minor_objective_id:
|
||||
totals[sector.minor_objective_id] += war.minor_value
|
||||
return totals
|
||||
|
||||
# def compute_round_results(round)
|
||||
|
||||
# def compute_campaign_winner(campaign)
|
||||
|
||||
# def compute_war_winner(war)
|
||||
|
|
|
|||
|
|
@ -238,6 +238,8 @@ class War:
|
|||
if self.is_over:
|
||||
raise ForbiddenOperation("Can't update campaign in a closed war.")
|
||||
camp = self.get_campaign(campaign_id)
|
||||
if camp.is_over:
|
||||
raise ForbiddenOperation("Can't update a closed campaign.")
|
||||
camp.set_name(name)
|
||||
camp.set_month(month)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue