changed some language to be more clear about what tournament rounds mean what

This commit is contained in:
Sakimori 2021-01-15 06:18:29 -05:00
parent 80aaa086fb
commit 780ca4b3bf
2 changed files with 12 additions and 9 deletions

View File

@ -318,12 +318,11 @@ class league_structure(object):
for this_team, wins, losses, diff, gb in division_leaders + wildcard_leaders: for this_team, wins, losses, diff, gb in division_leaders + wildcard_leaders:
team_dic[this_team] = {"wins" : wins} 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.build_bracket(by_wins = True)
subleague_tournament.league = self subleague_tournament.league = self
tournaments.append(subleague_tournament) tournaments.append(subleague_tournament)
tournaments[0].increment = True
return tournaments return tournaments
@ -343,7 +342,7 @@ class tournament(object):
self.id = id self.id = id
self.league = None self.league = None
self.winner = None self.winner = None
self.increment = False self.day = None
if id is None: if id is None:
self.id = random.randint(1111,9999) self.id = random.randint(1111,9999)

View File

@ -1192,8 +1192,10 @@ async def start_tournament_round(channel, tourney, seeding = None):
team_b = get_team_fuzzy_search(pair[1].name) team_b = get_team_fuzzy_search(pair[1].name)
if tourney.league is not None: if tourney.league is not None:
team_a.set_pitcher(rotation_slot = tourney.league.day) if tourney.day is None:
team_b.set_pitcher(rotation_slot = tourney.league.day) 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 = games.game(team_a.finalize(), team_b.finalize(), length = tourney.game_length)
this_game, state_init = prepare_game(this_game) 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) home_team = games.get_team(oldgame.teams["home"].name)
if tourney.league is not None: 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) away_team.set_pitcher(rotation_slot = tourney.league.day)
home_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: except:
print("something went wrong in tourney_watcher") print("something went wrong in tourney_watcher")
await asyncio.sleep(4) await asyncio.sleep(4)
if tourney.league is not None and tourney.increment: if tourney.league is not None:
tourney.league.day += 1 tourney.day += 1
if len(queued_games) > 0: 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 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!") 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) await channel.send(embed=embed)
tourney.winner = get_team_fuzzy_search(winner_list[0]) tourney.winner = get_team_fuzzy_search(winner_list[0])
active_tournaments.pop(active_tournaments.index(tourney)) active_tournaments.pop(active_tournaments.index(tourney))
@ -1856,7 +1862,6 @@ async def league_postseason(channel, league):
tiebreakers = league.tiebreaker_required() tiebreakers = league.tiebreaker_required()
if tiebreakers != []: if tiebreakers != []:
await channel.send("Tiebreakers required!") await channel.send("Tiebreakers required!")
tiebreakers[0].increment = True
await asyncio.gather(*[start_tournament_round(channel, tourney) for tourney in tiebreakers]) await asyncio.gather(*[start_tournament_round(channel, tourney) for tourney in tiebreakers])
for tourney in tiebreakers: for tourney in tiebreakers:
league.update_standings({tourney.winner.name : {"wins" : 1}}) league.update_standings({tourney.winner.name : {"wins" : 1}})
@ -1886,7 +1891,6 @@ async def league_postseason(channel, league):
tourneys = league.champ_series() tourneys = league.champ_series()
tourneys[0].increment = True
await asyncio.gather(*[start_tournament_round(channel, tourney) for tourney in tourneys]) await asyncio.gather(*[start_tournament_round(channel, tourney) for tourney in tourneys])
champs = {} champs = {}
for tourney in tourneys: for tourney in tourneys: