From 07884e5c9b4fe423d10b1f4a9b6366f7d81cffb2 Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Fri, 25 Jul 2014 15:41:58 +0100 Subject: Fixed voting to only vote for options for the given poll --- option.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'option.go') 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) -- cgit v1.2.3