- {% if question.type != "code" %}
+ {% if question.type == "code" %}
+
{{ ans.answer.answer.strip|safe }}
+ {% elif question.type == "mcc"%}
- {{ ans.answer.answer.strip|safe }}
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" in ans.answer.answer.strip|safe %}
+
{{ testcases.options.strip|safe }}
+ {% endif %}
+ {% endfor %}
+
+ {% elif question.type == "mcq"%}
+
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" == ans.answer.answer.strip|safe %}
+
{{ testcases.options.strip|safe }}
+ {% endif %}
+ {% endfor %}
{% else %}
-
{{ ans.answer.answer.strip|safe }}
+
+ {{ ans.answer.answer.strip|safe }}
+
{% endif %}
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index bc7acf1..1e1f38f 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -153,11 +153,11 @@ lang = "{{ question.language }}"
{% if question.type == "mcq" %}
{% for test_case in test_cases %}
- {% if last_attempt and last_attempt|safe == test_case.options|safe %}
-
+ {% if last_attempt and last_attempt|safe == test_case.id|safe %}
+
{{ test_case.options|safe }}
{% else %}
-
+
{{ test_case.options|safe }}
{% endif %}
{% endfor %}
@@ -183,11 +183,11 @@ lang = "{{ question.language }}"
{% if question.type == "mcc" %}
{% for test_case in test_cases %}
- {% if last_attempt and test_case.options|safe in last_attempt|safe %}
- {{ test_case.options }}
+ {% if last_attempt and test_case.id|safe in last_attempt|safe %}
+ {{ test_case.options }}
{% else %}
-
+
{{ test_case.options}}
{% endif %}
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html
index a8adc22..31a023d 100644
--- a/yaksh/templates/yaksh/user_data.html
+++ b/yaksh/templates/yaksh/user_data.html
@@ -104,11 +104,29 @@ User IP address: {{ paper.user_ip }}
Student answer:
+ {% if question.type == "mcc"%}
+
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" in answers.0.answer|safe %}
+
{{ testcases.options.strip|safe }}
+ {% endif %}
+ {% endfor %}
+
+ {% elif question.type == "mcq"%}
+
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" == answers.0.answer|safe %}
+
{{ testcases.options.strip|safe }}
+ {% endif %}
+ {% endfor %}
+
+ {%else%}
{{ answers.0.answer|safe }}
+ {% endif %}
{% else %}
{% else %}
--
cgit