Updated sheets values to match scorecard update

This commit is contained in:
Cal Corum 2023-08-29 13:56:37 -05:00
parent 8467f2e483
commit c42b62b4c2

View File

@ -1073,16 +1073,16 @@ class Players(commands.Cog):
# Get outline data from the sheet
await asyncio.sleep(1)
setup_tab = scorecard.worksheet_by_title('Setup')
g_data = setup_tab.get_values('M2', 'R3')
setup_vals = setup_tab.get_values('B7', 'R33')
at_abbrev = g_data[0][0]
ht_abbrev = g_data[1][0]
away_mgr_name = g_data[0][2]
home_mgr_name = g_data[1][2]
g_data = setup_tab.get_values('C3', 'D7')
# setup_vals = setup_tab.get_values('B7', 'R33')
week_num = g_data[1][0]
game_num = g_data[2][0]
at_abbrev = g_data[3][0]
ht_abbrev = g_data[4][0]
away_mgr_name = g_data[3][1]
home_mgr_name = g_data[4][1]
away_team = await get_team_by_abbrev(at_abbrev, current['season'])
home_team = await get_team_by_abbrev(ht_abbrev, current['season'])
week_num = g_data[0][5]
game_num = g_data[1][5]
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']
@ -1531,18 +1531,18 @@ class Players(commands.Cog):
await update.delete()
await interaction.edit_original_response(content='You are all set!')
try:
setup_tab.update_values(
crange=f'B7',
values=setup_vals
)
await interaction.edit_original_response(content='You are all set!')
except Exception as e:
logging.error(f'could not freeze sheet for game {this_game["id"]}')
await interaction.edit_original_response(
content='You didn\'t give me edit perms so I couldn\'t lock the rosters in your sheet, '
'but everything else went through.'
)
# try:
# setup_tab.update_values(
# crange=f'B7',
# values=setup_vals
# )
# await interaction.edit_original_response(content='You are all set!')
# except Exception as e:
# logging.error(f'could not freeze sheet for game {this_game["id"]}')
# await interaction.edit_original_response(
# content='You didn\'t give me edit perms so I couldn\'t lock the rosters in your sheet, '
# 'but everything else went through.'
# )
@app_commands.command(name='branding', description='Update your team branding')
@app_commands.guilds(discord.Object(id=os.environ.get('GUILD_ID')))