F4IF / ctree-demo

Collaboration Tree - A community discussion platform built for maximum insight with minimum oversight.
http://demo.ctree.org
Other
37 stars 22 forks source link

Bug fix for sorted Firebase queries #134

Closed CSchmitz81 closed 4 years ago

CSchmitz81 commented 4 years ago

I found an issue with sorting Firebase queries where it didn't always return all items. It turns out startAt and endAt treat a 0 numeric value as undefined, so you get the wrong item(s). This is resolved by using the string "0" instead.

I also realized that the step size for numbers used for sorting was implicitly 1, because in cases where we started looking for the next items after a value, we incremented the start value by 1. I resolved this by adding a new step size constant, which will need to align with the number of decimal places used when writing these values, otherwise we may miss some items from the list.

CSchmitz81 commented 4 years ago

Needs some changes. Different sort types need different precision levels, so specify it in each dataContainer. The default should be incrementing by 1 for non-decimal numbers. There should also be a check to ensure adding the increment changes the value, because some large numbers won't work due to a lack of precision.

CSchmitz81 commented 4 years ago

The changes described have now been applied, so this can be reviewed and merged

CSchmitz81 commented 4 years ago

Force merging due to lack of reviews