allow closing round with incomplete battles
This commit is contained in:
parent
ae6c033bbe
commit
69942a3cff
10 changed files with 67 additions and 29 deletions
|
|
@ -186,14 +186,36 @@ class RoundController:
|
|||
camp = self.app.model.get_campaign_by_round(round_id)
|
||||
war = self.app.model.get_war_by_round(round_id)
|
||||
workflow = RoundClosureWorkflow(self.app)
|
||||
try:
|
||||
workflow.start(war, camp, rnd)
|
||||
except DomainError as e:
|
||||
QMessageBox.warning(
|
||||
self.app.view,
|
||||
"Closure forbidden",
|
||||
str(e),
|
||||
)
|
||||
confirmed = False
|
||||
stop = False
|
||||
while True:
|
||||
try:
|
||||
workflow.start(war, camp, rnd, confirmed)
|
||||
break
|
||||
except RequiresConfirmation as e:
|
||||
reply = QMessageBox.question(
|
||||
self.app.view,
|
||||
"Confirm closing",
|
||||
str(e),
|
||||
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
|
||||
)
|
||||
if reply == QMessageBox.StandardButton.Yes:
|
||||
if e.action:
|
||||
e.action()
|
||||
confirmed = True
|
||||
continue
|
||||
else:
|
||||
stop = True
|
||||
break
|
||||
except DomainError as e:
|
||||
QMessageBox.warning(
|
||||
self.app.view,
|
||||
"Closure forbidden",
|
||||
str(e),
|
||||
)
|
||||
stop = True
|
||||
break
|
||||
if stop:
|
||||
return
|
||||
self.app.is_dirty = True
|
||||
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
|
|
@ -234,7 +256,8 @@ class RoundController:
|
|||
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
|
||||
)
|
||||
if reply == QMessageBox.StandardButton.Yes:
|
||||
e.action()
|
||||
if e.action:
|
||||
e.action()
|
||||
else:
|
||||
return
|
||||
self.app.is_dirty = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue