diff --git a/server/app/views.py b/server/app/views.py index d7f6e87..33be51b 100644 --- a/server/app/views.py +++ b/server/app/views.py @@ -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())