--subtract-nontransferable requires --surplus wig

This commit is contained in:
RunasSudo 2022-06-18 02:00:07 +10:00
parent 2987eca0c3
commit 384dde9c52
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -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(());