Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix filter compare value casting for filter operators that take 2 or more values #22410

Merged
merged 3 commits into from May 8, 2024

Conversation

hanneskuettner
Copy link
Contributor

@hanneskuettner hanneskuettner commented May 7, 2024

Scope

The filters _between and _nbetween were not working if a function (such as count() or year()) was used to retrieve the value. This was caused by not accounting for filters that take more than a single argument and trying to convert the compareValue, which is an array in that case, to a single Number, which was NaN.

What's changed:

  • Add extra handling for the case compareValue is an array and not a single value.
  • (Unrelated to this PR) Moved the length check of the compare value in _between and _nbetween to after splitting it into separate values, as otherwise we look for a string of length 2, that doesn't seem correct?

Potential Risks / Drawbacks

None

Review Notes / Questions

None


Fixes #20382

Copy link

changeset-bot bot commented May 7, 2024

🦋 Changeset detected

Latest commit: 800ba3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@directus/api Patch
directus Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@paescuj paescuj self-assigned this May 8, 2024
Copy link
Member

@paescuj paescuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works now, also with comma-separated filters ✨

@paescuj paescuj merged commit 1a7bdb1 into main May 8, 2024
4 checks passed
@paescuj paescuj deleted the fix-20382-between-function-filter branch May 8, 2024 13:13
@github-actions github-actions bot added this to the Next Release milestone May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Filter on YEAR(date) with _between giving incorrect results
2 participants