cgeo/cgeo — pull request #3385 by KiwiStone (2013-10-25 22:15:10+00:00)
Title: Added a new comparator to sort cache lists on popularity ratio

The comparator enables to sort caches by the ratio of their favorite point count and finds. The limitation is the same as for the FindsComparator, i.e. it does only work once the caches are stored on the device and the number of finds is vaild and available.

The computation of the comparator's return value may seem to be strange. However, it's purpose is to prevent rounding to zero when we would return (ratio2 - ratio1) directly and thereby cast float to int. When you have caches with very few favorite points but many finds this rounding to zero can lead to cases were a cache with 1 favorite point is not sorted as being larger then a cache with 0 favorite points.