svn: /web/php-bugs/trunk/include/ query.php
| From: | Felipe Pena | Date: | Sat, 14 Aug 2010 15:43:14 +0000 |
| Subject: | svn: /web/php-bugs/trunk/include/ query.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-8739@lists.php.net to get a copy of this message | ||
felipe Sat, 14 Aug 2010 15:43:14 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=302222
Log:
- Added order by avg. vote scores
Changed paths:
U web/php-bugs/trunk/include/query.php
Modified: web/php-bugs/trunk/include/query.php
===================================================================
--- web/php-bugs/trunk/include/query.php 2010-08-14 15:38:30 UTC (rev 302221)
+++ web/php-bugs/trunk/include/query.php 2010-08-14 15:43:14 UTC (rev 302222)
@@ -14,6 +14,7 @@
'php_os' => 'os',
'sdesc' => 'summary',
'assign' => 'assignment',
+ 'avg_score' => 'avg. vote score'
);
// Fetch pseudo packages
@@ -53,6 +54,10 @@
UNIX_TIMESTAMP(ts2) AS modified
FROM bugdb
';
+
+ if ($order_by == 'avg_score') {
+ $query .= 'LEFT JOIN bugdb_votes v ON bugdb.id = v.bug';
+ }
$where_clause = ' WHERE 1 = 1 ';
@@ -182,6 +187,11 @@
$order_by = $reorder_by;
}
}
+
+ if ($order_by == 'avg_score') {
+ $query .= ' GROUP BY v.bug';
+ $order_by = 'AVG(v.score)+3';
+ }
$query .= " ORDER BY $order_by $direction";