Disallow --no-immediate-elect with --quota-mode ers97/ers76

This commit is contained in:
RunasSudo 2022-11-06 14:57:19 +11:00
parent 631d4e770a
commit 131d32c781
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -248,10 +248,20 @@ impl STVOptions {
return Err(STVError::InvalidOptions("--subtract-nontransferable requires --transferable-only")); return Err(STVError::InvalidOptions("--subtract-nontransferable requires --transferable-only"));
} }
} }
if !self.immediate_elect && self.surplus_order != SurplusOrder::BySize { if !self.immediate_elect {
if self.surplus_order != SurplusOrder::BySize {
// Invalid because there is no other metric to determine which surplus to distribute // 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")); 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 { if self.min_threshold != "0" && self.defer_surpluses {
// TODO: NYI // TODO: NYI
return Err(STVError::InvalidOptions("--min-threshold is incompatible with --defer-surpluses (not yet implemented)")); return Err(STVError::InvalidOptions("--min-threshold is incompatible with --defer-surpluses (not yet implemented)"));