Display vote required for election

This commit is contained in:
RunasSudo 2021-01-05 01:44:29 +11:00
parent ee1a375b46
commit 71447d49b5
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 27 additions and 3 deletions

View File

@ -161,7 +161,7 @@ async function clickCount() {
// Step election // Step election
let worker = new Worker('worker.js'); let worker = new Worker('worker.js');
let election, elComment, elExhausted1, elExhausted2, elLTF1, elLTF2, elTotal, elQuota; let election, elComment, elExhausted1, elExhausted2, elLTF1, elLTF2, elTotal, elQuota, elVRE;
worker.onmessage = function(evt) { worker.onmessage = function(evt) {
if (evt.data.type === 'require_input') { if (evt.data.type === 'require_input') {
@ -249,6 +249,18 @@ async function clickCount() {
elTd.innerText = 'Quota'; elTd.innerText = 'Quota';
elQuota.appendChild(elTd); elQuota.appendChild(elTd);
tblResults.appendChild(elQuota); tblResults.appendChild(elQuota);
// Vote required for election row
if (document.getElementById('selQuotaMode').value === 'ers97') {
elVRE = document.createElement('tr');
elVRE.classList.add('info');
elTd = document.createElement('td');
elTd.style.borderTop = '1px solid black';
elTd.style.borderBottom = '1px solid black';
elTd.innerText = 'Vote required for election';
elVRE.appendChild(elTd);
tblResults.appendChild(elVRE);
}
} }
if (evt.data.type === 'result') { if (evt.data.type === 'result') {
@ -338,6 +350,16 @@ async function clickCount() {
elTd.style.borderBottom = '1px solid black'; elTd.style.borderBottom = '1px solid black';
elTd.innerHTML = ppVotes(result.quota); elTd.innerHTML = ppVotes(result.quota);
elQuota.appendChild(elTd); elQuota.appendChild(elTd);
// Display vote required for election
if (result.vote_required_election !== null) {
elTd = document.createElement('td');
elTd.classList.add('count');
elTd.style.borderTop = '1px solid black';
elTd.style.borderBottom = '1px solid black';
elTd.innerHTML = ppVotes(result.vote_required_election);
elVRE.appendChild(elTd);
}
} }
} }

View File

@ -82,7 +82,8 @@ onmessage = function(evt) {
'votes': result.loss_fraction.votes.pp(ppDP) 'votes': result.loss_fraction.votes.pp(ppDP)
}, },
'total': result.total.pp(ppDP), 'total': result.total.pp(ppDP),
'quota': result.quota.pp(ppDP) 'quota': result.quota.pp(ppDP),
'vote_required_election': result.vote_required_election === null ? null : result.vote_required_election.pp(ppDP),
}}); }});
stepElection(); stepElection();
@ -134,7 +135,8 @@ function stepElection() {
'votes': result.loss_fraction.votes.pp(ppDP) 'votes': result.loss_fraction.votes.pp(ppDP)
}, },
'total': result.total.pp(ppDP), 'total': result.total.pp(ppDP),
'quota': result.quota.pp(ppDP) 'quota': result.quota.pp(ppDP),
'vote_required_election': result.vote_required_election === null ? null : result.vote_required_election.pp(ppDP),
}}); }});
} }
} }