fix: Respect short_output parameter in player search endpoint
Some checks failed
Build Docker Image / build (pull_request) Failing after 15s

The search_players() method was hardcoding short_output=True when
converting query results to dicts, ignoring the function parameter.
This caused the /api/v3/players/search endpoint to always return
team_id as an integer instead of nested team objects, even when
short_output=False was specified.

Impact:
- Discord bot's /injury clear command was crashing because
  player.team was None (only team_id was populated)
- Any code using search endpoint couldn't get full team data

Fix:
- Changed line 386 to use the short_output parameter value
- Now respects short_output parameter: False returns full team
  objects, True returns just team IDs

Root cause analysis from production logs:
- Error: AttributeError: 'NoneType' object has no attribute 'roster_type'
- Location: commands/injuries/management.py:647
- Cause: player.team was None after search_players() call

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-02-05 19:43:50 -06:00
parent 92e3517225
commit 39bc99b0dd

View File

@ -383,7 +383,7 @@ class PlayerService(BaseService):
# Convert to dicts if needed
all_player_dicts = cls._query_to_player_dicts(
InMemoryQueryResult(all_players), short_output=True
InMemoryQueryResult(all_players), short_output=short_output
)
# Sort by relevance (exact matches first)