Skip to content

feat: collection quantity filter#61

Merged
cfbender merged 1 commit into
mainfrom
copilot/add-collection-filter-for-quantity
Jun 28, 2026
Merged

feat: collection quantity filter#61
cfbender merged 1 commit into
mainfrom
copilot/add-collection-filter-for-quantity

Conversation

@cfbender

@cfbender cfbender commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added a new Quantity filter to collection search, including comparison options and numeric input.
    • Search queries now understand qty and quantity as quantity-based filters.
  • Bug Fixes
    • Quantity filters are now saved, loaded, and applied consistently in collection search.
    • Invalid quantity values are safely ignored to prevent broken filtering.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 613f8f82-3198-4a71-9aab-f5e70d189b08

📥 Commits

Reviewing files that changed from the base of the PR and between b48f9d4 and 6a4572a.

📒 Files selected for processing (5)
  • assets/react/src/lib/collection-filters.ts
  • assets/react/src/pages/collection/filter-modal.tsx
  • lib/manavault/catalog/card_collection/search_filter/query.ex
  • lib/manavault/catalog/card_collection/search_filter/scalar_predicates.ex
  • lib/manavault/catalog/scryfall_query/parser.ex

📝 Walkthrough

Walkthrough

Adds quantity-based filtering end-to-end: the Scryfall query parser gains qty/quantity field aliases, a new ScalarPredicates.quantity/2 Ecto predicate is added, CollectionFilterState gains quantityOperator and quantity fields with encode/decode support, and the collection filter modal renders a new Quantity section.

Changes

Quantity Filter Feature

Layer / File(s) Summary
Parser alias and Ecto predicate
lib/manavault/catalog/scryfall_query/parser.ex, lib/manavault/catalog/card_collection/search_filter/scalar_predicates.ex, lib/manavault/catalog/card_collection/search_filter/query.ex
"qty" and "quantity" are mapped to :quantity in @field_aliases; ScalarPredicates.quantity/2 parses the value as integer and builds an Ecto dynamic comparison; query.ex delegates :quantity predicates to it.
Filter state, query builder, and encode/decode
assets/react/src/lib/collection-filters.ts
CollectionFilterState gains quantityOperator and quantity; defaults added to EMPTY_COLLECTION_FILTERS; buildCollectionFilterQuery emits a qty predicate term; countActiveCollectionFilters checks quantity; encode/decode serialize and restore both fields.
Quantity UI section
assets/react/src/pages/collection/filter-modal.tsx
Adds a FilterSection labeled "Quantity" (syntax="qty>=2") with a ComparisonFilterControl for numeric input wired to draft.quantityOperator and draft.quantity.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop, hop, count those cards with care,
A qty>=2 floats through the air,
The parser now knows "qty" by name,
The modal joins this filtering game,
More than one? The filter shall declare! 🃏

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch copilot/add-collection-filter-for-quantity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cfbender cfbender merged commit c4e2646 into main Jun 28, 2026
1 check was pending
@cfbender cfbender deleted the copilot/add-collection-filter-for-quantity branch June 28, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants