Commit:    aaffcf24585f37054a51d46f0a513744fedd25f3
Author:    Sherif Ramadan <[email protected]>         Sat, 15 Dec 2012 16:46:19 
-0500
Parents:   fca2d16ac9417588b7bb777a3b37039c507775ca
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=aaffcf24585f37054a51d46f0a513744fedd25f3

Log:
Adjusted sorting votes function. The old behavior is inaccurate in reflecting 
rating.

Changed paths:
  M  include/shared-manual.inc


Diff:
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 75c0ec2..6b57e11 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -685,6 +685,8 @@ function manual_notes_sort($a, $b)
     }
        $voteA = $a['votes']['up'] / $c;
        $voteB = $b['votes']['up'] / $d;
+       $rateA = $a['votes']['up'] - $a['votes']['down'];
+       $rateB = $b['votes']['up'] - $b['votes']['down'];
        // Lower voted notes go to the bottom regardless of date
        if ($voteA > $voteB) {
                // Exception to the rule for today's notes
@@ -703,10 +705,10 @@ function manual_notes_sort($a, $b)
        }
        // Votes of equal amounts are sorted based on the overall rating and in 
descending order by date
        else {
-               if ($c > $d) {
+               if ($rateA > $rateB) {
                  return -1;
                }
-               elseif ($c < $d) {
+               elseif ($rateA < $rateB) {
                  return 1;
                }
                else {


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to