simplify unused objectives display and tie-break

This commit is contained in:
Maxime Réaux 2026-03-06 16:39:22 +01:00
parent 9b28e85557
commit 0c6014e946
5 changed files with 31 additions and 11 deletions

View file

@ -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: