Skip to content

Commit b1c5aa5

Browse files
committed
fix: object Object
1 parent 3fea2c4 commit b1c5aa5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

templates/result.tmpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{{ else if gt .CanVote 1 }}
1616
<div id="cannot-vote" class="alert alert-warning fade show d-flex flex-row align-items-center" role="alert">
1717
<h5 class="m-0">
18-
You are not eligible to vote in this poll. This is likely because you are not an Active Member,
18+
You are not eligible to vote in this poll. This is likely because you are not an Active Member,
1919
or because you did not meet the gatekeep requirements by the time the poll opened.
2020
If you believe this is an error, please contact Evals or Opcomm.
2121
</h5>
@@ -82,8 +82,10 @@
8282

8383
eventSource.addEventListener("{{ .Id }}", function (event) {
8484
let data = JSON.parse(event.data);
85-
for (let option in data) {
86-
let count = data[option];
85+
if (data.length == 0) return;
86+
let results = data[0];
87+
for (let option in results) {
88+
let count = results[option];
8789
let element = document.getElementById(option);
8890
if (element == null) {
8991
let newElement = document.createElement("div");

0 commit comments

Comments
 (0)