major-domo-database/app/routers_v3
Cal Corum 6d36704f35
Some checks failed
Build Docker Image / build (pull_request) Has been cancelled
fix: Prevent locals() from polluting player PATCH data dict
CRITICAL BUG FIX - Root cause of Player.data AttributeError

Problem:
The PATCH endpoint was calling locals() AFTER creating data = {}, causing
locals_dict to capture 'data' and 'locals_dict' as variables. The loop then
added these to the data dict itself, resulting in:
  data = {'team_id': 549, 'demotion_week': 7, 'data': {}, 'locals_dict': {...}}

When Peewee executed Player.update(**data), it tried to set Player.data = {},
but Player model has no 'data' field, causing AttributeError.

Solution:
1. Call locals() BEFORE creating data dict
2. Exclude 'locals_dict' from the filter (along with 'player_id', 'token')

This ensures only actual player field parameters are included in the update.

Version: 2.5.2 → 2.5.3

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 14:57:32 -06:00
..
__init__.py Initial commit 2023-03-21 16:09:46 -05:00
awards.py DB Error Handling 2025-08-20 19:33:40 -05:00
battingstats.py Postgres Query Updates 2025-08-25 07:19:13 -05:00
current.py DB Error Handling 2025-08-20 19:33:40 -05:00
custom_commands.py Fix delete endpoint using wrong key for creator_id 2026-01-28 16:07:05 -06:00
decisions.py DB Error Handling 2025-08-20 19:33:40 -05:00
divisions.py DB Error Handling 2025-08-20 19:33:40 -05:00
draftdata.py DB Error Handling 2025-08-20 19:33:40 -05:00
draftlist.py Update caching rules & Add DELETE /draftlist 2025-10-25 20:15:56 -05:00
draftpicks.py DB Error Handling 2025-08-20 19:33:40 -05:00
fieldingstats.py Postgres Query Updates 2025-08-25 07:19:13 -05:00
help_commands.py Added HelpCommands 2025-10-17 16:36:40 -05:00
injuries.py DB Error Handling 2025-08-20 19:33:40 -05:00
keepers.py DB Error Handling 2025-08-20 19:33:40 -05:00
managers.py DB Error Handling 2025-08-20 19:33:40 -05:00
pitchingstats.py Postgres Query Updates 2025-08-25 07:19:13 -05:00
players.py fix: Prevent locals() from polluting player PATCH data dict 2026-02-04 14:57:32 -06:00
results.py DB Error Handling 2025-08-20 19:33:40 -05:00
sbaplayers.py DB Error Handling 2025-08-20 19:33:40 -05:00
schedules.py DB Error Handling 2025-08-20 19:33:40 -05:00
standings.py DB Error Handling 2025-08-20 19:33:40 -05:00
stratgame.py Added SeasonPitchingStats 2025-08-26 00:17:57 -05:00
stratplay.py Pitcher decision bug fixed 2025-10-27 14:57:14 -05:00
teams.py fix: Fix CSV export, season filtering, and position matching in refactored services 2026-02-04 11:06:58 -06:00
transactions.py DB Error Handling 2025-08-20 19:33:40 -05:00
views.py Add Redis Caching 2025-08-27 22:49:37 -05:00