Display votes in non-anonymous voting results

This commit is contained in:
Brian Wiborg 2024-05-13 12:46:13 +02:00
parent 58cb8645a4
commit f2f8265499
No known key found for this signature in database
GPG key ID: BE53FA9286B719D6
6 changed files with 42 additions and 5 deletions

View file

@ -86,6 +86,7 @@ func getVotes(id string) ([]vote.Vote, error) {
return nil, err
}
var (
i string
e string
c vote.Choice
ts time.Time
@ -94,7 +95,7 @@ func getVotes(id string) ([]vote.Vote, error) {
votes = []vote.Vote{}
)
for result.Next() {
if err = result.Scan(&e, &dbChoice, &dbTimestamp); err != nil {
if err = result.Scan(&i, &e, &dbChoice, &dbTimestamp); err != nil {
return nil, err
}
@ -106,7 +107,7 @@ func getVotes(id string) ([]vote.Vote, error) {
return nil, err
}
v := vote.NewVoteWithTimestamp(e, c, ts)
v := vote.NewVoteWithTimestamp(i, e, c, ts)
votes = append(votes, v)
}

View file

@ -125,6 +125,7 @@ func initStmtVoteSelect(db *sql.DB) {
var err error
if voteSelect, err = db.Prepare(`
SELECT
id,
elector,
choice,
timestamp