paper-dynasty-database/app/services
Cal Corum 1b4eab9d99 refactor: replace incremental delta upserts with full recalculation in season stats
The previous approach accumulated per-game deltas into season stats rows,
which was fragile — partial processing corrupted stats, upsert bugs
compounded, and there was no self-healing mechanism.

Now update_season_stats() recomputes full season totals from all StratPlay
rows for each affected player whenever a game is processed. The result
replaces whatever was stored, eliminating double-counting and enabling
self-healing via force=True.

Also fixes:
- evolution_evaluator.py: broken PlayerSeasonStats import → queries
  BattingSeasonStats or PitchingSeasonStats based on card_type
- evolution_evaluator.py: r.k → r.strikeouts
- test_evolution_models.py, test_postgame_evolution.py: PlayerSeasonStats
  → BattingSeasonStats (model never existed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 10:17:13 -05:00
..
__init__.py feat: formula engine for evolution value computation (WP-09) 2026-03-12 19:34:40 -05:00
evolution_evaluator.py refactor: replace incremental delta upserts with full recalculation in season stats 2026-03-19 10:17:13 -05:00
evolution_init.py feat(WP-10): pack opening hook — evolution_card_state initialization 2026-03-18 13:41:05 -05:00
formula_engine.py fix: align tier_from_value with DB model field names (t1_threshold) 2026-03-18 15:07:07 -05:00
season_stats.py refactor: replace incremental delta upserts with full recalculation in season stats 2026-03-19 10:17:13 -05:00