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 @@
- +
@@ -112,7 +112,7 @@ {{ end }} - + diff --git a/templates/poll.tmpl b/templates/poll.tmpl index 3f6bb75..0099745 100644 --- a/templates/poll.tmpl +++ b/templates/poll.tmpl @@ -16,14 +16,14 @@
{{ if eq .PollType "simple" }} {{ range $i, $option := .Options }} -
+

{{ end }} {{ if .AllowWriteIns }} -
+
{{ .Title }} +

{{ .Title }}

{{ if .Description }}

{{ .Description | MakeLinks }}

{{ end }}