Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Server maintenance on Tue 31.5. at 12:00.
Open sidebar
Timo Heikkilä
PET-rating
Commits
de0fd379
Commit
de0fd379
authored
Jun 04, 2020
by
Ossi Laine
Browse files
Use prefilled list for basis to the results
parent
431c7ceb
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/utils.py
View file @
de0fd379
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment