From 63936c1500162e4d4981736a514b60dcff137b1a Mon Sep 17 00:00:00 2001 From: pikachu0542 Date: Wed, 8 Apr 2026 11:57:54 -0400 Subject: [PATCH 1/2] Fixed count of votes cast --- api.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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, From 639ce248e6d7c082219b24e9c44405cce3a2a527 Mon Sep 17 00:00:00 2001 From: pikachu0542 Date: Wed, 8 Apr 2026 16:39:32 -0400 Subject: [PATCH 2/2] Misc fixes --- templates/create.tmpl | 6 +++--- templates/poll.tmpl | 4 ++-- templates/result.tmpl | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) 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 }}