WP-08: Evaluate Endpoint #73
Labels
No Label
ai-changes-requested
ai-failed
ai-merged
ai-pr-opened
ai-reviewed
ai-reviewing
ai-reviewing
ai-working
bug
enhancement
evolution
performance
phase-0
phase-1a
phase-1b
phase-1c
phase-1d
security
tech-debt
todo
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#73
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
POST /v2/evolution/cards/{card_id}/evaluate— force-recalculates a card's evolution state from career totals (SUM across allplayer_season_statsrows for the player-team pair). Idempotent re-evaluation entry point for post-game callback and admin corrections.Repo:
databasePhase: 1b (API & Formula Engine)
Dependencies: WP-07, WP-05
Complexity: M
Evaluation Logic
player_season_statsrows for (player_id, team_id) across all seasonscard_state.track_idnew_tiercard_state.current_value = computed valuecard_state.current_tier = max(current_tier, new_tier)— no regressioncard_state.fully_evolved = (new_tier >= 4)card_state.last_evaluated_at = NOW()Files
database/app/services/evolution_evaluator.pydatabase/app/routers_v2/evolution.pyTests (write first in
database/tests/test_evolution_evaluator.py)Plan reference:
docs/prd-evolution/PHASE1_PROJECT_PLAN.mdWP-08PR #98 opened: #98
Implemented
POST /api/v2/evolution/cards/{card_id}/evaluatewith:app/services/evolution_evaluator.py:evaluate_card(player_id, team_id)— sums career stats, computes tier via formula engine, updates card state with no-regression guaranteeapp/routers_v2/evolution.py: endpoint resolves card_id → player/team via Card lookup, returns updated state dicttests/test_evolution_evaluator.py: 15 unit tests (all pass) covering tier assignment, advancement, partial progress, idempotency, fully_evolved, no-regression, multi-season aggregation, missing state errorModels and formula engine are lazily imported so this is safely importable before WP-01/WP-05/WP-07/WP-09 merge.