From 131d32c781d2b4ad6e9b1ad02554e057fc39144f Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sun, 6 Nov 2022 14:57:19 +1100 Subject: [PATCH] Disallow --no-immediate-elect with --quota-mode ers97/ers76 --- src/stv/options.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/stv/options.rs b/src/stv/options.rs index e14ec82..1c821d6 100644 --- a/src/stv/options.rs +++ b/src/stv/options.rs @@ -248,9 +248,19 @@ impl STVOptions { return Err(STVError::InvalidOptions("--subtract-nontransferable requires --transferable-only")); } } - if !self.immediate_elect && self.surplus_order != SurplusOrder::BySize { - // Invalid because there is no other metric to determine which surplus to distribute - return Err(STVError::InvalidOptions("--no-immediate-elect requires --surplus-order by_size")); + if !self.immediate_elect { + if self.surplus_order != SurplusOrder::BySize { + // Invalid because there is no other metric to determine which surplus to distribute + return Err(STVError::InvalidOptions("--no-immediate-elect requires --surplus-order by_size")); + } + if self.quota_mode == QuotaMode::ERS97 { + // Invalid because candidates meeting the VRE never have surpluses distributed + return Err(STVError::InvalidOptions("--no-immediate-elect is incompatible with --quota-mode ers97")); + } + if self.quota_mode == QuotaMode::ERS76 { + // Invalid because candidates meeting the VRE never have surpluses distributed + return Err(STVError::InvalidOptions("--no-immediate-elect is incompatible with --quota-mode ers76")); + } } if self.min_threshold != "0" && self.defer_surpluses { // TODO: NYI