strat-gameplay-webapp/backend
Cal Corum 2b8fea36a8 CLAUDE: Redesign dice display with team colors and consolidate player cards
Backend:
- Add home_team_dice_color and away_team_dice_color to GameState model
- Extract dice_color from game metadata in StateManager (default: cc0000)
- Add runners_on_base param to roll_ab for chaos check skipping

Frontend - Dice Display:
- Create DiceShapes.vue with SVG d6 (square) and d20 (hexagon) shapes
- Apply home team's dice_color to d6 dice, white for resolution d20
- Show chaos d20 in amber only when WP/PB check triggered
- Add automatic text contrast based on color luminance
- Reduce blank space and remove info bubble from dice results

Frontend - Player Cards:
- Consolidate pitcher/batter cards to single location below diamond
- Add active card highlighting based on dice roll (d6_one: 1-3=batter, 4-6=pitcher)
- New card header format: [Team] Position [Name] with full card image
- Remove redundant card displays from GameBoard and GameplayPanel
- Enlarge PlayerCardModal on desktop (max-w-3xl at 1024px+)

Tests:
- Add DiceShapes.spec.ts with 34 tests for color calculations and rendering
- Update DiceRoller.spec.ts for new DiceShapes integration
- Fix test_roll_dice_success for new runners_on_base parameter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 00:16:32 -06:00
..
.claude CLAUDE: Add configurable regulation_innings and outs_per_inning 2025-11-19 20:06:57 -06:00
.git-hooks CLAUDE: Fix all unit test failures and implement 100% test requirement 2025-11-04 19:35:21 -06:00
alembic CLAUDE: RosterLink refactor for bench players with cached player data 2026-01-17 22:15:12 -06:00
app CLAUDE: Redesign dice display with team colors and consolidate player cards 2026-01-24 00:16:32 -06:00
scripts CLAUDE: Add test game creation utilities 2025-11-19 16:30:29 -06:00
terminal_client CLAUDE: Fix RunnerAdvancementData tuple unpacking regression 2025-11-28 23:11:26 -06:00
tests CLAUDE: Redesign dice display with team colors and consolidate player cards 2026-01-24 00:16:32 -06:00
.dockerignore CLAUDE: Fix Docker build for UV migration 2025-11-04 09:19:30 -06:00
.env.dev CLAUDE: Improve UX with single-click OAuth, enhanced games list, and layout fix 2025-12-05 16:14:00 -06:00
.env.example CLAUDE: Implement server-side OAuth flow with HttpOnly cookies 2025-11-26 22:16:30 -06:00
.env.prod CLAUDE: Improve UX with single-click OAuth, enhanced games list, and layout fix 2025-12-05 16:14:00 -06:00
.gitignore CLAUDE: Add pages/ to backend gitignore 2025-11-20 23:57:25 -06:00
alembic.ini CLAUDE: Add Alembic migrations and database session injection 2025-11-28 12:09:09 -06:00
CLAUDE.md CLAUDE: Add multi-domain environment configuration support 2025-12-03 13:58:42 -06:00
clean_test_data.py CLAUDE: Refactor game models and modularize terminal client 2025-10-28 14:16:38 -05:00
docker-compose.yml CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
Dockerfile CLAUDE: Add SBA schedule integration with weekly matchup display 2026-01-14 23:39:31 -06:00
mypy.ini CLAUDE: Refactor GameEngine to forward-looking play tracking pattern 2025-10-25 22:18:15 -05:00
pyproject.toml CLAUDE: Replace black and flake8 with ruff for formatting and linting 2025-11-20 15:33:21 -06:00
pyrightconfig.json Clean up false positive Pylance errors 2025-10-23 09:10:41 -05:00
pytest.ini CLAUDE: Complete Week 4 - State Management & Persistence 2025-10-22 12:01:03 -05:00
README.md CLAUDE: Update documentation across codebase 2025-11-28 12:10:10 -06:00
requirements-dev.txt CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
requirements.txt CLAUDE: Add interactive terminal client for game engine testing 2025-10-26 12:51:01 -05:00
TEST_COVERAGE_SUMMARY.md CLAUDE: Phase 2 test infrastructure + comprehensive documentation 2025-11-05 12:39:32 -06:00
test_db_playground.py Add scripts to test models in dev database 2025-10-23 09:10:55 -05:00
test_pd_api_live.py CLAUDE: Phase 3E-Main - Position Ratings Integration for X-Check Resolution 2025-11-03 21:00:37 -06:00
test_pd_api_mock.py CLAUDE: Phase 3E-Main - Position Ratings Integration for X-Check Resolution 2025-11-03 21:00:37 -06:00
test_redis_cache.py CLAUDE: Phase 3E-Final - Redis Caching & X-Check WebSocket Integration 2025-11-03 22:46:59 -06:00
uv.lock CLAUDE: Replace black and flake8 with ruff for formatting and linting 2025-11-20 15:33:21 -06:00

Paper Dynasty Backend

FastAPI-based real-time baseball game engine with WebSocket support.

Quick Start

# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install dependencies
uv sync

# Apply database migrations
uv run alembic upgrade head

# Run server
uv run python -m app.main

Database Migrations

This project uses Alembic for database schema migrations.

Initial Setup (New Database)

# Apply all migrations to create schema
uv run alembic upgrade head

Creating New Migrations

# Auto-generate from model changes
uv run alembic revision --autogenerate -m "Description of changes"

# IMPORTANT: Always review the generated migration before applying!
# Then apply:
uv run alembic upgrade head

Viewing Migration Status

# Show migration history
uv run alembic history

# Show current revision
uv run alembic current

Rolling Back

# Rollback one migration
uv run alembic downgrade -1

# Rollback to specific revision
uv run alembic downgrade 001

# Rollback all (dangerous!)
uv run alembic downgrade base

Migration Best Practices

  1. Always review auto-generated migrations before applying - autogenerate is helpful but not perfect
  2. Test migrations on dev/staging before production
  3. Keep migrations small and focused - easier to rollback
  4. Never edit migrations that have been applied to shared databases
  5. Include both upgrade and downgrade for reversibility

Existing Migrations

Revision Description
001 Initial schema (games, plays, lineups, rolls, etc.)
004 Materialized views for statistics

Documentation

See CLAUDE.md for full documentation.