diff --git a/html/index.html b/html/index.html index 1680b3e..1d832c2 100644 --- a/html/index.html +++ b/html/index.html @@ -164,11 +164,11 @@ d.p. - +
Rounding:
diff --git a/html/index.js b/html/index.js index cf9f326..9c28c6a 100644 --- a/html/index.js +++ b/html/index.js @@ -102,6 +102,8 @@ async function clickCount() { document.getElementById('selSurplus').value, document.getElementById('selPapers').value == 'transferable', document.getElementById('selExclusion').value, + document.getElementById('chkBulkExclusion').checked, + document.getElementById('chkDeferSurpluses').checked, parseInt(document.getElementById('txtPPDP').value), ]; @@ -293,9 +295,9 @@ function changePreset() { document.getElementById('selQuotaCriterion').value = 'geq'; document.getElementById('selQuota').value = 'droop'; document.getElementById('selQuotaMode').value = 'static'; - //document.getElementById('chkBulkElection').checked = true; - //document.getElementById('chkBulkExclusion').checked = false; - //document.getElementById('chkDeferSurpluses').checked = false; + document.getElementById('chkBulkElection').checked = true; + document.getElementById('chkBulkExclusion').checked = false; + document.getElementById('chkDeferSurpluses').checked = false; document.getElementById('selNumbers').value = 'fixed'; document.getElementById('txtDP').value = '5'; document.getElementById('txtPPDP').value = '2'; @@ -313,9 +315,9 @@ function changePreset() { document.getElementById('selQuotaCriterion').value = 'geq'; document.getElementById('selQuota').value = 'droop'; document.getElementById('selQuotaMode').value = 'static'; - //document.getElementById('chkBulkElection').checked = true; - //document.getElementById('chkBulkExclusion').checked = true; - //document.getElementById('chkDeferSurpluses').checked = false; + document.getElementById('chkBulkElection').checked = true; + document.getElementById('chkBulkExclusion').checked = true; + document.getElementById('chkDeferSurpluses').checked = false; document.getElementById('selNumbers').value = 'fixed'; document.getElementById('txtDP').value = '5'; document.getElementById('txtPPDP').value = '0'; @@ -334,9 +336,9 @@ function changePreset() { document.getElementById('selQuotaCriterion').value = 'geq'; document.getElementById('selQuota').value = 'droop'; document.getElementById('selQuotaMode').value = 'static'; - //document.getElementById('chkBulkElection').checked = true; - //document.getElementById('chkBulkExclusion').checked = false; - //document.getElementById('chkDeferSurpluses').checked = true; + document.getElementById('chkBulkElection').checked = true; + document.getElementById('chkBulkExclusion').checked = false; + document.getElementById('chkDeferSurpluses').checked = true; document.getElementById('selNumbers').value = 'fixed'; document.getElementById('txtDP').value = '5'; document.getElementById('txtPPDP').value = '3'; @@ -357,9 +359,9 @@ function changePreset() { document.getElementById('selQuotaCriterion').value = 'geq'; document.getElementById('selQuota').value = 'droop_exact'; document.getElementById('selQuotaMode').value = 'ers97'; - //document.getElementById('chkBulkElection').checked = true; - //document.getElementById('chkBulkExclusion').checked = true; - //document.getElementById('chkDeferSurpluses').checked = true; + document.getElementById('chkBulkElection').checked = true; + document.getElementById('chkBulkExclusion').checked = true; + document.getElementById('chkDeferSurpluses').checked = true; document.getElementById('selNumbers').value = 'fixed'; document.getElementById('txtDP').value = '5'; document.getElementById('txtPPDP').value = '2'; diff --git a/src/stv/mod.rs b/src/stv/mod.rs index 0c2d323..e54358f 100644 --- a/src/stv/mod.rs +++ b/src/stv/mod.rs @@ -550,7 +550,7 @@ fn elect_meeting_quota(state: &mut CountState, opts: &STVOptions) } } -fn can_defer_surpluses(state: &CountState, opts: &STVOptions, has_surplus: &Vec<(&&Candidate, &CountCard)>, total_surpluses: &N) -> bool +fn can_defer_surpluses(state: &CountState, opts: &STVOptions, total_surpluses: &N) -> bool where for<'r> &'r N: ops::Sub<&'r N, Output=N> { @@ -593,7 +593,7 @@ where if has_surplus.len() > 0 { // Determine if surplues can be deferred if opts.defer_surpluses { - if can_defer_surpluses(state, opts, &has_surplus, &total_surpluses) { + if can_defer_surpluses(state, opts, &total_surpluses) { state.logger.log_literal(format!("Distribution of surpluses totalling {:.2} votes will be deferred.", total_surpluses)); return false; }