Skip to content

Commit 676d3c2

Browse files
committed
Fix bug with league wars where the first clan isn't the searched clan and a bug which affected the end of the scwl
1 parent 7776299 commit 676d3c2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

coc/client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,10 +1018,12 @@ async def get_current_war(
10181018

10191019
if cwl_round is WarRound.current_war and league_group.state == "preparation":
10201020
return None # for round 1 and 15min prep between rounds this is a shortcut.
1021-
elif cwl_round is WarRound.current_preparation and league_group.state == "warEnded":
1021+
elif cwl_round is WarRound.current_preparation and league_group.state == "ended":
10221022
return None # for the end of CWL there's no next prep day.
10231023
elif cwl_round is WarRound.previous_war and len(league_group.rounds) == 1:
10241024
return None # no previous war for first rounds.
1025+
elif cwl_round is WarRound.current_war and league_group.state == "ended":
1026+
round_tags = league_group.rounds[-1] # for the end of CWL current_war should give the last war
10251027
elif cwl_round is WarRound.previous_war and is_prep:
10261028
round_tags = league_group.rounds[-2]
10271029
elif cwl_round is WarRound.previous_war:
@@ -1038,6 +1040,11 @@ async def get_current_war(
10381040
async for war in self.get_league_wars(round_tags, cls=cls, **kwargs):
10391041
if war.clan_tag == clan_tag:
10401042
return war
1043+
elif war.opponent.tag == clan_tag:
1044+
tmp = war.clan
1045+
war.clan = war.opponent
1046+
war.opponent = tmp
1047+
return war
10411048

10421049
def get_current_wars(
10431050
self,

0 commit comments

Comments
 (0)