Closes #202 Adds app/services/refractor_service.py with two service functions: - ensure_variant_cards: idempotent function that creates missing variant cards for all tiers up to a target, with partial failure handling and REFRACTOR_BOOST_ENABLED kill switch support. - evaluate_and_boost: combines evaluate_card(dry_run=True) with ensure_variant_cards so both tier computation and variant-card creation happen in one testable call without HTTP round-trips. Updates both router endpoints to use evaluate_and_boost: - POST /cards/{card_id}/evaluate now calls evaluate_and_boost instead of evaluate_card directly, which also fixes the broken variant creation on the manual evaluate path (variant cards are now created when a tier-up is detected, not just recorded). - POST /evaluate-game/{game_id} replaces ~55 lines of inline boost orchestration (boost_enabled flag, tier loop, partial failure tracking, card_type/track null checks) with a single evaluate_and_boost call. Response shape is unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| apng_generator.py | ||
| card_storage.py | ||
| formula_engine.py | ||
| refractor_boost.py | ||
| refractor_evaluator.py | ||
| refractor_init.py | ||
| refractor_service.py | ||
| season_stats.py | ||