diff options
Diffstat (limited to 'models.go')
-rw-r--r-- | models.go | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -25,7 +25,7 @@ FROM decisions JOIN voters ON decisions.proponent=voters.id WHERE decisions.tag=$1;` sqlGetVoter = ` -SELECT voters.id, voters.name +SELECT voters.id, voters.name, voters.enabled, voters.reminder FROM voters JOIN emails ON voters.id=emails.voter WHERE emails.address=$1 AND voters.enabled=1` @@ -139,15 +139,22 @@ func (v VoteChoice) String() string { } } +const ( + voteStatusDeclined = -1 + voteStatusPending = 0 + voteStatusApproved = 1 + voteStatusWithdrawn = -2 +) + func (v VoteStatus) String() string { switch v { - case -1: + case voteStatusDeclined: return "declined" - case 0: + case voteStatusPending: return "pending" - case 1: + case voteStatusApproved: return "approved" - case -2: + case voteStatusWithdrawn: return "withdrawn" default: return "unknown" @@ -240,7 +247,7 @@ func FindVotersUnvotedDecisionsForDisplayOnPage(page int64, voter *Voter) (decis } defer decisionsStmt.Close() - rows, err := decisionsStmt.Queryx(page - 1, voter.Id) + rows, err := decisionsStmt.Queryx(page-1, voter.Id) if err != nil { logger.Printf("Error loading motions for page %d: %v\n", page, err) return |