Skip to content

Commit

Permalink
Tighten logic for compendium browser trait filtering (#17841)
Browse files Browse the repository at this point in the history
  • Loading branch information
In3luki authored Dec 27, 2024
1 parent 3e1da59 commit f75fc50
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/module/apps/compendium-browser/tabs/base.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,13 @@ export abstract class CompendiumBrowserTab {
): boolean {
const selectedTraits = selected.filter((s) => !s.not).map((s) => s.value);
const notTraits = selected.filter((t) => t.not).map((s) => s.value);
if (selectedTraits.length || notTraits.length) {
if (notTraits.some((t) => traits.includes(t))) {
return false;
}
const fullfilled =
condition === "and"
? selectedTraits.every((t) => traits.includes(t))
: selectedTraits.some((t) => traits.includes(t));
if (!fullfilled) return false;
if (notTraits.some((t) => traits.includes(t))) {
return false;
}
if (selectedTraits.length) {
return condition === "and"
? selectedTraits.every((t) => traits.includes(t))
: selectedTraits.some((t) => traits.includes(t));
}
return true;
}
Expand Down

0 comments on commit f75fc50

Please sign in to comment.