Bugfix: adding zero counts that were skipped
This commit is contained in:
parent
b2df303632
commit
0c49d22865
@ -37,16 +37,15 @@ def _playbooks():
|
||||
|
||||
@views.route('/answers/')
|
||||
def _answers():
|
||||
answers = {}
|
||||
answers = { }
|
||||
for index, question in enumerate(render_questions()):
|
||||
answers[index] = { }
|
||||
for _index, answer in enumerate(question['answers']): answers[index][_index] = 0
|
||||
for entry in Entry.query.all():
|
||||
for index, answer in enumerate(entry.answers):
|
||||
if index not in answers: answers[index] = { }
|
||||
if type(answer) is list:
|
||||
for option in answer:
|
||||
if option not in answers[index]: answers[index][option] = 0
|
||||
answers[index][option] += 1
|
||||
for option in answer: answers[index][option] += 1
|
||||
else:
|
||||
if answer not in answers[index]: answers[index][answer] = 0
|
||||
answers[index][answer] += 1
|
||||
return list(answers.values())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user