Reset candidate green background when reset in Wright STV

This commit is contained in:
RunasSudo 2020-10-19 01:39:53 +11:00
parent 77d773605a
commit 356509a4fe
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -185,20 +185,25 @@ async function clickCount() {
elTd = document.createElement('td'); elTd = document.createElement('td');
elTd.classList.add('count'); elTd.classList.add('count');
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 {
elTr1.querySelector('td:first-child').classList.remove('elected');
if (countCard.state === py.pyRCV2.model.CandidateState.WITHDRAWN) { if (countCard.state === py.pyRCV2.model.CandidateState.WITHDRAWN) {
elTd.classList.add('excluded'); elTd.classList.add('excluded');
elTd.innerText = 'WD'; elTd.innerText = 'WD';
} else 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) { } else if (countCard.state === py.pyRCV2.model.CandidateState.EXCLUDED) {
elTd.classList.add('excluded'); elTd.classList.add('excluded');
elTd.innerText = 'EX'; elTd.innerText = 'EX';
} else { } else {
elTd.innerText = countCard.votes; elTd.innerText = countCard.votes;
} }
}
elTr2.appendChild(elTd); elTr2.appendChild(elTd);
} }