Fix BLT export with multiple results

This commit is contained in:
RunasSudo 2017-12-17 12:16:53 +10:30
parent 764660f317
commit 87eae9c32f
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 4 additions and 1 deletions

View File

@ -26,7 +26,10 @@ def writeBLT(election, q_num, seats, withdrawn=[]):
if len(withdrawn) > 0:
electionLines.append(' '.join(['-{}'.format(flat_choices.index(candidate) + 1) for candidate in withdrawn]))
result = election.results[q_num].count()
result_obj = election.results[q_num]
if result_obj._name == 'eos.base.election.MultipleResult':
result_obj = next(x for x in result_obj.results if x._name == 'eos.base.election.RawResult')
result = result_obj.count()
for answer, count in result:
if answer.choices: