mysql-specificness :<

git-svn-id: file:///home/shish/svn/shimmie2/trunk@545 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-10-21 22:59:47 +00:00
parent 8719156d61
commit 1192a6d123
2 changed files with 2 additions and 3 deletions

View File

@ -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=?",

View File

@ -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=?",