Top rated sorting bug Top rated sorting bug
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Top rated sorting bug

Started by Vadim, February 15, 2005, 12:44:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Vadim

Hi,

I've noticed, that Top rated pictures are not sorted coorectly
Look here: http://coppermine.sourceforge.net/demo/displayimage.php?album=toprated&cat=0&pos=0 , this picture has  4.5 / 5, and this http://coppermine.sourceforge.net/demo/displayimage.php?album=toprated&cat=0&pos=1 (which is on the 2nd place) 4.7 / 5

I think that the solution is to change sort order query in include/functions.inc.php Line 703 to
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND votes >= '{$CONFIG['min_votes_for_rating']}' $ALBUM_SET ORDER BY ROUND(((pic_rating+1)/2000), 2) DESC, votes DESC, filename $limit");

When adding ROUND()  parameter sorting becomes more accurate

Joachim Müller


Casper

It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here