Merge pull request 'fix: replace abstract tier symbols with readable labels' (#132) from fix/refractor-tier-labels into main
All checks were successful
Build Docker Image / build (push) Successful in 2m46s
All checks were successful
Build Docker Image / build (push) Successful in 2m46s
This commit is contained in:
commit
2d7c19814e
@ -40,13 +40,13 @@ FORMULA_LABELS = {
|
||||
"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 = {
|
||||
0: "○", # Base Card — hollow circle
|
||||
1: "◈", # Base Chrome — diamond with dot
|
||||
2: "◆", # Refractor — filled diamond
|
||||
3: "✦", # Gold Refractor — four-pointed star
|
||||
4: "★", # Superfractor — filled star
|
||||
0: "", # Base Card — no prefix
|
||||
1: "T1", # Base Chrome
|
||||
2: "T2", # Refractor
|
||||
3: "T3", # Gold Refractor
|
||||
4: "T4★", # Superfractor — star earned
|
||||
}
|
||||
|
||||
# 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}")
|
||||
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:
|
||||
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.
|
||||
|
||||
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)}
|
||||
for item in items:
|
||||
@ -138,7 +139,8 @@ def build_tier_summary(items: list, total_count: int) -> str:
|
||||
parts = []
|
||||
for t in range(5):
|
||||
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"
|
||||
return f"{summary} — {total_count} total"
|
||||
|
||||
|
||||
@ -200,46 +200,46 @@ class TestFormatRefractorEntry:
|
||||
class TestTierSymbols:
|
||||
"""
|
||||
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):
|
||||
"""T0 symbol is ○ (hollow circle)."""
|
||||
assert TIER_SYMBOLS[0] == "○"
|
||||
"""T0 label is empty (base cards get no prefix)."""
|
||||
assert TIER_SYMBOLS[0] == ""
|
||||
|
||||
def test_t1_symbol(self):
|
||||
"""T1 symbol is ◈ (diamond with dot)."""
|
||||
assert TIER_SYMBOLS[1] == "◈"
|
||||
"""T1 label is 'T1'."""
|
||||
assert TIER_SYMBOLS[1] == "T1"
|
||||
|
||||
def test_t2_symbol(self):
|
||||
"""T2 symbol is ◆ (filled diamond)."""
|
||||
assert TIER_SYMBOLS[2] == "◆"
|
||||
"""T2 label is 'T2'."""
|
||||
assert TIER_SYMBOLS[2] == "T2"
|
||||
|
||||
def test_t3_symbol(self):
|
||||
"""T3 symbol is ✦ (four-pointed star)."""
|
||||
assert TIER_SYMBOLS[3] == "✦"
|
||||
"""T3 label is 'T3'."""
|
||||
assert TIER_SYMBOLS[3] == "T3"
|
||||
|
||||
def test_t4_symbol(self):
|
||||
"""T4 symbol is ★ (filled star)."""
|
||||
assert TIER_SYMBOLS[4] == "★"
|
||||
"""T4 label is 'T4★'."""
|
||||
assert TIER_SYMBOLS[4] == "T4★"
|
||||
|
||||
def test_format_entry_t1_symbol_present(self, batter_state):
|
||||
"""format_refractor_entry prepends ◈ symbol for T1 cards."""
|
||||
def test_format_entry_t1_label_present(self, batter_state):
|
||||
"""format_refractor_entry prepends T1 label for T1 cards."""
|
||||
result = format_refractor_entry(batter_state)
|
||||
assert "◈" in result
|
||||
assert "T1 " in result
|
||||
|
||||
def test_format_entry_t2_symbol_present(self, sp_state):
|
||||
"""format_refractor_entry prepends ◆ symbol for T2 cards."""
|
||||
def test_format_entry_t2_label_present(self, sp_state):
|
||||
"""format_refractor_entry prepends T2 label for T2 cards."""
|
||||
result = format_refractor_entry(sp_state)
|
||||
assert "◆" in result
|
||||
assert "T2 " in result
|
||||
|
||||
def test_format_entry_t4_symbol_present(self, evolved_state):
|
||||
"""format_refractor_entry prepends ★ symbol for T4 cards."""
|
||||
def test_format_entry_t4_label_present(self, evolved_state):
|
||||
"""format_refractor_entry prepends T4★ label for T4 cards."""
|
||||
result = format_refractor_entry(evolved_state)
|
||||
assert "★" in result
|
||||
assert "T4★" in result
|
||||
|
||||
def test_format_entry_t0_uses_hollow_circle(self):
|
||||
"""T0 cards use the ○ symbol."""
|
||||
def test_format_entry_t0_no_prefix(self):
|
||||
"""T0 cards have no tier prefix — name starts the line."""
|
||||
state = {
|
||||
"player_name": "Rookie Player",
|
||||
"track": {"card_type": "batter"},
|
||||
@ -248,15 +248,16 @@ class TestTierSymbols:
|
||||
"next_threshold": 50,
|
||||
}
|
||||
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):
|
||||
"""Symbol appears before the player name in the first line."""
|
||||
def test_format_entry_label_before_name(self, batter_state):
|
||||
"""Label appears before the player name in the first line."""
|
||||
result = format_refractor_entry(batter_state)
|
||||
first_line = result.split("\n")[0]
|
||||
symbol_pos = first_line.find("◈")
|
||||
label_pos = first_line.find("T1")
|
||||
name_pos = first_line.find("Mike Trout")
|
||||
assert symbol_pos < name_pos
|
||||
assert label_pos < name_pos
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user