com web/php: Updated the notes sorting function. Enhanced sorting results based on multiple criteria.: include/shared-manual.inc
| From: | Sherif Ramadan | Date: | Fri, 14 Dec 2012 03:20:44 +0000 |
| Subject: | com web/php: Updated the notes sorting function. Enhanced sorting results based on multiple criteria.: include/shared-manual.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-15089@lists.php.net to get a copy of this message | ||
Commit: 1341f83e1dca231b5c2782b1bfbbb80bbcaf64ab
Author: Sherif Ramadan <googleguy@php.net> Thu, 13 Dec 2012 22:20:44 -0500
Parents: d2524744a9f3198a958913f893295d9f49f343c8
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=1341f83e1dca231b5c2782b1bfbbb80bbcaf64ab
Log:
Updated the notes sorting function. Enhanced sorting results based on multiple criteria.
Changed paths:
M include/shared-manual.inc
Diff:
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 8058c4e..75c0ec2 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -701,16 +701,24 @@ function manual_notes_sort($a, $b)
if ($voteA === 0 && $c === 1 && $voteB <= 0.30 && $d >= 4) return
-1;
return 1;
}
- // Votes of equal amounts are sorted in descending order by date
+ // Votes of equal amounts are sorted based on the overall rating and in descending order by date
else {
- if ($a['xwhen'] > $b['xwhen']) {
- return -1;
+ if ($c > $d) {
+ return -1;
}
- elseif ($a['xwhen'] < $b['xwhen']) {
- return 1;
+ elseif ($c < $d) {
+ return 1;
}
else {
- return 0;
+ if ($a['xwhen'] > $b['xwhen']) {
+ return -1;
+ }
+ elseif ($a['xwhen'] < $b['xwhen']) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
}
}