summaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Service
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-28 08:03:08 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-28 08:03:08 +0000
commit64a44cceb80e29d14c718c576c1db02ca38b2195 (patch)
tree733e6a94a743c7712b14c88090b1cc8b6dc57ba1 /src/SemanticScuttle/Service
parenta3ba58dfc048c948230317191c67101c4aa80bfb (diff)
downloadsemanticscuttle-64a44cceb80e29d14c718c576c1db02ca38b2195.tar.gz
semanticscuttle-64a44cceb80e29d14c718c576c1db02ca38b2195.tar.bz2
update only one bookmark when voting;
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@446 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/Service')
-rw-r--r--src/SemanticScuttle/Service/Vote.php8
1 files changed, 6 insertions, 2 deletions
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)';
}