diff --git a/html/index.js b/html/index.js index c84a18a..390d149 100644 --- a/html/index.js +++ b/html/index.js @@ -185,20 +185,25 @@ async function clickCount() { elTd = document.createElement('td'); elTd.classList.add('count'); - if (countCard.state === py.pyRCV2.model.CandidateState.WITHDRAWN) { - elTd.classList.add('excluded'); - elTd.innerText = 'WD'; - } else if (countCard.state === py.pyRCV2.model.CandidateState.ELECTED || countCard.state === py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) { + + if (countCard.state === py.pyRCV2.model.CandidateState.ELECTED || countCard.state === py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) { elTd.classList.add('elected'); elTd.innerText = countCard.votes; - elTr1.querySelector('td:first-child').classList.add('elected'); - } else if (countCard.state === py.pyRCV2.model.CandidateState.EXCLUDED) { - elTd.classList.add('excluded'); - elTd.innerText = 'EX'; } else { - elTd.innerText = countCard.votes; + elTr1.querySelector('td:first-child').classList.remove('elected'); + + if (countCard.state === py.pyRCV2.model.CandidateState.WITHDRAWN) { + elTd.classList.add('excluded'); + elTd.innerText = 'WD'; + } else if (countCard.state === py.pyRCV2.model.CandidateState.EXCLUDED) { + elTd.classList.add('excluded'); + elTd.innerText = 'EX'; + } else { + elTd.innerText = countCard.votes; + } } + elTr2.appendChild(elTd); }