Fix initial load

This commit is contained in:
Elton Stoneman
2018-09-26 11:58:32 +01:00
parent 97d0ae2170
commit 6356ddc7c6
3 changed files with 7 additions and 6 deletions

View File

@ -11,10 +11,11 @@ connection.on("UpdateResults", function (results) {
document.getElementById("optionA").innerText = percentages.a + "%";
document.getElementById("optionB").innerText = percentages.b + "%";
var totalVotes = 'No votes yet';
if (results.voteCount > 0) {
var totalVotes = results.voteCount + (results.voteCount > 1 ? " votes" : " vote");
document.getElementById("totalVotes").innerText = totalVotes;
totalVotes = results.voteCount + (results.voteCount > 1 ? " votes" : " vote");
}
document.getElementById("totalVotes").innerText = totalVotes;
var bg1 = document.getElementById('background-stats-1');
var bg2 = document.getElementById('background-stats-2');