diff --git a/pyRCV2/method/base_stv.py b/pyRCV2/method/base_stv.py index 4ff1c6e..d69dfa2 100644 --- a/pyRCV2/method/base_stv.py +++ b/pyRCV2/method/base_stv.py @@ -650,6 +650,7 @@ class BaseSTVCounter: for tie in self.options['ties']: result = tie.choose_lowest(tied) if result is not None: + self.logs.append('A tie for last place was resolved ' + tie.adverb + ' against ' + result[0].name + '.') return result raise STVException('Unable to resolve tie') @@ -674,6 +675,7 @@ class BaseSTVCounter: for tie in self.options['ties']: result = tie.choose_highest(tied) 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 raise STVException('Unable to resolve tie') diff --git a/pyRCV2/ties.py b/pyRCV2/ties.py index cfc2f76..34a8751 100644 --- a/pyRCV2/ties.py +++ b/pyRCV2/ties.py @@ -31,6 +31,8 @@ class RequireInput(Exception): # pragma: no cover class TiesPrompt: """Prompt the user to break ties""" + adverb = 'manually' + def __init__(self): self.buffer = None @@ -83,6 +85,8 @@ class TiesBackwards: all other tied candidates, if such a stage exists """ + adverb = 'backwards' + def __init__(self, counter): self.counter = counter @@ -113,6 +117,8 @@ class TiesForwards: all other tied candidates, if such a stage exists """ + adverb = 'forwards' + def __init__(self, counter): self.counter = counter @@ -139,6 +145,8 @@ class TiesForwards: class TiesRandom: """Break ties randomly, using the SHARandom deterministic RNG""" + adverb = 'randomly' + def __init__(self, seed): self.random = SHARandom(seed)