simplify unused objectives display and tie-break
This commit is contained in:
parent
9b28e85557
commit
0c6014e946
5 changed files with 31 additions and 11 deletions
|
|
@ -60,8 +60,7 @@ class CampaignController:
|
|||
vp_icon_map = RankingIcon.compute_icons(
|
||||
war, ContextType.CAMPAIGN, campaign_id, scores
|
||||
)
|
||||
# TODO get only objectives used in major/minor (ignore token only)
|
||||
for obj in war.get_all_objectives():
|
||||
for obj in war.get_objectives_used_as_maj_or_min():
|
||||
objective_icon_maps[obj.id] = RankingIcon.compute_icons(
|
||||
war,
|
||||
ContextType.CAMPAIGN,
|
||||
|
|
@ -94,7 +93,8 @@ class CampaignController:
|
|||
)
|
||||
)
|
||||
objectives = [
|
||||
ObjectiveDTO(o.id, o.name, o.description) for o in war.get_all_objectives()
|
||||
ObjectiveDTO(o.id, o.name, o.description)
|
||||
for o in war.get_objectives_used_as_maj_or_min()
|
||||
]
|
||||
self.app.view.display_campaign_participants(rows, objectives)
|
||||
self.app.view.endCampaignBtn.setEnabled(not camp.is_over)
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ class CampaignClosureWorkflow(ClosureWorkflow):
|
|||
TieResolver.apply_bids(war, tie, bids)
|
||||
TieResolver.resolve_tie_state(war, tie, bids)
|
||||
ties = TieResolver.find_campaign_ties(war, campaign.id)
|
||||
# TODO get only objectives used in major/minor (ignore token only)
|
||||
for objective_id in war.objectives:
|
||||
for obj in war.get_objectives_used_as_maj_or_min():
|
||||
objective_id = obj.id
|
||||
ties = TieResolver.find_campaign_objective_ties(
|
||||
war,
|
||||
campaign.id,
|
||||
|
|
@ -77,8 +77,8 @@ class WarClosureWorkflow(ClosureWorkflow):
|
|||
TieResolver.apply_bids(war, tie, bids)
|
||||
TieResolver.resolve_tie_state(war, tie, bids)
|
||||
ties = TieResolver.find_war_ties(war)
|
||||
# TODO get only objectives used in major/minor (ignore token only)
|
||||
for objective_id in war.objectives:
|
||||
for obj in war.get_objectives_used_as_maj_or_min():
|
||||
objective_id = obj.id
|
||||
ties = TieResolver.find_war_objective_ties(
|
||||
war,
|
||||
objective_id,
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ class WarController:
|
|||
for obj in objectives
|
||||
]
|
||||
self.app.view.display_war_objectives(objectives_for_display)
|
||||
limited_objectives_for_display: List[ObjectiveDTO] = [
|
||||
ObjectiveDTO(id=obj.id, name=obj.name, description=obj.description)
|
||||
for obj in war.get_objectives_used_as_maj_or_min()
|
||||
]
|
||||
scores = ScoreService.compute_scores(war, ContextType.WAR, war.id)
|
||||
rows: List[WarParticipantScoreDTO] = []
|
||||
vp_icon_map: dict[str, QIcon] = {}
|
||||
|
|
@ -60,8 +64,7 @@ class WarController:
|
|||
vp_icon_map = RankingIcon.compute_icons(
|
||||
war, ContextType.WAR, war_id, scores
|
||||
)
|
||||
# TODO get only objectives used in major/minor (ignore token only)
|
||||
for obj in war.get_all_objectives():
|
||||
for obj in war.get_objectives_used_as_maj_or_min():
|
||||
objective_icon_maps[obj.id] = RankingIcon.compute_icons(
|
||||
war,
|
||||
ContextType.WAR,
|
||||
|
|
@ -90,7 +93,7 @@ class WarController:
|
|||
objective_icons=objective_icons,
|
||||
)
|
||||
)
|
||||
self.app.view.display_war_participants(rows, objectives_for_display)
|
||||
self.app.view.display_war_participants(rows, limited_objectives_for_display)
|
||||
self.app.view.endWarBtn.setEnabled(not war.is_over)
|
||||
|
||||
def _validate_war_inputs(self, name: str, year: int) -> bool:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue