summaryrefslogtreecommitdiff
path: root/exam/management/commands/dump_user_data.py
diff options
context:
space:
mode:
Diffstat (limited to 'exam/management/commands/dump_user_data.py')
-rw-r--r--exam/management/commands/dump_user_data.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/exam/management/commands/dump_user_data.py b/exam/management/commands/dump_user_data.py
index f081565..6e0ca2a 100644
--- a/exam/management/commands/dump_user_data.py
+++ b/exam/management/commands/dump_user_data.py
@@ -34,12 +34,20 @@ Answers
-------
{% for question, answers in paper.get_question_answers.items %}
Question: {{ question.id }}. {{ question.summary }} (Points: {{ question.points }})
+{% if question.type == "mcq" %}\
+###############################################################################
+Choices: {% for option in question.options.strip.splitlines %} {{option}}, {% endfor %}
+Student answer: {{ answers.0|safe }}
+{% else %}{# non-mcq questions #}\
{% for answer in answers %}\
###############################################################################
-{{ answer.answer|safe }}
+{{ answer.answer.strip|safe }}
# Autocheck: {{ answer.error|safe }}
-# Marks: {{ answer.marks }}
{% endfor %}{# for answer in answers #}\
+{% endif %}\
+{% with answers|last as answer %}\
+Marks: {{answer.marks}}
+{% endwith %}\
{% endfor %}{# for question, answers ... #}\
Teacher comments