mysql-specificness :<
git-svn-id: file:///home/shish/svn/shimmie2/trunk@545 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
8719156d61
commit
1192a6d123
@ -87,9 +87,8 @@ class NumericScore extends Extension {
|
||||
|
||||
private function add_vote($image_id, $user_id, $score) {
|
||||
global $database;
|
||||
// TODO: update if already voted
|
||||
$database->Execute(
|
||||
"INSERT INTO numeric_score_votes(image_id, user_id, score) VALUES(?, ?, ?)",
|
||||
"REPLACE INTO numeric_score_votes(image_id, user_id, score) VALUES(?, ?, ?)",
|
||||
array($image_id, $user_id, $score));
|
||||
$database->Execute(
|
||||
"UPDATE images SET numeric_score=(SELECT SUM(score) FROM numeric_score_votes WHERE image_id=?) WHERE id=?",
|
||||
|
@ -89,7 +89,7 @@ class TextScore extends Extension {
|
||||
global $database;
|
||||
// TODO: update if already voted
|
||||
$database->Execute(
|
||||
"INSERT INTO text_score_votes(image_id, user_id, score) VALUES(?, ?, ?)",
|
||||
"REPLACE INTO text_score_votes(image_id, user_id, score) VALUES(?, ?, ?)",
|
||||
array($image_id, $user_id, $score));
|
||||
$database->Execute(
|
||||
"UPDATE images SET text_score=(SELECT AVG(score) FROM text_score_votes WHERE image_id=?) WHERE id=?",
|
||||
|
Loading…
x
Reference in New Issue
Block a user