Update standings command

This commit is contained in:
Cal Corum 2023-08-11 09:31:53 -05:00
parent f1e0fc18f6
commit dc1146e9e9

View File

@ -208,11 +208,11 @@ class Players(commands.Cog):
winpct = f'{0:.3f}' winpct = f'{0:.3f}'
else: else:
winpct = f'{stan["wins"] / (stan["wins"] + stan["losses"]):.3f}' winpct = f'{stan["wins"] / (stan["wins"] + stan["losses"]):.3f}'
team_string = f'{stan["team"]["abbrev"]: <4} {stan["wins"]: >2}-{stan["losses"]: <2} {winpct} ' team_string = f'{stan["team"]["abbrev"]: <4} {stan["wins"]: >2}-{stan["losses"]: <2} {winpct} '
if s_type == 'div': if s_type == 'div':
if stan["div_gb"] < 0: if stan["div_gb"] is None:
gb = stan["div_gb"] if stan["div_gb"] >= 0.0 else f'+{stan["div_gb"] * -1}' gb = '--'
else: else:
gb = stan["div_gb"] gb = stan["div_gb"]
team_string += f'{gb: >5}' team_string += f'{gb: >5}'
@ -227,14 +227,14 @@ class Players(commands.Cog):
# This is a division leader - return nothing and continue # This is a division leader - return nothing and continue
return '' return ''
else: else:
gb = stan["wc_gb"] if stan["wc_gb"] >= 0.0 else f'+{stan["wc_gb"] * -1}' gb = stan["wc_gb"] if stan["wc_gb"] >= 0.0 else f'--'
if stan["wc_e_num"]: if stan["wc_e_num"]:
e_num = stan["wc_e_num"] e_num = stan["wc_e_num"]
elif stan["wc_e_num"] == 0: elif stan["wc_e_num"] == 0:
e_num = 'E' e_num = 'E'
else: else:
e_num = '--' e_num = '--'
team_string += f'{gb: >5} {e_num: >2} ' team_string += f'{gb: >4} {e_num: >2} '
team_string += f'{stan["run_diff"]: >4}\n' team_string += f'{stan["run_diff"]: >4}\n'
@ -766,22 +766,22 @@ class Players(commands.Cog):
]) ])
div_four = d4_query['standings'] div_four = d4_query['standings']
div_one_standings = f'```\nTeam W-L PCT GB E# RD\n' div_one_standings = f'```\nTeam W-L PCT GB E# RD\n'
for team in div_one: for team in div_one:
div_one_standings += self.team_stan_line(team) div_one_standings += self.team_stan_line(team)
div_one_standings += f'\n```' div_one_standings += f'\n```'
div_two_standings = f'```\nTeam W-L PCT GB E# RD\n' div_two_standings = f'```\nTeam W-L PCT GB E# RD\n'
for team in div_two: for team in div_two:
div_two_standings += self.team_stan_line(team) div_two_standings += self.team_stan_line(team)
div_two_standings += f'\n```' div_two_standings += f'\n```'
div_three_standings = f'```\nTeam W-L PCT GB E# RD\n' div_three_standings = f'```\nTeam W-L PCT GB E# RD\n'
for team in div_three: for team in div_three:
div_three_standings += self.team_stan_line(team) div_three_standings += self.team_stan_line(team)
div_three_standings += f'\n```' div_three_standings += f'\n```'
div_four_standings = f'```\nTeam W-L PCT GB E# RD\n' div_four_standings = f'```\nTeam W-L PCT GB E# RD\n'
for team in div_four: for team in div_four:
div_four_standings += self.team_stan_line(team) div_four_standings += self.team_stan_line(team)
div_four_standings += f'\n```' div_four_standings += f'\n```'
@ -809,7 +809,7 @@ class Players(commands.Cog):
# ]) # ])
# nl_teams = n_query['standings'] # nl_teams = n_query['standings']
al_wildcard = f'```\nTeam W-L PCT GB E# RD\n' al_wildcard = f'```\nTeam W-L PCT GB E# RD\n'
for team in al_teams: for team in al_teams:
al_wildcard += self.team_stan_line(team, s_type='wc') al_wildcard += self.team_stan_line(team, s_type='wc')
al_wildcard += '```' al_wildcard += '```'