diff --git a/templates/result.tmpl b/templates/result.tmpl
index 8babc76..e293bd2 100644
--- a/templates/result.tmpl
+++ b/templates/result.tmpl
@@ -15,7 +15,7 @@
{{ else if gt .CanVote 1 }}
- You are not eligible to vote in this poll. This is likely because you are not an Active Member,
+ You are not eligible to vote in this poll. This is likely because you are not an Active Member,
or because you did not meet the gatekeep requirements by the time the poll opened.
If you believe this is an error, please contact Evals or Opcomm.
@@ -51,15 +51,17 @@
{{ range $i, $val := .Results }}
- {{ if eq $.VoteType "ranked" }}
-
Round {{ $i | inc }}
- {{ end }}
- {{ range $option, $count := $val }}
-
- {{ $option }}: {{ $count }}
+
+ {{ if eq $.VoteType "ranked" }}
+
Round {{ $i | inc }}
+ {{ end }}
+ {{ range $option, $count := $val }}
+
+ {{ $option }}: {{ $count }}
+
+ {{ end }}
- {{ end }}
{{ end }}
{{ if and (.CanModify) (not .IsHidden) }}
@@ -82,17 +84,20 @@
eventSource.addEventListener("{{ .Id }}", function (event) {
let data = JSON.parse(event.data);
- for (let option in data) {
- let count = data[option];
- let element = document.getElementById(option);
- if (element == null) {
- let newElement = document.createElement("div");
- newElement.id = option;
- newElement.style = "font-size: 1.25rem; line-height: 1.25";
- newElement.innerText = option + ": " + count;
- document.getElementById("results").appendChild(newElement);
+ for (let roundNum in data) {
+ for (let option in data[roundNum]) {
+ let count = data[roundNum][option];
+ let element = document.getElementById(`${roundNum}-${option}`);
+ if (element == null) {
+ let newElement = document.createElement("div");
+ newElement.id = option;
+ newElement.style = "font-size: 1.25rem; line-height: 1.25";
+ newElement.innerText = option + ": " + count;
+ console.log(`round-${roundNum}`);
+ document.getElementById(`round-${roundNum}`).appendChild(newElement);
+ }
+ element.innerText = option + ": " + count;
}
- element.innerText = option + ": " + count;
}
});