Fix weekly freeze/thaw automation - API params not being sent

Root cause: league_service.update_current_state() was calling self.patch()
without use_query_params=True. The API expected query params but received
JSON body, so database updates for week/freeze silently failed.

Changes:
- Add use_query_params=True to league_service.py:99
- Fix service layer violation in transaction_freeze.py - now uses
  player_service.update_player_team() instead of direct API client
- Bump version to 2.25.8

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-01-13 14:00:54 -06:00
parent 023810538a
commit ee434c98f1
3 changed files with 9 additions and 15 deletions

View File

@ -1 +1 @@
2.25.7 2.25.8

View File

@ -96,7 +96,7 @@ class LeagueService(BaseService[Current]):
logger.debug(f"Updating current state id={current_id} (season {current.season})") logger.debug(f"Updating current state id={current_id} (season {current.season})")
# Use BaseService patch method # Use BaseService patch method
updated_current = await self.patch(current_id, update_data) updated_current = await self.patch(current_id, update_data, use_query_params=True)
if updated_current: if updated_current:
logger.info(f"Updated current state id={current_id}: {update_data}") logger.info(f"Updated current state id={current_id}: {update_data}")

View File

@ -13,6 +13,7 @@ from dataclasses import dataclass
import discord import discord
from discord.ext import commands, tasks from discord.ext import commands, tasks
from services import player_service
from services.league_service import league_service from services.league_service import league_service
from services.transaction_service import transaction_service from services.transaction_service import transaction_service
from services.standings_service import standings_service from services.standings_service import standings_service
@ -511,25 +512,18 @@ class TransactionFreezeTask:
""" """
try: try:
self.logger.info( self.logger.info(
f"Updating player roster", "Updating player roster",
player_id=player_id, player_id=player_id,
player_name=player_name, player_name=player_name,
new_team_id=new_team_id new_team_id=new_team_id
) )
# Get API client from transaction service updated_player = await player_service.update_player_team(player_id, new_team_id)
client = await transaction_service.get_client()
# Execute PATCH request to update player's team
response = await client.patch(
f'players/{player_id}',
params=[('team_id', str(new_team_id))]
)
# Verify response (200 or 204 indicates success) # Verify response (200 or 204 indicates success)
if response is not None: if updated_player is not None:
self.logger.info( self.logger.info(
f"Successfully updated player roster", "Successfully updated player",
player_id=player_id, player_id=player_id,
player_name=player_name, player_name=player_name,
new_team_id=new_team_id new_team_id=new_team_id
@ -537,7 +531,7 @@ class TransactionFreezeTask:
return True return True
else: else:
self.logger.warning( self.logger.warning(
f"Player update returned no response", "Player update returned no response",
player_id=player_id, player_id=player_id,
player_name=player_name, player_name=player_name,
new_team_id=new_team_id new_team_id=new_team_id
@ -546,7 +540,7 @@ class TransactionFreezeTask:
except Exception as e: except Exception as e:
self.logger.error( self.logger.error(
f"Failed to update player roster", "Failed to update player roster",
player_id=player_id, player_id=player_id,
player_name=player_name, player_name=player_name,
new_team_id=new_team_id, new_team_id=new_team_id,