Fixed patch current bug
This commit is contained in:
parent
ffae4e4018
commit
3eaf0bac70
@ -74,15 +74,17 @@ class Admins(commands.Cog):
|
|||||||
@commands.command(name='test', hidden=True)
|
@commands.command(name='test', hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def test_command(self, ctx):
|
async def test_command(self, ctx):
|
||||||
current = await get_current()
|
# week_num = f'Week {current["week"]}'
|
||||||
week_num = f'Week {current["week"]}'
|
# stars = f'{"":*<32}'
|
||||||
stars = f'{"":*<32}'
|
# freeze_message = f'```\n' \
|
||||||
freeze_message = f'```\n' \
|
# f'{stars}\n'\
|
||||||
f'{stars}\n'\
|
# f'{week_num: >9} Freeze Period Begins\n' \
|
||||||
f'{week_num: >9} Freeze Period Begins\n' \
|
# f'{stars}\n```'
|
||||||
f'{stars}\n```'
|
#
|
||||||
|
# await send_to_channel(self.bot, 'general', freeze_message)
|
||||||
|
|
||||||
await send_to_channel(self.bot, 'general', freeze_message)
|
current = await patch_current(freeze=False)
|
||||||
|
await ctx.send(f'Current: {current}')
|
||||||
|
|
||||||
@commands.command(name='sendmoves', help='Send moves to sheets')
|
@commands.command(name='sendmoves', help='Send moves to sheets')
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
|
|||||||
@ -178,7 +178,6 @@ async def get_current(season=None):
|
|||||||
async def patch_current(
|
async def patch_current(
|
||||||
week=None, freeze=None, season=None, transcount=None, bstatcount=None, pstatcount=None, bet_week=None,
|
week=None, freeze=None, season=None, transcount=None, bstatcount=None, pstatcount=None, bet_week=None,
|
||||||
trade_deadline=None, pick_trade_start=None, pick_trade_end=None, injury_count=None):
|
trade_deadline=None, pick_trade_start=None, pick_trade_end=None, injury_count=None):
|
||||||
current = await db_get('current')
|
|
||||||
params = []
|
params = []
|
||||||
if week is not None:
|
if week is not None:
|
||||||
params.append(('week', week))
|
params.append(('week', week))
|
||||||
@ -203,7 +202,12 @@ async def patch_current(
|
|||||||
if injury_count is not None:
|
if injury_count is not None:
|
||||||
params.append(('injury_count', injury_count))
|
params.append(('injury_count', injury_count))
|
||||||
|
|
||||||
return await db_patch('current', object_id=current['id'], params=params)
|
resp = requests.patch(get_req_url('current', params=params), data=None, headers=AUTH_TOKEN, timeout=3)
|
||||||
|
if resp.status_code == 200:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logging.warning(resp.text)
|
||||||
|
raise ValueError(f'DB: {resp.text}')
|
||||||
|
|
||||||
|
|
||||||
async def get_one_team(id_or_abbrev, season=None, is_pd=False, timeout=3):
|
async def get_one_team(id_or_abbrev, season=None, is_pd=False, timeout=3):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user