Jump to content

Pages: Sort by Rating (Bug)


Recommended Posts

I have a Pages database. It uses star rating (not reviews!). I have set sorting by rating in descending order:

Could contain: Page, Text

The sorting is weird, though:

  1. Item with 15x5 stars and 1x1 star.
  2. Item with 17x5 stars only.
  3. Item with 25x5 stars and 3x1 star.
  4. Item with 23x5 stars only.
  5. Item with 6x5 stars and 1x1 star.
  6. Item with 16x5 stars and 1x6 stars.
  7. Item with 7x7 stars and 7x7 stars.

Does it make sense? Obviously, the item #4 should be placed at the very top, following by item #2.

Should it not be sorted by average as total rating divided by number of votes? Or what is meant with Sort by Rating?

 

Edited by Sonya*
Link to comment
Share on other sites

  • Sonya* changed the title to Pages: Sort by Rating (Bug)
Posted (edited)

I can see the issue. Your code rounds the average rating to an integer. That's why there is no difference for the first 4 items and then the next two. You can see they have the same record_rating in the database. This is how you save it.

The rating_average (rating_value/rating_hits) with decimal would make a difference.

Could contain: Page, Text, File

 

Edited by Sonya*
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...