|
|
|
@ -27,6 +27,7 @@ func getVoteName(id int) (string, error) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", err
|
|
|
|
|
}
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
if rows.Next() {
|
|
|
|
|
var name string
|
|
|
|
|
err := rows.Scan(&name)
|
|
|
|
@ -43,6 +44,7 @@ func getVoteFromMessageID(msgID string) (int, error) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
return 0, err
|
|
|
|
|
}
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
if rows.Next() {
|
|
|
|
|
var id int
|
|
|
|
|
err := rows.Scan(&id)
|
|
|
|
@ -64,10 +66,12 @@ func updateVote(voteID int, userID string, voteValue int) error {
|
|
|
|
|
if rows.Next() {
|
|
|
|
|
return errForceRejectionVoteReuse
|
|
|
|
|
}
|
|
|
|
|
rows.Close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Check if the vote is finished and don't allow change of vote that way.
|
|
|
|
|
rows, err := db.Query("SELECT finished FROM vote WHERE id=? AND finished=?", voteID, true)
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
if rows.Next() {
|
|
|
|
|
return errVoteIsOver
|
|
|
|
|
}
|
|
|
|
|