fix: address review feedback (#164)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 17s

- Fix falsy-zero bug: `(loss_max or 99)` → `loss_max is not None and losses > loss_max`
  so a player finishing 10-1 sees  on the perfect-run bonus instead of 
- Tighten test assertion: assert "" in bonus_line (was: assert "" not in bonus_line)
- Revert in_game/gameplay_queries.py to main — formatting/NoResultFound changes
  belong in PR #163, not here

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-04-10 13:03:22 -05:00
parent 9228d2e66c
commit 079f9ac4f6
3 changed files with 615 additions and 1174 deletions

View File

@ -2472,7 +2472,13 @@ def build_gauntlet_recap_embed(
if loss_max is not None
else wins >= win_num
)
marker = "" if earned else "" if losses > (loss_max or 99) else ""
marker = (
""
if earned
else ""
if loss_max is not None and losses > loss_max
else ""
)
reward = r.get("reward", {})
if reward.get("money"):

File diff suppressed because it is too large Load Diff

View File

@ -204,11 +204,11 @@ class TestBuildGauntletRecapEmbed:
make_run(wins=10, losses=1), make_event(), make_main_team(), make_rewards()
)
prize_field = next(f for f in embed.fields if f.name == "Prize Distribution")
# The 10-0 bonus line must appear without ✅ (either ❌ or ⬜)
# The 10-0 bonus line must appear with ❌ — definitively missed, not pending (⬜)
lines = prize_field.value.split("\n")
bonus_line = next((line for line in lines if "10-0" in line), None)
assert bonus_line is not None, "Expected a '10-0' line in prizes"
assert "" not in bonus_line
assert "" in bonus_line
def test_empty_rewards_list_omits_prize_field(self):
"""When rewards is an empty list the Prize Distribution field must be omitted.