fix icon mapping in campaign ranking

This commit is contained in:
Maxime Réaux 2026-02-23 19:28:13 +01:00
parent 0bfe27e0d3
commit d766befd31
5 changed files with 113 additions and 58 deletions

View file

@ -131,6 +131,24 @@ class TieResolver:
groups[-1].append(pid)
return groups
@staticmethod
def tokens_spent_map(
war: War,
context_type: ContextType,
context_id: str,
participants: List[str],
) -> Dict[str, int]:
spent = {pid: 0 for pid in participants}
for ev in war.events:
if (
isinstance(ev, InfluenceSpent)
and ev.context_type == context_type
and ev.context_id == context_id
and ev.participant_id in spent
):
spent[ev.participant_id] += ev.amount
return spent
@staticmethod
def get_active_participants(
war: War,