console icon indicating copy to clipboard operation
console copied to clipboard

🐛 Bug Report: Filters "greaterThan" / "greaterThanEqual" treat all input as numbers.

Open DerLeole opened this issue 1 year ago • 2 comments

👟 Reproduction steps

In any collection in the console, try using a String that cant be parsed to a number in combination with a "greater than" or "greater than equal" query.

👍 Expected behavior

The query is executed and documents are shown, similar to how it is handled when "less than" or "less than equal" is used.

👎 Actual Behavior

Error page, and the backend call is executed with null instead of the actual query string.

🎲 Appwrite version

Appwrite Cloud

💻 Operating system

Windows

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

DerLeole avatar Jul 03 '24 16:07 DerLeole

The reason is https://github.com/appwrite/console/blob/afa92ba5d0461b69d571d02cfb2fc36ad784bd2c/src/lib/components/filters/store.ts#L120

DerLeole avatar Jul 03 '24 16:07 DerLeole

Unlike the "lessThan" or "lessThanEqual" filter, the numeric parsing of the input string in "greater than" or "greater than equal" query is apparently causing this error as the strings that cannot be parsed return NaN value to the backend. I've removed the numeric parsing (PR #1246 )to ensure consistency with the "less than" queries which were reported to be working fine.

iamAyushChamoli avatar Jul 29 '24 15:07 iamAyushChamoli