From 4028a24ef94cca4c02cf74bbb95eeef468f65dfe Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 8 Apr 2026 04:35:55 -0500 Subject: [PATCH] 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 --- app/routers_v2/refractor.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/routers_v2/refractor.py b/app/routers_v2/refractor.py index d28aba2..1477a01 100644 --- a/app/routers_v2/refractor.py +++ b/app/routers_v2/refractor.py @@ -1,4 +1,5 @@ import os +from datetime import date from fastapi import APIRouter, Depends, HTTPException, Query 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. if boost_result: - tier_up_entry["variant_created"] = boost_result.get( - "variant_created" - ) + variant_num = boost_result.get("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)