fix: "NOT IN" doesn't apply filter properly #5154
Open
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.
What this PR does / why we need it:
(REQUIRED)
Currently "NOT IN" (or "does not contain" on the frontend) only filters out recipes that have exactly those items, rather than those items and maybe other ones. For example:
Recipe1:
tagA
,tagB
,tagC
Recipe2:
tagA
Recipe3:
tagB
If I query for NOT IN [
tagA
], I would assume the only result would be Recipe3. Currently I will get both Recipe1 and Recipe3, which is incorrect.This PR fixes this issue, as well as a related issue if a recipe has no records (e.g. zero tags).
Which issue(s) this PR fixes:
(REQUIRED)
Fixes #5063 (recipes with no tags)
Fixes #5151 (recipes with mismatched categories)
Testing
(fill-in or delete this section)
Updated our tests to catch these issues.