diff --git a/frontend/static/js/result.js b/frontend/static/js/result.js index e62af22..6fb9684 100644 --- a/frontend/static/js/result.js +++ b/frontend/static/js/result.js @@ -60,8 +60,8 @@ function domLoaded() { if (!el) return; el.querySelector(".poll-option-votes").innerText = value; - el.querySelector(".poll-bar-fill").style.width = (value / totalVotes * 100) + "%"; - el.querySelector(".poll-bar-text").innerText = Math.round(value / totalVotes * 100); + el.querySelector(".poll-bar-fill").style.width = totalVotes ? (value / totalVotes * 100) + "%" : "0%"; + el.querySelector(".poll-bar-text").innerText = totalVotes ? Math.round(value / totalVotes * 100) : 0; }); prevResult = votes; }