com web/php: Adjusted sorting votes function. The old behavior is inaccurate in reflecting rating.: include/shared-manual.inc
| From: | Sherif Ramadan | Date: | Sat, 15 Dec 2012 21:46:19 +0000 |
| Subject: | com web/php: Adjusted sorting votes function. The old behavior is inaccurate in reflecting rating.: include/shared-manual.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-15103@lists.php.net to get a copy of this message | ||
Commit: d0d43e55807b3ac7d80896cf581bf91c2083e6ed
Author: Sherif Ramadan <googleguy@php.net> Sat, 15 Dec 2012 16:46:19 -0500
Parents: ea7a325c8c20af5b7b5c060fb5bd0505fdf32a45
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=d0d43e55807b3ac7d80896cf581bf91c2083e6ed
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 {