Implement !standings for s8
This commit is contained in:
parent
72d7180942
commit
bb6cc8ee84
@ -242,18 +242,20 @@ class Players(commands.Cog):
|
||||
|
||||
@staticmethod
|
||||
async def game_progress(current):
|
||||
s_query = await db_get('schedules', params=[
|
||||
('season', current['season']), ('week_start', current['week']), ('week_end', current['week'])
|
||||
# s_query = await db_get('schedules', params=[
|
||||
# ('season', current['season']), ('week_start', current['week']), ('week_end', current['week'])
|
||||
# ])
|
||||
# r_query = await db_get('results', params=[
|
||||
# ('season', current['season']), ('week_start', current['week']), ('week_end', current['week'])
|
||||
# ])
|
||||
gp_query = await db_get('games', params=[
|
||||
('season', current['season']), ('week', current['week']), ('played', True)
|
||||
])
|
||||
r_query = await db_get('results', params=[
|
||||
('season', current['season']), ('week_start', current['week']), ('week_end', current['week'])
|
||||
all_query = await db_get('games', params=[
|
||||
('season', current['season']), ('week', current['week'])
|
||||
])
|
||||
|
||||
game_count = 0
|
||||
for x in s_query['schedules']:
|
||||
game_count += x['gamecount']
|
||||
|
||||
return {'games_played': r_query['count'], 'game_count': game_count}
|
||||
return {'games_played': gp_query['count'], 'game_count': all_query['count']}
|
||||
|
||||
@commands.Cog.listener(name='on_message')
|
||||
async def on_message_listener(self, message):
|
||||
@ -748,19 +750,19 @@ class Players(commands.Cog):
|
||||
|
||||
async def get_division_standings(self, current) -> discord.Embed:
|
||||
d1_query = await db_get('standings', params=[
|
||||
('season', current['season']), ('league_abbrev', 'al'), ('division_abbrev', 'e')
|
||||
('season', current['season']), ('division_abbrev', 'FD')
|
||||
])
|
||||
div_one = d1_query['standings']
|
||||
d2_query = await db_get('standings', params=[
|
||||
('season', current['season']), ('league_abbrev', 'al'), ('division_abbrev', 'w')
|
||||
('season', current['season']), ('division_abbrev', 'NLW')
|
||||
])
|
||||
div_two = d2_query['standings']
|
||||
d3_query = await db_get('standings', params=[
|
||||
('season', current['season']), ('league_abbrev', 'nl'), ('division_abbrev', 'e')
|
||||
('season', current['season']), ('division_abbrev', 'IWGP')
|
||||
])
|
||||
div_three = d3_query['standings']
|
||||
d4_query = await db_get('standings', params=[
|
||||
('season', current['season']), ('league_abbrev', 'nl'), ('division_abbrev', 'w')
|
||||
('season', current['season']), ('division_abbrev', 'BAL')
|
||||
])
|
||||
div_four = d4_query['standings']
|
||||
|
||||
@ -790,32 +792,32 @@ class Players(commands.Cog):
|
||||
f'{progress["games_played"]}/{progress["game_count"]} games played',
|
||||
color=0xB70000)
|
||||
embed.add_field(name=f'**Full Standings**', value=SBA_STANDINGS_URL, inline=False)
|
||||
embed.add_field(name=f'**AL East**', value=div_one_standings, inline=False)
|
||||
embed.add_field(name=f'**AL West**', value=div_two_standings, inline=False)
|
||||
embed.add_field(name=f'**NL East**', value=div_three_standings, inline=False)
|
||||
embed.add_field(name=f'**NL West**', value=div_four_standings, inline=False)
|
||||
embed.add_field(name=f'**Fun Diff**', value=div_one_standings, inline=False)
|
||||
embed.add_field(name=f'**NL West**', value=div_two_standings, inline=False)
|
||||
embed.add_field(name=f'**IWGP**', value=div_three_standings, inline=False)
|
||||
embed.add_field(name=f'**Crabbers**', value=div_four_standings, inline=False)
|
||||
|
||||
return embed
|
||||
|
||||
async def get_wildcard_standings(self, current) -> discord.Embed:
|
||||
a_query = await db_get('standings', params=[
|
||||
('season', current['season']), ('league_abbrev', 'al')
|
||||
('season', current['season']), ('league_abbrev', 'SBa')
|
||||
])
|
||||
al_teams = a_query['standings']
|
||||
n_query = await db_get('standings', params=[
|
||||
('season', current['season']), ('league_abbrev', 'nl')
|
||||
])
|
||||
nl_teams = n_query['standings']
|
||||
# n_query = await db_get('standings', params=[
|
||||
# ('season', current['season']), ('league_abbrev', 'nl')
|
||||
# ])
|
||||
# nl_teams = n_query['standings']
|
||||
|
||||
al_wildcard = f'```\nTeam W-L PCT GB E# RD\n'
|
||||
for team in al_teams:
|
||||
al_wildcard += self.team_stan_line(team, s_type='wc')
|
||||
al_wildcard += '```'
|
||||
|
||||
nl_wildcard = f'```\nTeam W-L PCT GB E# RD\n'
|
||||
for team in nl_teams:
|
||||
nl_wildcard += self.team_stan_line(team, s_type='wc')
|
||||
nl_wildcard += '```'
|
||||
# nl_wildcard = f'```\nTeam W-L PCT GB E# RD\n'
|
||||
# for team in nl_teams:
|
||||
# nl_wildcard += self.team_stan_line(team, s_type='wc')
|
||||
# nl_wildcard += '```'
|
||||
|
||||
progress = await self.game_progress(current)
|
||||
|
||||
@ -824,7 +826,7 @@ class Players(commands.Cog):
|
||||
color=0xB70000)
|
||||
embed.add_field(name=f'**Full Standings**', value=SBA_STANDINGS_URL, inline=False)
|
||||
embed.add_field(name=f'**AL Wildcard**', value=al_wildcard, inline=False)
|
||||
embed.add_field(name=f'**NL Wildcard**', value=nl_wildcard, inline=False)
|
||||
# embed.add_field(name=f'**NL Wildcard**', value=nl_wildcard, inline=False)
|
||||
|
||||
return embed
|
||||
|
||||
|
||||
@ -470,7 +470,7 @@ class Transactions(commands.Cog):
|
||||
new_team = move['newteam']
|
||||
# team_record = await get_team_record(new_team, week_num=current["week"])
|
||||
r_query = await db_get('standings', params=[
|
||||
('season', current['season']), ('team_abbrev', new_team['abbrev'])
|
||||
('season', current['season']), ('team_id', new_team['id'])
|
||||
])
|
||||
win_pct = r_query['standings'][0]['wins'] / (
|
||||
r_query['standings'][0]['wins'] + r_query['standings'][0]['losses'])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user