feat: exile-aware collection nation filter - #41
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an exile-aware nation filter to the web collection view. Filtering by nation now includes that nation's exile cards by default — cards that belong to another nation but can be played in its decks (e.g. the Polish T-34 76 PL under Soviet) — matching how the game client behaves. A new exiles toggle (on by default, unlike spawnable/reserved) restricts the view to a nation's own cards.
Why
The KARDS game client shows forces-in-exile in a nation's collection view automatically; the official website only shows them when you add the exile nation to the filter. This tool aims to be a more convenient replica of the in-game collection, so it mirrors the game-client behavior by default while letting the user turn it off.
Investigation that led here
Confirmed on the live API that the GraphQL
showExilesflag is redundant for our full pull:showExiles=FalseandTruereturn identical 1613-card sets, and all 16 exile cards already arrive under their own nation with theexilefield populated.showExilesonly matters with a single-nation filter (it adds that nation's exile cards). Since we scrape the whole set, no data is missing — the exile behavior is purely a local display filter, which is what this PR implements.showExiles: Falsein the scrape is left as-is.Behavior
faction IN (...) OR exile IN (...).faction IN (...)only.Implementation
web/queries.py:CardFilters.include_exiles(defaultTrue); nation filter widened to match the exile field when on.web/deps.py:exilesquery param. Because the toggle defaults to on, the template pairs a hiddenexiles=falsewith the checkboxexiles=trueso an unchecked box still submits a value; the dep resolves("true" in exiles) if exiles else True._filters.html: the toggle, checked by default, next to spawnable/reserved.toggle_exilesadded to all 12 TOMLs (EN "exiles", RU "в изгнании", others fall back to the English term).CONTEXT.mdExile entry updated to note the collection-filter behavior.Verification
make checkgreen: format + lint + mypy + 468 tests (was 458; +10 exile tests).exiles=falsehides it, and the form renders the checked toggle with its hidden companion field.Test plan
make checkexiles=falseexcludes them