From cc72827dadd57981b336bccad2ec1f266b88d1ef Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 10 Apr 2026 12:32:10 -0500 Subject: [PATCH] fix(gauntlet): fix loss_max=0 falsy-zero trap in recap marker logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `(loss_max or 99)` treats `loss_max=0` as 99, so 10-1 runs showed ⬜ instead of ❌ for perfect-run rewards. Fix uses explicit None check. Tighten test to assert ❌ presence rather than just absence of ✅. Addresses review feedback on PR #165. Co-Authored-By: Claude Sonnet 4.6 --- gauntlets.py | 8 +++++++- tests/test_gauntlet_recap.py | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gauntlets.py b/gauntlets.py index 9b8beb6..4ceeeb1 100644 --- a/gauntlets.py +++ b/gauntlets.py @@ -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 losses > (loss_max if loss_max is not None else 99) + else "⬜" + ) reward = r.get("reward", {}) if reward.get("money"): diff --git a/tests/test_gauntlet_recap.py b/tests/test_gauntlet_recap.py index de5daa0..0324440 100644 --- a/tests/test_gauntlet_recap.py +++ b/tests/test_gauntlet_recap.py @@ -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 be marked ❌ — ineligible, 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.