fix: review feedback — variant 0 guard, remove dead team param
All checks were successful
Ruff Lint / lint (pull_request) Successful in 11s
All checks were successful
Ruff Lint / lint (pull_request) Successful in 11s
- Use `variant is None` instead of `not variant` to avoid skipping variant 0 tier-ups (0 is falsy in Python) - Remove unused `team` parameter from _build_refractor_response - Update tests to match Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
46744d139c
commit
78f313663e
@ -484,7 +484,6 @@ async def _build_refractor_response(
|
||||
player_name: str,
|
||||
player_id: int,
|
||||
refractor_tier: int,
|
||||
team: dict,
|
||||
refractor_data: dict,
|
||||
) -> dict:
|
||||
"""Build response data for a /player refractor_tier request.
|
||||
@ -771,7 +770,6 @@ class Players(commands.Cog):
|
||||
player_name=this_player,
|
||||
player_id=pid,
|
||||
refractor_tier=refractor_tier,
|
||||
team=team,
|
||||
refractor_data=refractor_data,
|
||||
)
|
||||
|
||||
|
||||
@ -4254,7 +4254,7 @@ async def _trigger_variant_renders(tier_ups: list) -> None:
|
||||
today = datetime.date.today().isoformat()
|
||||
for tier_up in tier_ups:
|
||||
variant = tier_up.get("variant_created")
|
||||
if not variant:
|
||||
if variant is None:
|
||||
continue
|
||||
player_id = tier_up["player_id"]
|
||||
track = tier_up.get("track_name", "Batter")
|
||||
|
||||
@ -17,8 +17,6 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||
from cogs.players import _build_refractor_response
|
||||
|
||||
|
||||
TEAM = {"id": 31, "name": "Test Team", "abbrev": "TST"}
|
||||
|
||||
REFRACTOR_CARDS_RESPONSE = {
|
||||
"count": 3,
|
||||
"items": [
|
||||
@ -67,7 +65,6 @@ class TestBuildRefractorResponse:
|
||||
player_name="Mike Trout",
|
||||
player_id=100,
|
||||
refractor_tier=3,
|
||||
team=TEAM,
|
||||
refractor_data=REFRACTOR_CARDS_RESPONSE,
|
||||
)
|
||||
assert result["found"] is True
|
||||
@ -85,7 +82,6 @@ class TestBuildRefractorResponse:
|
||||
player_name="Nobody",
|
||||
player_id=999,
|
||||
refractor_tier=2,
|
||||
team=TEAM,
|
||||
refractor_data=REFRACTOR_CARDS_RESPONSE,
|
||||
)
|
||||
assert result["found"] is False
|
||||
@ -104,7 +100,6 @@ class TestBuildRefractorResponse:
|
||||
player_name="Ken Griffey Jr.",
|
||||
player_id=300,
|
||||
refractor_tier=1,
|
||||
team=TEAM,
|
||||
refractor_data=REFRACTOR_CARDS_RESPONSE,
|
||||
)
|
||||
assert result["found"] is True
|
||||
@ -124,7 +119,6 @@ class TestBuildRefractorResponse:
|
||||
player_name="Someone",
|
||||
player_id=500,
|
||||
refractor_tier=1,
|
||||
team=TEAM,
|
||||
refractor_data=empty_data,
|
||||
)
|
||||
assert result["found"] is False
|
||||
@ -142,7 +136,6 @@ class TestBuildRefractorResponse:
|
||||
player_name="Mike Trout",
|
||||
player_id=100,
|
||||
refractor_tier=4,
|
||||
team=TEAM,
|
||||
refractor_data=REFRACTOR_CARDS_RESPONSE,
|
||||
)
|
||||
assert result["found"] is False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user