Additional pretty-print tidying
This commit is contained in:
parent
891f82e148
commit
6d3e283d1d
@ -223,11 +223,7 @@ async function clickCount() {
|
|||||||
elTd.classList.add('elected');
|
elTd.classList.add('elected');
|
||||||
}
|
}
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
if (countCard.transfers != '0.00') {
|
elTd.innerHTML = ppVotes(countCard.transfers);
|
||||||
elTd.innerText = ppVotes(countCard.transfers);
|
|
||||||
} else {
|
|
||||||
elTd.innerHTML = ' ';
|
|
||||||
}
|
|
||||||
elTr1.appendChild(elTd);
|
elTr1.appendChild(elTd);
|
||||||
|
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
@ -235,7 +231,7 @@ async function clickCount() {
|
|||||||
|
|
||||||
if (countCard.state === py.pyRCV2.model.CandidateState.ELECTED || countCard.state === py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED || countCard.state === py.pyRCV2.model.CandidateState.DISTRIBUTING_SURPLUS) {
|
if (countCard.state === py.pyRCV2.model.CandidateState.ELECTED || countCard.state === py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED || countCard.state === py.pyRCV2.model.CandidateState.DISTRIBUTING_SURPLUS) {
|
||||||
elTd.classList.add('elected');
|
elTd.classList.add('elected');
|
||||||
elTd.innerText = ppVotes(countCard.votes);
|
elTd.innerHTML = ppVotes(countCard.votes);
|
||||||
elTr1.querySelector('td:first-child').classList.add('elected');
|
elTr1.querySelector('td:first-child').classList.add('elected');
|
||||||
} else {
|
} else {
|
||||||
elTr1.querySelector('td:first-child').classList.remove('elected');
|
elTr1.querySelector('td:first-child').classList.remove('elected');
|
||||||
@ -248,9 +244,9 @@ async function clickCount() {
|
|||||||
elTd.innerText = 'Ex';
|
elTd.innerText = 'Ex';
|
||||||
} else if (countCard.state === py.pyRCV2.model.CandidateState.EXCLUDING) {
|
} else if (countCard.state === py.pyRCV2.model.CandidateState.EXCLUDING) {
|
||||||
elTd.classList.add('excluded');
|
elTd.classList.add('excluded');
|
||||||
elTd.innerText = ppVotes(countCard.votes);
|
elTd.innerHTML = ppVotes(countCard.votes);
|
||||||
} else {
|
} else {
|
||||||
elTd.innerText = ppVotes(countCard.votes);
|
elTd.innerHTML = ppVotes(countCard.votes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,43 +257,31 @@ async function clickCount() {
|
|||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.classList.add('count');
|
elTd.classList.add('count');
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
if (result.exhausted.transfers != '0.00') {
|
elTd.innerHTML = ppVotes(result.exhausted.transfers);
|
||||||
elTd.innerText = ppVotes(result.exhausted.transfers);
|
|
||||||
} else {
|
|
||||||
elTd.innerHTML = ' ';
|
|
||||||
}
|
|
||||||
elExhausted1.appendChild(elTd);
|
elExhausted1.appendChild(elTd);
|
||||||
|
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.classList.add('count');
|
elTd.classList.add('count');
|
||||||
elTd.innerText = ppVotes(result.exhausted.votes);
|
elTd.innerHTML = ppVotes(result.exhausted.votes);
|
||||||
elExhausted2.appendChild(elTd);
|
elExhausted2.appendChild(elTd);
|
||||||
|
|
||||||
// Display loss to fraction
|
// Display loss to fraction
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.classList.add('count');
|
elTd.classList.add('count');
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
if (result.loss_fraction.transfers != '0.00' && result.loss_fraction.transfers != '-0.00') {
|
elTd.innerHTML = ppVotes(result.loss_fraction.transfers);
|
||||||
elTd.innerText = ppVotes(result.loss_fraction.transfers);
|
|
||||||
} else {
|
|
||||||
elTd.innerHTML = ' ';
|
|
||||||
}
|
|
||||||
elLTF1.appendChild(elTd);
|
elLTF1.appendChild(elTd);
|
||||||
|
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.classList.add('count');
|
elTd.classList.add('count');
|
||||||
if (result.loss_fraction.votes == '-0.00') {
|
elTd.innerHTML = ppVotes(result.loss_fraction.votes);
|
||||||
elTd.innerText = ppVotes('0.00');
|
|
||||||
} else {
|
|
||||||
elTd.innerText = ppVotes(result.loss_fraction.votes);
|
|
||||||
}
|
|
||||||
elLTF2.appendChild(elTd);
|
elLTF2.appendChild(elTd);
|
||||||
|
|
||||||
// Display total
|
// Display total
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.classList.add('count');
|
elTd.classList.add('count');
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
elTd.innerText = ppVotes(result.total);
|
elTd.innerHTML = ppVotes(result.total);
|
||||||
elTotal.appendChild(elTd);
|
elTotal.appendChild(elTd);
|
||||||
|
|
||||||
// Display quota
|
// Display quota
|
||||||
@ -305,7 +289,7 @@ async function clickCount() {
|
|||||||
elTd.classList.add('count');
|
elTd.classList.add('count');
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
elTd.style.borderBottom = '1px solid black';
|
elTd.style.borderBottom = '1px solid black';
|
||||||
elTd.innerText = ppVotes(result.quota);
|
elTd.innerHTML = ppVotes(result.quota);
|
||||||
elQuota.appendChild(elTd);
|
elQuota.appendChild(elTd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,7 +338,11 @@ async function clickCount() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function ppVotes(v) {
|
function ppVotes(v) {
|
||||||
return parseFloat(v).toFixed(ppDPs);
|
result = parseFloat(v).toFixed(ppDPs);
|
||||||
|
if (parseFloat(result) == 0) {
|
||||||
|
return ' '
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user