feat: include animated_url in tier-up response for T3/T4 (#201)

Closes #201

Add animated_url to evaluate-game tier-up entries when new_tier >= 3.
URL is constructed from API_BASE_URL env var + the /animated endpoint
path, using today's date as the cache-bust segment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-04-08 04:35:55 -05:00
parent c8ec976626
commit 4028a24ef9

View File

@ -1,4 +1,5 @@
import os import os
from datetime import date
from fastapi import APIRouter, Depends, HTTPException, Query from fastapi import APIRouter, Depends, HTTPException, Query
import logging import logging
@ -476,9 +477,15 @@ async def evaluate_game(game_id: int, token: str = Depends(oauth2_scheme)):
# Non-breaking addition: include boost info when available. # Non-breaking addition: include boost info when available.
if boost_result: if boost_result:
tier_up_entry["variant_created"] = boost_result.get( variant_num = boost_result.get("variant_created")
"variant_created" tier_up_entry["variant_created"] = variant_num
) if computed_tier >= 3 and variant_num and card_type:
d = date.today().strftime("%Y-%m-%d")
api_base = os.environ.get("API_BASE_URL", "").rstrip("/")
tier_up_entry["animated_url"] = (
f"{api_base}/api/v2/players/{player_id}/{card_type}card"
f"/{d}/{variant_num}/animated"
)
tier_ups.append(tier_up_entry) tier_ups.append(tier_up_entry)