fnp
/
edumed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a3aa46d
)
fix answer persistance
author
Jan Szejko
<janek37@gmail.com>
Fri, 14 Oct 2016 15:14:08 +0000
(17:14 +0200)
committer
Jan Szejko
<janek37@gmail.com>
Fri, 14 Oct 2016 15:14:08 +0000
(17:14 +0200)
wtem/views.py
patch
|
blob
|
history
diff --git
a/wtem/views.py
b/wtem/views.py
index
7726167
..
504fa5b
100644
(file)
--- a/
wtem/views.py
+++ b/
wtem/views.py
@@
-49,9
+49,12
@@
def form_during(request, key):
else:
return render(request, 'wtem/key_not_found.html')
exercises_with_answers = deepcopy(exercises)
else:
return render(request, 'wtem/key_not_found.html')
exercises_with_answers = deepcopy(exercises)
- answers = json.loads(submission.answers)
+ if submission.answers:
+ answers = json.loads(submission.answers)
+ else:
+ answers = {}
for exercise in exercises_with_answers:
for exercise in exercises_with_answers:
- exercise['saved_answer'] = answers
[str(exercise['id'])]
+ exercise['saved_answer'] = answers
.get(str(exercise['id']), {})
if exercise['type'] == 'open' and exercise.get('fields'):
field_answers = {field['id']: field['text'] for field in exercise['saved_answer']}
for field in exercise['fields']:
if exercise['type'] == 'open' and exercise.get('fields'):
field_answers = {field['id']: field['text'] for field in exercise['saved_answer']}
for field in exercise['fields']: