fix: variant filter commented out on cards list endpoint (#197) #203
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-merged
ai-pr-opened
ai-reviewed
ai-reviewing
ai-reviewing
ai-working
bug
enhancement
evolution
performance
phase-0
phase-1a
phase-1b
phase-1c
phase-1d
security
tech-debt
todo
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#203
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/197-bug-variant-filter-commented-out-on-cards-list-end"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
?variant=query filter onGET /api/v2/cardsso callers can passvariant=0for base cards only orvariant=Nfor a specific refractor variantvariantcolumn to the CSV export header and row dataChanges
app/routers_v2/cards.py:if variant is not None: all_cards = all_cards.where(Card.variant == variant)"variant"to CSV header listline.value # line.variantwithline.value, line.variantTest plan
GET /api/v2/cards?team_id=Xreturns both base and variant cards (no filter)GET /api/v2/cards?team_id=X&variant=0returns only base cardsGET /api/v2/cards?team_id=X&variant=1returns only variant=1 cardsGET /api/v2/cards?team_id=X&csv=trueincludesvariantcolumn in outputCloses #197
🤖 Generated with Claude Code
AI Code Review
Files Reviewed
app/routers_v2/cards.py(modified)Findings
Correctness
No issues found.
variant: Optional[int] = Nonewas already declared in the endpoint signature (line 44);Card.variantexists (confirmed viaCardPydanticat line 29 andPATCH /{card_id}at line 351). Uncommenting the filter is correct.id, player, cardset, rarity, team, pack, value, variant. Correct.Security
No issues found. The variant filter uses Peewee's ORM query builder, which parameterizes inputs — no SQL injection risk.
Style & Conventions
No issues found. Change follows existing filter pattern used for
value,team_id,player_id, etc.Suggestions
PATCH /{card_id}at line 351 also declaresvariantas a parameter but still has the assignment commented out (lines 379–380:# if variant is not None: # this_card.variant = variant). This is pre-existing and out of scope here, but worth a follow-up issue if PATCH variant updates are needed.variant=0andvariant=Nfiltering would be valuable.Verdict: COMMENT
No blocking issues. Changes are minimal, correct, and implement exactly what the PR claims.
mergeable: true. Ready to merge.Self-review restriction: posting as COMMENT per project convention.
Automated review by Claude PR Reviewer
Approved via pd-pr