summaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Service/Vote.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/SemanticScuttle/Service/Vote.php')
-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)';
}