Skip to content

Commit 63936c1

Browse files
committed
Fixed count of votes cast
1 parent 1ae91b6 commit 63936c1

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

api.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,21 @@ func GetPollResults(c *gin.Context) {
254254
return
255255
}
256256

257-
fmt.Println(len(results))
257+
numVotes := 0
258+
259+
for _, v := range results {
260+
for key := range v {
261+
numVotes += v[key]
262+
}
263+
}
264+
258265
c.HTML(http.StatusOK, "result.tmpl", gin.H{
259266
"Id": poll.Id,
260267
"Title": poll.Title,
261268
"Description": poll.Description,
262269
"VoteType": poll.VoteType,
263270
"Results": results,
264-
"NumVotes": len(results),
271+
"NumVotes": numVotes,
265272
"IsOpen": poll.Open,
266273
"IsHidden": poll.Hidden,
267274
"CanModify": canModify,

0 commit comments

Comments
 (0)