summaryrefslogtreecommitdiff
path: root/option.go
diff options
context:
space:
mode:
authorJoe Robinson <joe@mumsnet.com>2014-07-25 15:41:58 +0100
committerJoe Robinson <joe@mumsnet.com>2014-07-25 15:41:58 +0100
commit07884e5c9b4fe423d10b1f4a9b6366f7d81cffb2 (patch)
tree02ad9caed8e5b5fe251d92bac53e2dbc639ddefd /option.go
parentbf720d0d1ae4e9e20e34bd63c45252468b6fdd6c (diff)
Fixed voting to only vote for options for the given poll
Diffstat (limited to 'option.go')
-rw-r--r--option.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/option.go b/option.go
index 0b41e0a..dd3055d 100644
--- a/option.go
+++ b/option.go
@@ -10,10 +10,10 @@ type Option struct {
numVotes int64
}
-func getOptionFromText(db*sqlite3.Conn, text string) (Option, error) {
+func getOptionFromText(db*sqlite3.Conn, text string, id int) (Option, error) {
- args := sqlite3.NamedArgs{"$a": text}
- sql := "SELECT * FROM options WHERE text = $a"
+ args := sqlite3.NamedArgs{"$a": text, "$b": id}
+ sql := "SELECT * FROM options WHERE text = $a and poll_id = $b"
s, err := db.Query(sql, args)
row := make(sqlite3.RowMap)