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
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A
1 changed files with 13 additions and 3 deletions

View File

@ -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