paper-dynasty-database/app/services
Cal Corum b151923480 feat(WP-13): post-game callback endpoints for season stats and evolution
Implements two new API endpoints the bot calls after a game completes:

  POST /api/v2/season-stats/update-game/{game_id}
    Delegates to update_season_stats() service (WP-05). Returns
    {"updated": N, "skipped": bool} with idempotency via ProcessedGame ledger.

  POST /api/v2/evolution/evaluate-game/{game_id}
    Finds all (player_id, team_id) pairs from the game's StratPlay rows,
    calls evaluate_card() for each pair that has an EvolutionCardState,
    and returns {"evaluated": N, "tier_ups": [...]} with full tier-up detail.

New files:
  app/services/evolution_evaluator.py — evaluate_card() service (WP-08)
  tests/test_postgame_evolution.py    — 10 integration tests (all pass)

Modified files:
  app/routers_v2/season_stats.py — rewritten to delegate to the service
  app/routers_v2/evolution.py    — evaluate-game endpoint added
  app/main.py                    — season_stats router registered

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 15:50:36 -05:00
..
__init__.py feat: formula engine for evolution value computation (WP-09) 2026-03-12 19:34:40 -05:00
evolution_evaluator.py feat(WP-13): post-game callback endpoints for season stats and evolution 2026-03-18 15:50:36 -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 fix: address PR #104 review feedback 2026-03-18 00:04:04 -05:00