update only one bookmark when voting;
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@446 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
a3ba58dfc0
commit
64a44cceb8
1 changed files with 6 additions and 2 deletions
|
@ -246,8 +246,9 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService
|
||||||
//update bookmark table
|
//update bookmark table
|
||||||
$bm = SemanticScuttle_Service_Factory::get('Bookmark');
|
$bm = SemanticScuttle_Service_Factory::get('Bookmark');
|
||||||
$res = $this->db->sql_query(
|
$res = $this->db->sql_query(
|
||||||
'UPDATE ' . $bm->getTableName()
|
$sql='UPDATE ' . $bm->getTableName()
|
||||||
. ' SET bVoting = bVoting + ' . (int)$vote
|
. ' SET bVoting = bVoting + ' . (int)$vote
|
||||||
|
. ' WHERE bId = ' . (int)$bookmark
|
||||||
);
|
);
|
||||||
$this->db->sql_freeresult($res);
|
$this->db->sql_freeresult($res);
|
||||||
|
|
||||||
|
@ -267,7 +268,10 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService
|
||||||
{
|
{
|
||||||
throw new Exception('Not implemented yet');
|
throw new Exception('Not implemented yet');
|
||||||
//FIXME
|
//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)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue