unifomise tiebreak icons + refacto presenter
This commit is contained in:
parent
0081e52e9a
commit
3d0d7874e3
10 changed files with 185 additions and 165 deletions
|
|
@ -16,7 +16,7 @@ from warchron.model.round import Round
|
|||
from warchron.model.battle import Battle
|
||||
from warchron.model.score_service import ScoreService
|
||||
from warchron.model.tie_manager import TieResolver, TieContext
|
||||
from warchron.model.war_event import TieResolved, InfluenceSpent
|
||||
from warchron.model.war_event import TieResolved
|
||||
from warchron.model.score_service import ParticipantScore
|
||||
|
||||
ResolveTiesCallback = Callable[
|
||||
|
|
@ -304,28 +304,6 @@ class Pairing:
|
|||
return AllocationType.SECONDARY
|
||||
return AllocationType.FALLBACK
|
||||
|
||||
@staticmethod
|
||||
def participant_spent_token(
|
||||
war: War,
|
||||
round_id: str,
|
||||
sector_id: str | None,
|
||||
war_participant_id: str,
|
||||
) -> bool:
|
||||
if sector_id is None:
|
||||
return False
|
||||
for ev in war.events:
|
||||
if not isinstance(ev, InfluenceSpent):
|
||||
continue
|
||||
if ev.context_type != ContextType.CHOICE:
|
||||
continue
|
||||
if ev.context_id != round_id:
|
||||
continue
|
||||
if ev.sector_id != sector_id:
|
||||
continue
|
||||
if ev.participant_id == war_participant_id:
|
||||
return True
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def get_round_allocation(
|
||||
war: War,
|
||||
|
|
@ -338,14 +316,16 @@ class Pairing:
|
|||
raise DomainError(f"No campaign found for round {round.id}")
|
||||
war_pid = campaign.campaign_to_war_part_id(campaign_participant_id)
|
||||
|
||||
token_priority = Pairing.participant_spent_token(
|
||||
token_priority = TieResolver.participant_spent_token(
|
||||
war,
|
||||
ContextType.CHOICE,
|
||||
round.id,
|
||||
choice.priority_sector_id,
|
||||
war_pid,
|
||||
)
|
||||
token_secondary = Pairing.participant_spent_token(
|
||||
token_secondary = TieResolver.participant_spent_token(
|
||||
war,
|
||||
ContextType.CHOICE,
|
||||
round.id,
|
||||
choice.secondary_sector_id,
|
||||
war_pid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue