fix participants in round choices + battles
This commit is contained in:
parent
47b01e0b69
commit
7210ddc927
2 changed files with 32 additions and 19 deletions
|
|
@ -204,7 +204,7 @@ class Controller:
|
|||
camp = self.model.get_campaign_by_round(round_id)
|
||||
self.view.show_round_details(index=camp.get_round_index(round_id))
|
||||
participants = self.model.get_round_participants(round_id)
|
||||
sectors = camp.get_all_sectors()
|
||||
sectors = camp.get_sectors_in_round(round_id)
|
||||
choices_for_display = []
|
||||
for part in participants:
|
||||
choice = rnd.get_choice(part.id)
|
||||
|
|
@ -232,16 +232,20 @@ class Controller:
|
|||
battle = rnd.get_battle(sect.id)
|
||||
if not battle:
|
||||
battle = self.model.create_battle(round_id=rnd.id, sector_id=sect.id)
|
||||
player_1_name = (
|
||||
self.model.get_player_name(battle.player_1_id)
|
||||
if battle.player_1_id
|
||||
else ""
|
||||
)
|
||||
player_2_name = (
|
||||
self.model.get_player_name(battle.player_2_id)
|
||||
if battle.player_2_id
|
||||
else ""
|
||||
)
|
||||
if battle.player_1_id:
|
||||
camp_part = camp.participants[battle.player_1_id]
|
||||
player_1_name = self.model.get_participant_name(
|
||||
camp_part.war_participant_id
|
||||
)
|
||||
else:
|
||||
player_1_name = ""
|
||||
if battle.player_2_id:
|
||||
camp_part = camp.participants[battle.player_2_id]
|
||||
player_2_name = self.model.get_participant_name(
|
||||
camp_part.war_participant_id
|
||||
)
|
||||
else:
|
||||
player_2_name = ""
|
||||
battles_for_display.append(
|
||||
(
|
||||
camp.get_sector_name(battle.sector_id),
|
||||
|
|
@ -689,13 +693,13 @@ class Controller:
|
|||
choice = rnd.get_choice(choice_id)
|
||||
if not choice:
|
||||
return
|
||||
part = camp.participants[choice.participant_id]
|
||||
player = self.model.get_player(part.id)
|
||||
part_opt = ParticipantOption(id=player.id, name=player.name)
|
||||
participant = camp.participants[choice.participant_id]
|
||||
player = self.model.get_player_from_campaign_participant(participant)
|
||||
part_opt = ParticipantOption(id=participant.id, name=player.name)
|
||||
dialog = ChoicesDialog(
|
||||
self.view,
|
||||
participants=[part_opt],
|
||||
default_participant_id=part.id,
|
||||
default_participant_id=participant.id,
|
||||
sectors=sectors,
|
||||
default_priority_id=choice.priority_sector_id,
|
||||
default_secondary_id=choice.secondary_sector_id,
|
||||
|
|
@ -705,7 +709,7 @@ class Controller:
|
|||
return
|
||||
self.model.update_choice(
|
||||
round_id=round_id,
|
||||
participant_id=part.id,
|
||||
participant_id=participant.id,
|
||||
priority_sector_id=dialog.get_priority_id(),
|
||||
secondary_sector_id=dialog.get_secondary_id(),
|
||||
comment=dialog.get_comment(),
|
||||
|
|
@ -725,9 +729,9 @@ class Controller:
|
|||
return
|
||||
sect = camp.sectors[battle.sector_id]
|
||||
part_opts: list[ParticipantOption] = []
|
||||
for part in participants:
|
||||
player = self.model.get_player(part.id)
|
||||
part_opts.append(ParticipantOption(id=part.id, name=player.name))
|
||||
for participant in participants:
|
||||
player = self.model.get_player_from_campaign_participant(participant)
|
||||
part_opts.append(ParticipantOption(id=participant.id, name=player.name))
|
||||
dialog = BattlesDialog(
|
||||
self.view,
|
||||
sectors=[sect],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue