Skip to content

Commit

Permalink
fix election order callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Bowland committed Aug 9, 2016
1 parent 3b15823 commit 7dfe92d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions dividebatur/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,23 +239,20 @@ def run(self):

def resolve_election_order(self, candidate_permutations):
"""
call the callback set with `set_election_order_callback`,
to break the tie.
call callback to break an election order tie.
"""
return self.election_order_callback(candidate_permutations)
return self.election_order_cb(candidate_permutations)

def resolve_exclusion_tie(self, candidates):
"""
call the function (set with `set_candidate_tie_callback`)
to resolve a tie between candidates
call callback to resolve a tie between candidates
"""
sorted_candidate_ids = list(sorted(candidates, key=self.candidate_order_fn))
return sorted_candidate_ids[self.exclusion_tie_cb(candidates)]

def resolve_election_tie(self, candidates):
"""
call the function (set with `set_candidate_tie_callback`)
to resolve a tie between candidates
call callback to resolve a tie between candidates
"""
sorted_candidate_ids = list(sorted(candidates, key=self.candidate_order_fn))
return sorted_candidate_ids[self.election_tie_cb(candidates)]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
keywords="stv senate voting",
url="https://github.com/grahame/dividebatur",
name="dividebatur",
version="0.10.0",
version="0.10.1",
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
extras_require={
'dev': dev_requires
Expand Down

0 comments on commit 7dfe92d

Please sign in to comment.