Commit de0fd379 authored by Ossi Laine's avatar Ossi Laine
Browse files

Use prefilled list for basis to the results

parent 431c7ceb
......@@ -5,6 +5,9 @@ from itertools import zip_longest
from flask import send_file
from app import app
def timeit(method):
def timed(*args, **kw):
ts = time.time()
......@@ -82,20 +85,21 @@ def map_answers_to_questions(answers, questions):
partial_answer = [None, None, None, None, 100, 99]
'''
# results = []
results = list(map(lambda x: None, questions))
nth_answer = 0
results = []
for question in questions:
for nth_question, question in enumerate(questions):
current_answer = answers[nth_answer]
try:
current_answer = answers[nth_answer]
except IndexError:
break
if question_matches_answer(question, current_answer):
results.append(int(current_answer.answer))
results[nth_question] = int(current_answer.answer)
nth_answer += 1
else:
results.append(None)
return results
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment