From 780ca4b3bfc4b4808d26eae64d60f2553f4386ae Mon Sep 17 00:00:00 2001 From: Sakimori Date: Fri, 15 Jan 2021 06:18:29 -0500 Subject: [PATCH] changed some language to be more clear about what tournament rounds mean what --- leagues.py | 5 ++--- the_prestige.py | 16 ++++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/leagues.py b/leagues.py index 307497e..20c8b07 100644 --- a/leagues.py +++ b/leagues.py @@ -318,12 +318,11 @@ class league_structure(object): for this_team, wins, losses, diff, gb in division_leaders + wildcard_leaders: team_dic[this_team] = {"wins" : wins} - subleague_tournament = tournament(f"{self.name} {subleague} Championship Series", team_dic, series_length=3, finals_series_length=5, secs_between_games=int(3600/self.games_per_hour), secs_between_rounds=int(7200/self.games_per_hour)) + subleague_tournament = tournament(f"{self.name} {subleague} Subleague Series", team_dic, series_length=3, finals_series_length=5, secs_between_games=int(3600/self.games_per_hour), secs_between_rounds=int(7200/self.games_per_hour)) subleague_tournament.build_bracket(by_wins = True) subleague_tournament.league = self tournaments.append(subleague_tournament) - tournaments[0].increment = True return tournaments @@ -343,7 +342,7 @@ class tournament(object): self.id = id self.league = None self.winner = None - self.increment = False + self.day = None if id is None: self.id = random.randint(1111,9999) diff --git a/the_prestige.py b/the_prestige.py index 1295815..3229aa4 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -1192,8 +1192,10 @@ async def start_tournament_round(channel, tourney, seeding = None): team_b = get_team_fuzzy_search(pair[1].name) if tourney.league is not None: - team_a.set_pitcher(rotation_slot = tourney.league.day) - team_b.set_pitcher(rotation_slot = tourney.league.day) + if tourney.day is None: + tourney.day = tourney.league.day + team_a.set_pitcher(rotation_slot = tourney.day) + team_b.set_pitcher(rotation_slot = tourney.day) this_game = games.game(team_a.finalize(), team_b.finalize(), length = tourney.game_length) this_game, state_init = prepare_game(this_game) @@ -1228,6 +1230,8 @@ async def continue_tournament_series(tourney, queue, games_list, wins_in_series) home_team = games.get_team(oldgame.teams["home"].name) if tourney.league is not None: + if tourney.day is None: + tourney.day = tourney.league.day away_team.set_pitcher(rotation_slot = tourney.league.day) home_team.set_pitcher(rotation_slot = tourney.league.day) @@ -1292,8 +1296,8 @@ async def tourney_round_watcher(channel, tourney, games_list, filter_url, finals except: print("something went wrong in tourney_watcher") await asyncio.sleep(4) - if tourney.league is not None and tourney.increment: - tourney.league.day += 1 + if tourney.league is not None: + tourney.day += 1 if len(queued_games) > 0: @@ -1329,6 +1333,8 @@ async def tourney_round_watcher(channel, tourney, games_list, filter_url, finals if finals: #if this last round was finals embed = discord.Embed(color = discord.Color.dark_purple(), title = f"{winner_list[0]} win the {tourney.name} finals!") + if tourney.day > tourney.league.day: + tourney.league.day = tourney.day await channel.send(embed=embed) tourney.winner = get_team_fuzzy_search(winner_list[0]) active_tournaments.pop(active_tournaments.index(tourney)) @@ -1856,7 +1862,6 @@ async def league_postseason(channel, league): tiebreakers = league.tiebreaker_required() if tiebreakers != []: await channel.send("Tiebreakers required!") - tiebreakers[0].increment = True await asyncio.gather(*[start_tournament_round(channel, tourney) for tourney in tiebreakers]) for tourney in tiebreakers: league.update_standings({tourney.winner.name : {"wins" : 1}}) @@ -1886,7 +1891,6 @@ async def league_postseason(channel, league): tourneys = league.champ_series() - tourneys[0].increment = True await asyncio.gather(*[start_tournament_round(channel, tourney) for tourney in tourneys]) champs = {} for tourney in tourneys: