Report method of breaking ties
This commit is contained in:
parent
1e2f74e60b
commit
d5db9b5df6
@ -650,6 +650,7 @@ class BaseSTVCounter:
|
|||||||
for tie in self.options['ties']:
|
for tie in self.options['ties']:
|
||||||
result = tie.choose_lowest(tied)
|
result = tie.choose_lowest(tied)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
|
self.logs.append('A tie for last place was resolved ' + tie.adverb + ' against ' + result[0].name + '.')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
raise STVException('Unable to resolve tie')
|
raise STVException('Unable to resolve tie')
|
||||||
@ -674,6 +675,7 @@ class BaseSTVCounter:
|
|||||||
for tie in self.options['ties']:
|
for tie in self.options['ties']:
|
||||||
result = tie.choose_highest(tied)
|
result = tie.choose_highest(tied)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
|
self.logs.append('A tie for first place was resolved ' + tie.adverb + ' in favour of ' + result[0].name + '.')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
raise STVException('Unable to resolve tie')
|
raise STVException('Unable to resolve tie')
|
||||||
|
@ -31,6 +31,8 @@ class RequireInput(Exception): # pragma: no cover
|
|||||||
class TiesPrompt:
|
class TiesPrompt:
|
||||||
"""Prompt the user to break ties"""
|
"""Prompt the user to break ties"""
|
||||||
|
|
||||||
|
adverb = 'manually'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.buffer = None
|
self.buffer = None
|
||||||
|
|
||||||
@ -83,6 +85,8 @@ class TiesBackwards:
|
|||||||
all other tied candidates, if such a stage exists
|
all other tied candidates, if such a stage exists
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
adverb = 'backwards'
|
||||||
|
|
||||||
def __init__(self, counter):
|
def __init__(self, counter):
|
||||||
self.counter = counter
|
self.counter = counter
|
||||||
|
|
||||||
@ -113,6 +117,8 @@ class TiesForwards:
|
|||||||
all other tied candidates, if such a stage exists
|
all other tied candidates, if such a stage exists
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
adverb = 'forwards'
|
||||||
|
|
||||||
def __init__(self, counter):
|
def __init__(self, counter):
|
||||||
self.counter = counter
|
self.counter = counter
|
||||||
|
|
||||||
@ -139,6 +145,8 @@ class TiesForwards:
|
|||||||
class TiesRandom:
|
class TiesRandom:
|
||||||
"""Break ties randomly, using the SHARandom deterministic RNG"""
|
"""Break ties randomly, using the SHARandom deterministic RNG"""
|
||||||
|
|
||||||
|
adverb = 'randomly'
|
||||||
|
|
||||||
def __init__(self, seed):
|
def __init__(self, seed):
|
||||||
self.random = SHARandom(seed)
|
self.random = SHARandom(seed)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user