From a25380193f44cf5d3fae1801f2a95d0aed899507 Mon Sep 17 00:00:00 2001
From: Brian Wiborg
Date: Tue, 14 May 2024 00:53:30 +0200
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Better=20voting=20result?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
tmpl/voting.html | 46 ++++++++++++++++++++++------------------------
voting/main.go | 7 +++++++
2 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/tmpl/voting.html b/tmpl/voting.html
index fcc9626..cca8e2b 100644
--- a/tmpl/voting.html
+++ b/tmpl/voting.html
@@ -122,28 +122,26 @@
Quorum: FAILED
{{ end }}
- {{ if not .Voting.Anonymous }}
-
-
-
- VOTES
-
-
- {{ range $vote := .Voting.Votes }}
-
-
- {{ $vote.Choice }}
- |
-
- {{ $vote.Elector }}
- |
-
- {{ $vote.Id }}
- |
-
- {{ end }}
-
-
-
- {{ end }}
+
+
+
+ VOTES
+
+
+ {{ range $vote := .Voting.Votes }}
+
+
+ {{ $vote.Choice }}
+ |
+
+ {{ $vote.Elector }}
+ |
+
+ {{ $vote.Id }}
+ |
+
+ {{ end }}
+
+
+
{{ end }}
diff --git a/voting/main.go b/voting/main.go
index 7f5bccc..d26926b 100644
--- a/voting/main.go
+++ b/voting/main.go
@@ -187,6 +187,13 @@ nextVote:
}
votes = append(votes, v.votes[i])
}
+
+ // anonymize
+ if v.annonymous {
+ for i := range votes {
+ votes[i].Elector = ""
+ }
+ }
return votes
}