Fix bug/handling of withdrawn candidates in Meek STV
This commit is contained in:
parent
5f9d18cb04
commit
77c5cfca75
@ -46,6 +46,12 @@ class MeekSTVCounter(BaseSTVCounter):
|
|||||||
BaseSTVCounter.__init__(self, *args)
|
BaseSTVCounter.__init__(self, *args)
|
||||||
self.candidates = SafeDict([(c, MeekCountCard()) for c in self.election.candidates])
|
self.candidates = SafeDict([(c, MeekCountCard()) for c in self.election.candidates])
|
||||||
|
|
||||||
|
# Withdraw candidates
|
||||||
|
for candidate in self.election.withdrawn:
|
||||||
|
__pragma__('opov')
|
||||||
|
self.candidates[candidate].state = CandidateState.WITHDRAWN
|
||||||
|
__pragma__('noopov')
|
||||||
|
|
||||||
self._quota_tolerance = Num('1.0001')
|
self._quota_tolerance = Num('1.0001')
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
@ -117,7 +123,7 @@ class MeekSTVCounter(BaseSTVCounter):
|
|||||||
__pragma__('noopov')
|
__pragma__('noopov')
|
||||||
remaining_value = Num(0)
|
remaining_value = Num(0)
|
||||||
break
|
break
|
||||||
elif count_card.state == CandidateState.EXCLUDED:
|
elif count_card.state == CandidateState.EXCLUDED or count_card.state == CandidateState.WITHDRAWN:
|
||||||
# Excluded candidate has keep value 0, so skip over this candidate
|
# Excluded candidate has keep value 0, so skip over this candidate
|
||||||
pass
|
pass
|
||||||
elif count_card.state == CandidateState.ELECTED:
|
elif count_card.state == CandidateState.ELECTED:
|
||||||
|
Reference in New Issue
Block a user