Card filter: show only Universes Beyond cards
The Universes Beyond toggle now cycles off → hide → only, backed by a new only_universes_beyond library filter. Choosing "only" counts as a real query, so Card Search runs it on its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,9 @@ fn push_card_filters(
|
||||
if filter.exclude_universes_beyond {
|
||||
sql.push_str(" AND oc.universes_beyond = 0");
|
||||
}
|
||||
if filter.only_universes_beyond {
|
||||
sql.push_str(" AND oc.universes_beyond = 1");
|
||||
}
|
||||
if filter.exclude_digital_only {
|
||||
sql.push_str(" AND oc.digital_only = 0");
|
||||
}
|
||||
@@ -387,7 +390,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn excluding_universes_beyond_hides_flagged_cards_only_when_asked() {
|
||||
fn universes_beyond_filters_hide_or_keep_only_flagged_cards() {
|
||||
let fx = owned_fixture();
|
||||
// Stand in for what the ingest derives: a card that exists only as
|
||||
// Universes Beyond.
|
||||
@@ -410,6 +413,16 @@ mod tests {
|
||||
// Off unless asked for — this must not quietly change existing searches.
|
||||
let all = names(&fx.catalog.search_library(&LibraryFilter::default()).unwrap());
|
||||
assert!(all.contains(&"Serra Angel".to_string()));
|
||||
|
||||
let f = LibraryFilter {
|
||||
only_universes_beyond: true,
|
||||
..Default::default()
|
||||
};
|
||||
assert_eq!(
|
||||
names(&fx.catalog.search_library(&f).unwrap()),
|
||||
vec!["Serra Angel"],
|
||||
"only the flagged card is kept"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -421,6 +421,10 @@ pub struct LibraryFilter {
|
||||
/// existed, the same way the other reference-schema additions degrade.
|
||||
#[serde(default)]
|
||||
pub exclude_universes_beyond: bool,
|
||||
/// The opposite: only cards that exist only as Universes Beyond. Inert
|
||||
/// against an older `reference.db` in the same way.
|
||||
#[serde(default)]
|
||||
pub only_universes_beyond: bool,
|
||||
/// Hide cards that exist only on Arena/MTGO (Alchemy rebalances and the
|
||||
/// like) and so can never be in a physical collection.
|
||||
#[serde(default)]
|
||||
|
||||
Reference in New Issue
Block a user