fix: replace abstract tier symbols with readable labels in /refractor status
All checks were successful
Ruff Lint / lint (pull_request) Successful in 11s

Unicode symbols (○ ◈ ◆ ✦ ★) were too similar to distinguish at a glance.
Now uses T1/T2/T3/T4★ prefixes with no prefix for base cards (T0).
Summary header reads "Base: 1  T1: 9 — 64 total" instead of cryptic symbols.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-03-25 23:47:03 -05:00
parent 64c656ce91
commit c3ff85fd2d
2 changed files with 40 additions and 37 deletions

View File

@ -40,13 +40,13 @@ FORMULA_LABELS = {
"rp": "IP+K", "rp": "IP+K",
} }
# Tier-specific symbols for visual hierarchy in the status display. # Tier-specific labels for the status display. T0 is blank (base cards need no prefix).
TIER_SYMBOLS = { TIER_SYMBOLS = {
0: "", # Base Card — hollow circle 0: "", # Base Card — no prefix
1: "", # Base Chrome — diamond with dot 1: "T1", # Base Chrome
2: "", # Refractor — filled diamond 2: "T2", # Refractor
3: "", # Gold Refractor — four-pointed star 3: "T3", # Gold Refractor
4: "", # Superfractor — filled star 4: "T4", # Superfractor — star earned
} }
# Embed accent colors per tier (used for single-tier filtered views). # Embed accent colors per tier (used for single-tier filtered views).
@ -105,9 +105,10 @@ def format_refractor_entry(card_state: dict) -> str:
tier_label = TIER_NAMES.get(current_tier, f"T{current_tier}") tier_label = TIER_NAMES.get(current_tier, f"T{current_tier}")
formula_label = FORMULA_LABELS.get(card_type, card_type) formula_label = FORMULA_LABELS.get(card_type, card_type)
symbol = TIER_SYMBOLS.get(current_tier, "·") symbol = TIER_SYMBOLS.get(current_tier, "")
prefix = f"{symbol} " if symbol else ""
first_line = f"{symbol} **{player_name}** — {tier_label}" first_line = f"{prefix}**{player_name}** — {tier_label}"
if current_tier >= 4 or next_threshold is None: if current_tier >= 4 or next_threshold is None:
bar = render_progress_bar(1, 1) bar = render_progress_bar(1, 1)
@ -127,7 +128,7 @@ def build_tier_summary(items: list, total_count: int) -> str:
""" """
Build a one-line summary of tier distribution from the current page items. Build a one-line summary of tier distribution from the current page items.
Returns something like: '○ 3 ◈ 12 ◆ 8 ✦ 5 ★ 2 — 30 cards' Returns something like: 'T0: 3 T1: 12 T2: 8 T3: 5 T4★: 2 — 30 total'
""" """
counts = {t: 0 for t in range(5)} counts = {t: 0 for t in range(5)}
for item in items: for item in items:
@ -138,7 +139,8 @@ def build_tier_summary(items: list, total_count: int) -> str:
parts = [] parts = []
for t in range(5): for t in range(5):
if counts[t] > 0: if counts[t] > 0:
parts.append(f"{TIER_SYMBOLS[t]} {counts[t]}") label = TIER_SYMBOLS[t] or "Base"
parts.append(f"{label}: {counts[t]}")
summary = " ".join(parts) if parts else "No cards" summary = " ".join(parts) if parts else "No cards"
return f"{summary}{total_count} total" return f"{summary}{total_count} total"

View File

@ -200,46 +200,46 @@ class TestFormatRefractorEntry:
class TestTierSymbols: class TestTierSymbols:
""" """
Verify TIER_SYMBOLS values and that format_refractor_entry prepends Verify TIER_SYMBOLS values and that format_refractor_entry prepends
the correct symbol for each tier. Each tier has a unique Unicode symbol. the correct label for each tier. Labels use short readable text (T0-T4).
""" """
def test_t0_symbol(self): def test_t0_symbol(self):
"""T0 symbol is ○ (hollow circle).""" """T0 label is empty (base cards get no prefix)."""
assert TIER_SYMBOLS[0] == "" assert TIER_SYMBOLS[0] == ""
def test_t1_symbol(self): def test_t1_symbol(self):
"""T1 symbol is ◈ (diamond with dot).""" """T1 label is 'T1'."""
assert TIER_SYMBOLS[1] == "" assert TIER_SYMBOLS[1] == "T1"
def test_t2_symbol(self): def test_t2_symbol(self):
"""T2 symbol is ◆ (filled diamond).""" """T2 label is 'T2'."""
assert TIER_SYMBOLS[2] == "" assert TIER_SYMBOLS[2] == "T2"
def test_t3_symbol(self): def test_t3_symbol(self):
"""T3 symbol is ✦ (four-pointed star).""" """T3 label is 'T3'."""
assert TIER_SYMBOLS[3] == "" assert TIER_SYMBOLS[3] == "T3"
def test_t4_symbol(self): def test_t4_symbol(self):
"""T4 symbol is ★ (filled star).""" """T4 label is 'T4★'."""
assert TIER_SYMBOLS[4] == "" assert TIER_SYMBOLS[4] == "T4"
def test_format_entry_t1_symbol_present(self, batter_state): def test_format_entry_t1_label_present(self, batter_state):
"""format_refractor_entry prepends ◈ symbol for T1 cards.""" """format_refractor_entry prepends T1 label for T1 cards."""
result = format_refractor_entry(batter_state) result = format_refractor_entry(batter_state)
assert "" in result assert "T1 " in result
def test_format_entry_t2_symbol_present(self, sp_state): def test_format_entry_t2_label_present(self, sp_state):
"""format_refractor_entry prepends ◆ symbol for T2 cards.""" """format_refractor_entry prepends T2 label for T2 cards."""
result = format_refractor_entry(sp_state) result = format_refractor_entry(sp_state)
assert "" in result assert "T2 " in result
def test_format_entry_t4_symbol_present(self, evolved_state): def test_format_entry_t4_label_present(self, evolved_state):
"""format_refractor_entry prepends ★ symbol for T4 cards.""" """format_refractor_entry prepends T4★ label for T4 cards."""
result = format_refractor_entry(evolved_state) result = format_refractor_entry(evolved_state)
assert "" in result assert "T4" in result
def test_format_entry_t0_uses_hollow_circle(self): def test_format_entry_t0_no_prefix(self):
"""T0 cards use the ○ symbol.""" """T0 cards have no tier prefix — name starts the line."""
state = { state = {
"player_name": "Rookie Player", "player_name": "Rookie Player",
"track": {"card_type": "batter"}, "track": {"card_type": "batter"},
@ -248,15 +248,16 @@ class TestTierSymbols:
"next_threshold": 50, "next_threshold": 50,
} }
result = format_refractor_entry(state) result = format_refractor_entry(state)
assert "" in result first_line = result.split("\n")[0]
assert first_line.startswith("**Rookie Player**")
def test_format_entry_symbol_before_name(self, batter_state): def test_format_entry_label_before_name(self, batter_state):
"""Symbol appears before the player name in the first line.""" """Label appears before the player name in the first line."""
result = format_refractor_entry(batter_state) result = format_refractor_entry(batter_state)
first_line = result.split("\n")[0] first_line = result.split("\n")[0]
symbol_pos = first_line.find("") label_pos = first_line.find("T1")
name_pos = first_line.find("Mike Trout") name_pos = first_line.find("Mike Trout")
assert symbol_pos < name_pos assert label_pos < name_pos
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------