summaryrefslogtreecommitdiff
path: root/models.go
diff options
context:
space:
mode:
authorJan Dittberner <jandd@cacert.org>2017-04-21 13:19:05 +0200
committerJan Dittberner <jan@dittberner.info>2017-04-22 00:14:11 +0200
commit8d0e0eeb1b6e983749b3a24131cd05ed6781a9ef (patch)
treedbcfe2b2da3b830b7c4d2cfc5b5a86d3286fc615 /models.go
parent12dd0717ad0bb2389b38161f9fd6ff71e4cc0c62 (diff)
downloadcacert-boardvoting-8d0e0eeb1b6e983749b3a24131cd05ed6781a9ef.tar.gz
cacert-boardvoting-8d0e0eeb1b6e983749b3a24131cd05ed6781a9ef.tar.xz
cacert-boardvoting-8d0e0eeb1b6e983749b3a24131cd05ed6781a9ef.zip
Use INSERT OR REPLACE to allow changing votes
Diffstat (limited to 'models.go')
-rw-r--r--models.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models.go b/models.go
index dfc054d..d124387 100644
--- a/models.go
+++ b/models.go
@@ -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