Skip to content

feat: exile-aware collection nation filter - #41

Merged
AABur merged 4 commits into
mainfrom
feat/exile-filter
Jul 17, 2026
Merged

feat: exile-aware collection nation filter#41
AABur merged 4 commits into
mainfrom
feat/exile-filter

Conversation

@AABur

@AABur AABur commented Jul 17, 2026

Copy link
Copy Markdown
Owner

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 showExiles flag is redundant for our full pull: showExiles=False and True return identical 1613-card sets, and all 16 exile cards already arrive under their own nation with the exile field populated. showExiles only 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: False in the scrape is left as-is.

Behavior

  • Nation filter with the toggle on (default): faction IN (...) OR exile IN (...).
  • Toggle off: faction IN (...) only.
  • No nation selected: the toggle is inert (every card is already listed under its own nation).
  • An exile card keeps its own nation in the table (the Polish tank still shows as Poland).

Implementation

  • web/queries.py: CardFilters.include_exiles (default True); nation filter widened to match the exile field when on.
  • web/deps.py: exiles query param. Because the toggle defaults to on, the template pairs a hidden exiles=false with the checkbox exiles=true so 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.
  • Locales: toggle_exiles added to all 12 TOMLs (EN "exiles", RU "в изгнании", others fall back to the English term).
  • Glossary: CONTEXT.md Exile entry updated to note the collection-filter behavior.

Verification

  • make check green: format + lint + mypy + 468 tests (was 458; +10 exile tests).
  • Exercised end-to-end on a live web server over HTTP: Soviet filter shows the Polish exile tank by default, exiles=false hides it, and the form renders the checked toggle with its hidden companion field.

Test plan

  • make check
  • default nation filter includes exile cards; exiles=false excludes them
  • toggle inert without a nation filter
  • exile card keeps its own nation
  • checkbox default-on round-trips correctly (hidden + checkbox)

@AABur
AABur merged commit 4363d74 into main Jul 17, 2026
1 check passed
@AABur
AABur deleted the feat/exile-filter branch July 17, 2026 22:29
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.

1 participant