Aam-Digital / ndb-core

Easy-to-use case management web app for NGOs anywhere in the world.
http://www.aam-digital.com
GNU General Public License v3.0
58 stars 19 forks source link

Number range filter #2310

Open sleidig opened 8 months ago

sleidig commented 8 months ago

As a user I want to filter a list not only by an exact number value but select a min and max value to display all records with a value in between. (e.g. any exam results with points between 50 - 80)

Proposed Solutions & Alternatives Similar to the DateFilter and DateRangeFilterComponent, implement another custom filter that allows to select two values and builds a filter function accordingly.

Proposed iterations

christophscheuing commented 2 months ago

Still struggling with the types for the comparison. $lte and $gte should probably be of type number. However, this leads to strange behavior if the MongoDB database fields used for comparison are of type string. Those values should probably be converted to numbers before comparison. Two tasks for that:

christophscheuing commented 1 month ago

I think point 1 is more or less done.

christophscheuing commented 1 month ago

Still struggling with the types for the comparison. $lte and $gte should probably be of type number. However, this leads to strange behavior if the MongoDB database fields used for comparison are of type string. Those values should probably be converted to numbers before comparison. Two tasks for that:

  • Discuss logic of converting e.g. "schoolclass: 11b" to number.
  • Implement conversion within the filter.

We agreed on limiting the numbers filter strictly to number fields, i.e. database fields of type number In MongoDB. We might think of inventing logic for converting between strings and numbers in the future, but this is probably specific to concrete use cases and of out scope of the number filter as such.