From dc9269eeed63504de68786b6b5d2b54e4ebf090e Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sat, 4 Apr 2026 12:37:30 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20refractor=20card=20art=20post-merge=20fi?= =?UTF-8?q?xes=20=E2=80=94=20cache=20bypass,=20template=20guards,=20dev=20?= =?UTF-8?q?server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Skip PNG cache when ?tier= param is set to prevent serving stale T0 images - Move {% if %} guard before diamond_colors dict in player_card.html - Extract base #fullCard styles outside refractor conditional in tier_style.html - Make run-local.sh DB host configurable, clean up Playwright check Follow-up to PR #179 Co-Authored-By: Claude Opus 4.6 (1M context) --- app/routers_v2/players.py | 1 + run-local.sh | 16 ++++++++-------- storage/templates/player_card.html | 2 +- storage/templates/tier_style.html | 17 +++-------------- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/app/routers_v2/players.py b/app/routers_v2/players.py index 0f0d380..dc3b07b 100644 --- a/app/routers_v2/players.py +++ b/app/routers_v2/players.py @@ -757,6 +757,7 @@ async def get_batter_card( f"storage/cards/cardset-{this_player.cardset.id}/{card_type}/{player_id}-{d}-v{variant}.png" ) and html is False + and tier is None ): return FileResponse( path=f"storage/cards/cardset-{this_player.cardset.id}/{card_type}/{player_id}-{d}-v{variant}.png", diff --git a/run-local.sh b/run-local.sh index df7b0ad..63ff1e5 100755 --- a/run-local.sh +++ b/run-local.sh @@ -55,21 +55,21 @@ python -c "import fastapi, peewee, playwright" 2>/dev/null || { python -c " from playwright.sync_api import sync_playwright p = sync_playwright().start() -b = p.chromium.launch(args=['--no-sandbox']) -b.close() +print(p.chromium.executable_path) p.stop() -" 2>/dev/null || { +" >/dev/null 2>&1 || { echo "Playwright Chromium not installed. Run: playwright install chromium" exit 1 } # Check dev DB is reachable +DB_HOST="${POSTGRES_HOST_LOCAL:-10.10.0.42}" python -c " -import socket -s = socket.create_connection(('10.10.0.42', 5432), timeout=3) +import socket, sys +s = socket.create_connection((sys.argv[1], 5432), timeout=3) s.close() -" 2>/dev/null || { - echo "Cannot reach dev PostgreSQL at 10.10.0.42:5432 — is the homelab up?" +" "$DB_HOST" 2>/dev/null || { + echo "Cannot reach dev PostgreSQL at ${DB_HOST}:5432 — is the homelab up?" exit 1 } @@ -92,7 +92,7 @@ set +a # Override DB host to point at the dev server's IP (not Docker network name) export DATABASE_TYPE=postgresql -export POSTGRES_HOST="${POSTGRES_HOST_LOCAL:-10.10.0.42}" +export POSTGRES_HOST="$DB_HOST" export POSTGRES_PORT="${POSTGRES_PORT:-5432}" export POSTGRES_DB="${POSTGRES_DB:-paperdynasty_dev}" export POSTGRES_USER="${POSTGRES_USER:-sba_admin}" diff --git a/storage/templates/player_card.html b/storage/templates/player_card.html index 81f522b..89f43d5 100644 --- a/storage/templates/player_card.html +++ b/storage/templates/player_card.html @@ -6,13 +6,13 @@
+ {% if refractor_tier is defined and refractor_tier > 0 %} {%- set diamond_colors = { 1: {'color': '#1a6b1a', 'highlight': '#40b040'}, 2: {'color': '#2070b0', 'highlight': '#50a0e8'}, 3: {'color': '#a82020', 'highlight': '#e85050'}, 4: {'color': '#6b2d8e', 'highlight': '#a060d0'}, } -%} - {% if refractor_tier is defined and refractor_tier > 0 %} {%- set dc = diamond_colors[refractor_tier] -%} {%- set filled_bg = 'linear-gradient(135deg, ' ~ dc.highlight ~ ' 0%, ' ~ dc.color ~ ' 50%, ' ~ dc.color ~ ' 100%)' -%}
diff --git a/storage/templates/tier_style.html b/storage/templates/tier_style.html index 20201af..510f6ad 100644 --- a/storage/templates/tier_style.html +++ b/storage/templates/tier_style.html @@ -1,11 +1,11 @@ -{% if refractor_tier is defined and refractor_tier > 0 %} +{% if refractor_tier is defined and refractor_tier > 0 %} + -{% else %} - {% endif %} \ No newline at end of file