Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_karma
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4687
Modified Files:
serendipity_event_karma.php
Log Message:
Affenfeiner bugfix
Index: serendipity_event_karma.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_karma/serendipity_event_karma.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- serendipity_event_karma.php 23 Jun 2004 15:55:57 -0000 1.9
+++ serendipity_event_karma.php 30 Jun 2004 08:40:01 -0000 1.10
@@ -393,13 +393,13 @@
foreach($sql AS $key => $rows) {
$q = "SELECT e.id,
e.title,
- k.{$rows[0]} AS no
+ SUM(k.{$rows[0]}) AS no
FROM {$serendipity['dbPrefix']}karma
AS k
JOIN {$serendipity['dbPrefix']}entries
AS e
ON k.entryid = e.id
- ORDER BY k.{$rows[0]} {$rows[1]} LIMIT {$addData['maxitems']}";
+ ORDER BY k.{$rows[0]} {$rows[1]} GROUP BY e.id LIMIT {$addData['maxitems']}";
$sql_rows = serendipity_db_query($q);
?>
@@ -556,14 +556,12 @@
}
// Fetch votes for all entry IDs. Store them in an array for later usage.
- $q = 'SELECT SUM(votes) AS votes, SUM(points) AS points, SUM(visits) AS visits
+ $q = 'SELECT k.entryid, SUM(votes) AS votes, SUM(points) AS points, SUM(visits) AS visits
FROM ' . $serendipity['dbPrefix'] . 'karma AS k
- WHERE k.entryid IN (' . implode(', ', $entries) . ' GROUP BY k.entryid';
+ WHERE k.entryid IN (' . implode(', ', $entries) . ') GROUP BY k.entryid';
- $q = 'SELECT *
- FROM ' . $serendipity['dbPrefix'] . 'karma AS k
- WHERE k.entryid IN (' . implode(', ', $entries) . ')';
$sql = serendipity_db_query($q);
+
$rows = array();
if ($sql && is_array($sql)) {
foreach($sql AS $idx => $row) {
|