Paper Dynasty Database - PostgreSQL database service
Go to file
Cal Corum e8b1091d8a refactor: extract evaluate-game business logic from router to service layer (#202)
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>
2026-04-08 00:37:26 -05:00
.gitea/workflows ci: switch buildx cache from registry to local volume 2026-03-24 00:15:38 -05:00
.githooks fix: address review feedback (#181) 2026-04-04 23:03:06 -05:00
app refactor: extract evaluate-game business logic from router to service layer (#202) 2026-04-08 00:37:26 -05:00
docs Remove deprecated legacy files and reorganize documentation 2026-02-05 13:34:09 -06:00
migrations chore: remove unused RefractorTierBoost and RefractorCosmetic tables 2026-04-05 22:27:26 -05:00
scripts fix: address PR review — unknown flag guard, local var scope, container map 2026-04-07 20:32:12 -05:00
storage/templates fix: improve diamond tier indicator visibility 2026-04-07 08:47:24 -05:00
tests fix: address review feedback (#187) 2026-04-06 20:03:02 -05:00
.dockerignore Add .dockerignore 2026-01-30 22:47:07 -06:00
.env fix: correct inverted TESTING env check and leading space in .env (#23) 2026-03-03 21:43:54 +00:00
.env.example CLAUDE: Add .env.example with comprehensive configuration guide 2025-11-07 11:53:23 -06:00
.gitignore fix: visual tuning from live preview — diamond position, borders, corners, header z-index 2026-04-04 11:20:05 -05:00
CLAUDE.md docs: fix dev PostgreSQL container/db/user in CLAUDE.md 2026-04-07 03:15:21 +00:00
compose.production.yml Add production deployment config and fix stringified list parsing 2026-01-30 14:03:07 -06:00
docker-compose.yml CLAUDE: Comment out API service - prevents race condition in db_engine.py 2025-11-07 14:07:13 -06:00
Dockerfile fix: correct COPY path and add CMD in Dockerfile 2026-03-17 20:09:04 +00:00
LICENSE Initial commit 2023-02-19 21:38:07 -06:00
pyproject.toml feat: Track Catalog API endpoints (WP-06) (#71) 2026-03-12 20:40:38 -05:00
requirements.txt fix: correct apng version pin (0.3.4, not 3.1.1) 2026-04-06 23:23:48 -05:00
ruff.toml fix: address PR review findings 2026-03-17 21:38:12 -05:00
run-local.sh fix: refractor card art post-merge fixes — cache bypass, template guards, dev server 2026-04-04 12:37:30 -05:00
VERSION Bump version to 1.5.5 2026-02-04 08:48:12 -06:00