Update players.py
Remove old logic & fix manager bug
This commit is contained in:
parent
93688ca33c
commit
72d7180942
@ -1082,11 +1082,12 @@ class Players(commands.Cog):
|
||||
home_team = await get_team_by_abbrev(ht_abbrev, current['season'])
|
||||
week_num = g_data[0][5]
|
||||
game_num = g_data[1][5]
|
||||
if away_team['manager2'] is not None and away_team['manager2']['name'].lower() == away_mgr_name:
|
||||
logging.info(f'away_manager: {away_mgr_name} / home_manager: {home_mgr_name}')
|
||||
if away_team['manager2'] is not None and away_team['manager2']['name'].lower() == away_mgr_name.lower():
|
||||
away_manager = away_team['manager2']
|
||||
else:
|
||||
away_manager = away_team['manager1']
|
||||
if home_team['manager2'] is not None and home_team['manager2']['name'].lower() == home_mgr_name:
|
||||
if home_team['manager2'] is not None and home_team['manager2']['name'].lower() == home_mgr_name.lower():
|
||||
home_manager = home_team['manager2']
|
||||
else:
|
||||
home_manager = home_team['manager1']
|
||||
@ -1146,73 +1147,6 @@ class Players(commands.Cog):
|
||||
# TODO: check for stats and wipe
|
||||
logging.info(f'checking for old stats')
|
||||
|
||||
# if len(old_home_bat) + len(old_away_bat) + len(old_home_arm) + len(old_away_arm) > 0:
|
||||
# view = Confirm(responders=[interaction.user])
|
||||
# question = await interaction.channel.send(
|
||||
# f'I already see stats for {away_team["abbrev"]} @ {home_team["abbrev"]} week {week_num} game '
|
||||
# f'{game_num}. Would you like me to remove those and update with this card?',
|
||||
# view=view
|
||||
# )
|
||||
# await view.wait()
|
||||
#
|
||||
# if view.value:
|
||||
# logging.info(f'sba-submit - view.value')
|
||||
# this_game = {
|
||||
# 'season': current['season'],
|
||||
# 'week': week_num,
|
||||
# 'game_num': game_num,
|
||||
# 'away_team_id': away_team['id'],
|
||||
# 'home_team_id': home_team['id']
|
||||
# }
|
||||
#
|
||||
# await question.edit(
|
||||
# content='What a pain in my balls. Let\'s start by deleting the batting stats...',
|
||||
# view=None
|
||||
# )
|
||||
# if await delete_battingstats(this_game):
|
||||
# await question.edit(content='Batting stats are gone - now the pitching stats...')
|
||||
#
|
||||
# if await delete_pitchingstats(this_game):
|
||||
# await question.edit(
|
||||
# content='Pitching stats are gone - now to recalculate everybody\'s season batting lines...'
|
||||
# )
|
||||
#
|
||||
# if await recalc_batting_seasons(current['season'], away_team['id']):
|
||||
# if await recalc_batting_seasons(current['season'], home_team['id']):
|
||||
# await question.edit(
|
||||
# content='Batting lines are done - now to recalculate pitching lines...'
|
||||
# )
|
||||
#
|
||||
# if await recalc_pitching_seasons(current['season'], away_team['id']):
|
||||
# if await recalc_pitching_seasons(current['season'], home_team['id']):
|
||||
# await question.edit(
|
||||
# content='Pitching lines are done - now to recalculate fielding lines...'
|
||||
# )
|
||||
#
|
||||
# if await recalc_fielding_seasons(current['season'], away_team['id']):
|
||||
# if await recalc_fielding_seasons(current['season'], home_team['id']):
|
||||
# await question.edit(
|
||||
# content=f'All done. Don\'t suck next time '
|
||||
# f'{await get_emoji(interaction.guild, "lakemonsters")}'
|
||||
# )
|
||||
#
|
||||
# week_games = await get_results(
|
||||
# current['season'], away_abbrev=away_team['abbrev'], home_abbrev=home_team['abbrev'], week=week_num
|
||||
# )
|
||||
# this_game = None
|
||||
# for x in week_games:
|
||||
# if week_games[x]['game'] == game_num:
|
||||
# this_game = week_games[x]
|
||||
# break
|
||||
# if this_game:
|
||||
# await db_delete('results', object_id=this_game['id'])
|
||||
#
|
||||
# else:
|
||||
# logging.info(f'sba-submit - view.value "else"')
|
||||
# await interaction.channel.send('Alright, we\'ll call it a day here.')
|
||||
# return
|
||||
|
||||
# Read scorecard
|
||||
await interaction.edit_original_response(content='Here I go sheetsing again...', view=None)
|
||||
logging.info(f'sba-submit - reading scorecard')
|
||||
playtable = scorecard.worksheet_by_title('Playtable')
|
||||
@ -1223,7 +1157,7 @@ class Players(commands.Cog):
|
||||
'play_num', 'batter_id', 'batter_pos', 'pitcher_id', 'on_base_code', 'inning_half', 'inning_num',
|
||||
'batting_order', 'starting_outs', 'away_score', 'home_score', 'on_first_id', 'on_first_final',
|
||||
'on_second_id', 'on_second_final', 'on_third_id', 'on_third_final', 'batter_final', 'pa', 'ab', 'run',
|
||||
'pitcher_earned_run', 'hit', 'rbi', 'double', 'triple', 'homerun', 'bb', 'so', 'hbp', 'sac', 'ibb', 'gidp',
|
||||
'e_run', 'hit', 'rbi', 'double', 'triple', 'homerun', 'bb', 'so', 'hbp', 'sac', 'ibb', 'gidp',
|
||||
'bphr', 'bpfo', 'bp1b', 'bplo', 'sb', 'cs', 'outs', 'pitcher_rest_outs', 'wpa', 'catcher_id', 'defender_id',
|
||||
'runner_id', 'check_pos', 'error', 'wild_pitch', 'passed_ball', 'pick_off', 'balk', 'is_go_ahead',
|
||||
'is_tied', 'is_new_inning', 'inherited_runners', 'inherited_scored', 'on_hook_for_loss', 'run_differential'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user