fix: refractor card art post-merge fixes — cache bypass, template guards, dev server

- 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) <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-04-04 12:37:30 -05:00
parent 3e84a06b23
commit dc9269eeed
4 changed files with 13 additions and 23 deletions

View File

@ -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" f"storage/cards/cardset-{this_player.cardset.id}/{card_type}/{player_id}-{d}-v{variant}.png"
) )
and html is False and html is False
and tier is None
): ):
return FileResponse( return FileResponse(
path=f"storage/cards/cardset-{this_player.cardset.id}/{card_type}/{player_id}-{d}-v{variant}.png", path=f"storage/cards/cardset-{this_player.cardset.id}/{card_type}/{player_id}-{d}-v{variant}.png",

View File

@ -55,21 +55,21 @@ python -c "import fastapi, peewee, playwright" 2>/dev/null || {
python -c " python -c "
from playwright.sync_api import sync_playwright from playwright.sync_api import sync_playwright
p = sync_playwright().start() p = sync_playwright().start()
b = p.chromium.launch(args=['--no-sandbox']) print(p.chromium.executable_path)
b.close()
p.stop() p.stop()
" 2>/dev/null || { " >/dev/null 2>&1 || {
echo "Playwright Chromium not installed. Run: playwright install chromium" echo "Playwright Chromium not installed. Run: playwright install chromium"
exit 1 exit 1
} }
# Check dev DB is reachable # Check dev DB is reachable
DB_HOST="${POSTGRES_HOST_LOCAL:-10.10.0.42}"
python -c " python -c "
import socket import socket, sys
s = socket.create_connection(('10.10.0.42', 5432), timeout=3) s = socket.create_connection((sys.argv[1], 5432), timeout=3)
s.close() s.close()
" 2>/dev/null || { " "$DB_HOST" 2>/dev/null || {
echo "Cannot reach dev PostgreSQL at 10.10.0.42:5432 — is the homelab up?" echo "Cannot reach dev PostgreSQL at ${DB_HOST}:5432 — is the homelab up?"
exit 1 exit 1
} }
@ -92,7 +92,7 @@ set +a
# Override DB host to point at the dev server's IP (not Docker network name) # Override DB host to point at the dev server's IP (not Docker network name)
export DATABASE_TYPE=postgresql 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_PORT="${POSTGRES_PORT:-5432}"
export POSTGRES_DB="${POSTGRES_DB:-paperdynasty_dev}" export POSTGRES_DB="${POSTGRES_DB:-paperdynasty_dev}"
export POSTGRES_USER="${POSTGRES_USER:-sba_admin}" export POSTGRES_USER="${POSTGRES_USER:-sba_admin}"

View File

@ -6,13 +6,13 @@
</head> </head>
<body> <body>
<div id="fullCard" style="width: 1200px; height: 600px;"> <div id="fullCard" style="width: 1200px; height: 600px;">
{% if refractor_tier is defined and refractor_tier > 0 %}
{%- set diamond_colors = { {%- set diamond_colors = {
1: {'color': '#1a6b1a', 'highlight': '#40b040'}, 1: {'color': '#1a6b1a', 'highlight': '#40b040'},
2: {'color': '#2070b0', 'highlight': '#50a0e8'}, 2: {'color': '#2070b0', 'highlight': '#50a0e8'},
3: {'color': '#a82020', 'highlight': '#e85050'}, 3: {'color': '#a82020', 'highlight': '#e85050'},
4: {'color': '#6b2d8e', 'highlight': '#a060d0'}, 4: {'color': '#6b2d8e', 'highlight': '#a060d0'},
} -%} } -%}
{% if refractor_tier is defined and refractor_tier > 0 %}
{%- set dc = diamond_colors[refractor_tier] -%} {%- set dc = diamond_colors[refractor_tier] -%}
{%- set filled_bg = 'linear-gradient(135deg, ' ~ dc.highlight ~ ' 0%, ' ~ dc.color ~ ' 50%, ' ~ dc.color ~ ' 100%)' -%} {%- set filled_bg = 'linear-gradient(135deg, ' ~ dc.highlight ~ ' 0%, ' ~ dc.color ~ ' 50%, ' ~ dc.color ~ ' 100%)' -%}
<div class="tier-diamond{% if refractor_tier == 4 %} diamond-glow{% endif %}"> <div class="tier-diamond{% if refractor_tier == 4 %} diamond-glow{% endif %}">

View File

@ -1,11 +1,11 @@
{% if refractor_tier is defined and refractor_tier > 0 %}
<style> <style>
/* Shared rules for all refractor tiers */
#fullCard { #fullCard {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
</style>
{% if refractor_tier is defined and refractor_tier > 0 %}
<style>
.tier-diamond { .tier-diamond {
position: absolute; position: absolute;
left: 597px; left: 597px;
@ -68,9 +68,6 @@
border-bottom-color: #7a9cc4; border-bottom-color: #7a9cc4;
border-bottom-width: 4px; border-bottom-width: 4px;
} }
#resultHeader.border-bot {
border-bottom-width: 4px;
}
#resultHeader .border-right-thick { #resultHeader .border-right-thick {
border-right-width: 6px; border-right-width: 6px;
} }
@ -216,12 +213,4 @@
{% endif %} {% endif %}
</style> </style>
{% else %}
<style>
/* T0 Standard — no tier overrides */
#fullCard {
position: relative;
overflow: hidden;
}
</style>
{% endif %} {% endif %}