From 384dde9c52946efc958612dc4d56f367a58ed47f Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 18 Jun 2022 02:00:07 +1000 Subject: [PATCH] --subtract-nontransferable requires --surplus wig --- src/stv/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/stv/mod.rs b/src/stv/mod.rs index b9c88e6..20698a7 100644 --- a/src/stv/mod.rs +++ b/src/stv/mod.rs @@ -224,7 +224,10 @@ impl STVOptions { if self.sample_per_ballot && !self.immediate_elect { return Err(STVError::InvalidOptions("--sample-per-ballot is incompatible with --no-immediate-elect")); } if self.constraints_path.is_some() && self.constraint_mode == ConstraintMode::RepeatCount { return Err(STVError::InvalidOptions("--constraint-mode repeat_count requires a Gregory method for --surplus")); } // TODO: NYI? } - if self.subtract_nontransferable && !self.transferable_only { return Err(STVError::InvalidOptions("--subtract-nontransferable requires --transferable-only")) } + if self.subtract_nontransferable { + if self.surplus != SurplusMethod::WIG { return Err(STVError::InvalidOptions("--subtract-nontransferable requires --surplus wig")) } + if !self.transferable_only { return Err(STVError::InvalidOptions("--subtract-nontransferable requires --transferable-only")) } + } if self.min_threshold != "0" && self.defer_surpluses { return Err(STVError::InvalidOptions("--min-threshold is incompatible with --defer-surpluses (not yet implemented)")); } // TODO: NYI if self.round_subtransfers == RoundSubtransfersMode::ByValueAndSource && self.bulk_exclude { return Err(STVError::InvalidOptions("--round-subtransfers by_value_and_source is incompatible with --bulk-exclude (not yet implemented)")); } // TODO: NYI return Ok(());