fix: address review feedback on card-of-the-week PR (#212)

- Add `= None` default to `Optional[str]` field in CardOfTheWeekResponse
  (Pydantic v1 convention: Optional fields should have explicit None default)
- Remove unused `_PACK_COUNTER` dead variable from test module
- Remove unused `cardset` parameter from `_make_pack_type` helper and
  update all 6 call sites

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-04-10 21:01:33 -05:00
parent 507037f5b9
commit f9c25c5632
2 changed files with 10 additions and 9 deletions

View File

@ -50,7 +50,9 @@ class CardOfTheWeekResponse(pydantic.BaseModel):
rating: int
card_image_url: str
cardset_name: str
card_created_at: Optional[str] # ISO-8601 string; None when pack has no open_time
card_created_at: Optional[str] = (
None # ISO-8601 string; None when pack has no open_time
)
@router.get(

View File

@ -157,7 +157,6 @@ def cotw_client(cotw_db):
_RARITY_COUNTER = [0]
_TEAM_COUNTER = [0]
_PACK_COUNTER = [0]
def _make_rarity(name: str = "Common") -> Rarity:
@ -208,7 +207,7 @@ def _make_team(is_ai: bool = False, suffix: str = "") -> Team:
)
def _make_pack_type(cardset: Cardset) -> PackType:
def _make_pack_type() -> PackType:
return PackType.create(
name="COTW Pack Type",
card_count=5,
@ -268,7 +267,7 @@ def test_happy_path_single_eligible_card(cotw_db, cotw_client):
image="https://s3.example.com/happy.png",
)
team = _make_team()
pt = _make_pack_type(cardset)
pt = _make_pack_type()
pack = _make_pack(team, pt, open_time=_recent(1))
card = _make_card(player, team, pack, value=85)
@ -301,7 +300,7 @@ def test_empty_window_returns_404(cotw_db, cotw_client):
cardset = _make_cardset("COTW Old Set")
player = _make_player(rarity, cardset, name="Old Timer")
team = _make_team()
pt = _make_pack_type(cardset)
pt = _make_pack_type()
pack = _make_pack(team, pt, open_time=_old(14))
_make_card(player, team, pack, value=70)
@ -323,7 +322,7 @@ def test_ai_team_excluded_by_default(cotw_db, cotw_client):
"""
rarity = _make_rarity("MVP")
cardset = _make_cardset("AI Excl Set")
pt = _make_pack_type(cardset)
pt = _make_pack_type()
ai_team = _make_team(is_ai=True, suffix="AI")
human_team = _make_team(is_ai=False, suffix="HU")
@ -363,7 +362,7 @@ def test_include_ai_true_includes_ai_team_card(cotw_db, cotw_client):
"""
rarity = _make_rarity("MVP")
cardset = _make_cardset("AI Incl Set")
pt = _make_pack_type(cardset)
pt = _make_pack_type()
ai_team = _make_team(is_ai=True, suffix="AI2")
human_team = _make_team(is_ai=False, suffix="HU2")
@ -401,7 +400,7 @@ def test_tiebreak_highest_rating_wins(cotw_db, cotw_client):
"""
rarity = _make_rarity("HoF")
cardset = _make_cardset("Tiebreak Rating Set")
pt = _make_pack_type(cardset)
pt = _make_pack_type()
team = _make_team()
open_time = _recent(2)
@ -439,7 +438,7 @@ def test_tiebreak_same_rating_newest_pack_wins(cotw_db, cotw_client):
"""
rarity = _make_rarity("All-Star")
cardset = _make_cardset("Tiebreak Newest Set")
pt = _make_pack_type(cardset)
pt = _make_pack_type()
team = _make_team()
p_old = _make_player(