Use INSERT OR REPLACE to allow changing votes

This commit is contained in:
Jan Dittberner 2017-04-21 13:19:05 +02:00 committed by Jan Dittberner
parent 12dd0717ad
commit 8d0e0eeb1b

View file

@ -114,7 +114,7 @@ FROM decisions
WHERE status = 0 AND id NOT IN (SELECT decision FROM votes WHERE voter = $1)
ORDER BY due ASC`,
sqlCreateVote: `
INSERT INTO votes (decision, voter, vote, voted, notes)
INSERT OR REPLACE INTO votes (decision, voter, vote, voted, notes)
VALUES (:decision, :voter, :vote, :voted, :notes)`,
sqlLoadVote: `
SELECT decision, voter, vote, voted, notes