File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ def _from_data(self, data: dict) -> None:
420420 self .state : str = data_get ("state" )
421421 self .season : str = data_get ("season" )
422422
423- rounds = data_get ("rounds" )
423+ rounds = data_get ("rounds" , [] )
424424 self .number_of_rounds : int = len (rounds )
425425 # the API returns a list and the rounds that haven't started contain war tags of #0 (not sure why)...
426426 # we want to get only the valid rounds
You can’t perform that action at this time.
0 commit comments