diff --git a/api.go b/api.go index c221a84..6bf8567 100644 --- a/api.go +++ b/api.go @@ -254,14 +254,21 @@ func GetPollResults(c *gin.Context) { return } - fmt.Println(len(results)) + numVotes := 0 + + for _, v := range results { + for key := range v { + numVotes += v[key] + } + } + c.HTML(http.StatusOK, "result.tmpl", gin.H{ "Id": poll.Id, "Title": poll.Title, "Description": poll.Description, "VoteType": poll.VoteType, "Results": results, - "NumVotes": len(results), + "NumVotes": numVotes, "IsOpen": poll.Open, "IsHidden": poll.Hidden, "CanModify": canModify, diff --git a/templates/create.tmpl b/templates/create.tmpl index a1e1369..5739f7e 100644 --- a/templates/create.tmpl +++ b/templates/create.tmpl @@ -34,12 +34,12 @@