Display vote required for election
This commit is contained in:
parent
ee1a375b46
commit
71447d49b5
@ -161,7 +161,7 @@ async function clickCount() {
|
||||
|
||||
// Step election
|
||||
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) {
|
||||
if (evt.data.type === 'require_input') {
|
||||
@ -249,6 +249,18 @@ async function clickCount() {
|
||||
elTd.innerText = 'Quota';
|
||||
elQuota.appendChild(elTd);
|
||||
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') {
|
||||
@ -338,6 +350,16 @@ async function clickCount() {
|
||||
elTd.style.borderBottom = '1px solid black';
|
||||
elTd.innerHTML = ppVotes(result.quota);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,8 @@ onmessage = function(evt) {
|
||||
'votes': result.loss_fraction.votes.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();
|
||||
@ -134,7 +135,8 @@ function stepElection() {
|
||||
'votes': result.loss_fraction.votes.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),
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user