From 64a44cceb80e29d14c718c576c1db02ca38b2195 Mon Sep 17 00:00:00 2001 From: cweiske Date: Wed, 28 Oct 2009 08:03:08 +0000 Subject: update only one bookmark when voting; git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@446 b3834d28-1941-0410-a4f8-b48e95affb8f --- src/SemanticScuttle/Service/Vote.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/SemanticScuttle/Service/Vote.php') diff --git a/src/SemanticScuttle/Service/Vote.php b/src/SemanticScuttle/Service/Vote.php index 6db940c..168040d 100644 --- a/src/SemanticScuttle/Service/Vote.php +++ b/src/SemanticScuttle/Service/Vote.php @@ -246,8 +246,9 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService //update bookmark table $bm = SemanticScuttle_Service_Factory::get('Bookmark'); $res = $this->db->sql_query( - 'UPDATE ' . $bm->getTableName() + $sql='UPDATE ' . $bm->getTableName() . ' SET bVoting = bVoting + ' . (int)$vote + . ' WHERE bId = ' . (int)$bookmark ); $this->db->sql_freeresult($res); @@ -267,7 +268,10 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService { throw new Exception('Not implemented yet'); //FIXME - //SELECT bid, SUM( vote ) FROM sc_votes GROUP BY bid + $bm = SemanticScuttle_Service_Factory::get('Bookmark'); + $sql = 'UPDATE ' . $bm->getTableName() . ' as B SET bVoting = ' + . '(SELECT SUM(vote) FROM ' . $this->getTableName() . ' as V' + . ' WHERE V.bId = B.bId GROUP BY bid)'; } -- cgit v1.2.3