fix: align refractor status command with API response schema #122

Merged
Claude merged 1 commits from fix/refractor-status-field-names into main 2026-03-25 21:20:21 +00:00

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."