fix: align refractor status command with API response schema
All checks were successful
Ruff Lint / lint (pull_request) Successful in 21s

- data.get("cards") → data.get("items") to match list endpoint response
- formula_value → current_value (API field name)
- card_type from top-level → track.card_type (nested in track object)
- Add limit=500 param so API returns all cards instead of default 10

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-03-25 16:18:07 -05:00
parent b185874607
commit 7a3c21f6bd

View File

@ -74,9 +74,10 @@ def format_refractor_entry(card_state: dict) -> str:
[========--] 120/149 (PA+TB×2) T1 T2
"""
player_name = card_state.get("player_name", "Unknown")
card_type = card_state.get("card_type", "batter")
track = card_state.get("track", {})
card_type = track.get("card_type", "batter")
current_tier = card_state.get("current_tier", 0)
formula_value = card_state.get("formula_value", 0)
formula_value = card_state.get("current_value", 0)
next_threshold = card_state.get("next_threshold")
tier_label = TIER_NAMES.get(current_tier, f"T{current_tier}")
@ -106,7 +107,7 @@ def apply_close_filter(card_states: list) -> list:
result = []
for state in card_states:
current_tier = state.get("current_tier", 0)
formula_value = state.get("formula_value", 0)
formula_value = state.get("current_value", 0)
next_threshold = state.get("next_threshold")
if current_tier >= 4 or not next_threshold:
continue
@ -166,7 +167,7 @@ class Refractor(commands.Cog):
)
return
params = [("team_id", team["id"])]
params = [("team_id", team["id"]), ("limit", 500)]
if card_type:
params.append(("card_type", card_type))
if season is not None:
@ -181,7 +182,7 @@ class Refractor(commands.Cog):
)
return
items = data if isinstance(data, list) else data.get("cards", [])
items = data if isinstance(data, list) else data.get("items", [])
if not items:
await interaction.edit_original_response(
content="No refractor data found for your team."