strat-gameplay-webapp/backend/app/models
Cal Corum dd1b087af1 CLAUDE: Fix double play bug after state recovery
Critical bug fix for issue where Groundball A with runner on first would
fail to execute a double play after game recovery from database.

Root cause: current_on_base_code field was not recalculated during state
recovery, defaulting to 0 (empty bases) even when runners were on base.
This caused runner advancement logic to select Result 1 (batter out,
runners hold) instead of Result 2 (double play).

Changes:
- Added calculate_on_base_code() helper method to GameState model
- Updated _prepare_next_play() to use helper (eliminates duplication)
- Fixed state recovery to calculate current_on_base_code from runners
- Fixed X-Check G1 mapping (was GROUNDBALL_B, should be GROUNDBALL_A)
- Added 5 regression tests to prevent recurrence

Testing:
- All 359 unit tests passing
- New regression tests verify fix and demonstrate bug scenario
- Tested in network dev environment - double plays now work correctly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 13:55:10 -06:00
..
__init__.py CLAUDE: Replace black and flake8 with ruff for formatting and linting 2025-11-20 15:33:21 -06:00
CLAUDE.md CLAUDE: Refactor backend CLAUDE.md files for conciseness 2025-11-19 16:10:08 -06:00
db_models.py CLAUDE: RosterLink refactor for bench players with cached player data 2026-01-17 22:15:12 -06:00
game_models.py CLAUDE: Fix double play bug after state recovery 2026-02-07 13:55:10 -06:00
player_model_info.md CLAUDE: Reorganize Week 6 documentation and separate player model specifications 2025-10-25 23:48:57 -05:00
player_models.py CLAUDE: Replace black and flake8 with ruff for formatting and linting 2025-11-20 15:33:21 -06:00
roster_models.py CLAUDE: RosterLink refactor for bench players with cached player data 2026-01-17 22:15:12 -06:00
visual_model_relationships.md CLAUDE: Refactor game models and modularize terminal client 2025-10-28 14:16:38 -05:00