Empty commit

This commit is contained in:
Git 2014-03-27 08:01:03 +00:00
parent d943ecd296
commit 84f5e7a68e
2 changed files with 5 additions and 2 deletions

View File

@ -54,6 +54,9 @@ public static function get_user_votes($UserID) {
* @return array (Upvotes, Total Votes)
*/
public static function get_group_votes($GroupID) {
if (!is_number($GroupID)) {
return array('Ups' => 0, 'Total' => 0);
}
$GroupVotes = G::$Cache->get_value("votes_$GroupID");
if ($GroupVotes === false) {
$QueryID = G::$DB->get_query_id();

View File

@ -11,11 +11,11 @@
SELECT v.GroupID, SUM(IF(v.Type='Up',1,0)) AS Ups, COUNT(1) AS Total
FROM ( SELECT UserID
FROM users_votes
WHERE GroupID = $GroupID
WHERE GroupID = '$GroupID'
AND Type='Up'
) AS a
JOIN users_votes AS v USING (UserID)
WHERE v.GroupID != $GroupID
WHERE v.GroupID != '$GroupID'
GROUP BY v.GroupID
HAVING Ups > 0");
$VotePairs = $DB->to_array('GroupID', MYSQL_ASSOC, false);