fix compute score of war participants absent from campaign

This commit is contained in:
Maxime Réaux 2026-03-16 17:27:51 +01:00
parent 241e76c937
commit a3b9f5a943

View file

@ -44,11 +44,17 @@ class ScoreService:
) -> Dict[str, ParticipantScore]:
from warchron.model.result_checker import ResultChecker
if context_type == ContextType.CAMPAIGN:
camp = war.get_campaign(context_id)
camp_pids = camp.get_all_campaign_participants_ids()
participant_ids = [(camp.campaign_to_war_part_id(pid)) for pid in camp_pids]
elif context_type == ContextType.WAR:
participant_ids = war.get_all_war_participants_ids()
scores = {
pid: ParticipantScore(
narrative_points={obj_id: 0 for obj_id in war.objectives}
)
for pid in war.participants
for pid in participant_ids
}
battles = ScoreService._get_battles_for_context(war, context_type, context_id)
for battle in battles: