summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-10-05 21:24:56 +0530
committerGitHub2017-10-05 21:24:56 +0530
commita626f3792d03ccd96a1c49c7096076950d020c5a (patch)
tree31364c34ce9b9165541e8e1b8e1c722f36399967 /yaksh/templates
parent72c9a0f2a84925b9f8096702aa702e1deb49e2ce (diff)
parentf5701e1c6ba3700b834257a4b84388485cb8818d (diff)
downloadonline_test-a626f3792d03ccd96a1c49c7096076950d020c5a.tar.gz
online_test-a626f3792d03ccd96a1c49c7096076950d020c5a.tar.bz2
online_test-a626f3792d03ccd96a1c49c7096076950d020c5a.zip
Merge pull request #346 from maheshgudi/hotfix7
Use MCQ/MCC testcases id instead of options to validate answer
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/yaksh/grade_user.html26
-rw-r--r--yaksh/templates/yaksh/question.html12
-rw-r--r--yaksh/templates/yaksh/user_data.html18
-rw-r--r--yaksh/templates/yaksh/view_answerpaper.html29
4 files changed, 69 insertions, 16 deletions
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index 2038210..37bc788 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -236,7 +236,7 @@ Status : <b style="color: green;"> Passed </b><br/>
<col width="40%">
<col width="40%">
<col width="10%">
- <tr class="info">
+ <tr>
<th><center>Line No.</center></th>
<th><center>Expected Output</center></th>
<th><center>User output</center></th>
@@ -256,7 +256,7 @@ Status : <b style="color: green;"> Passed </b><br/>
</table>
<table width="100%" class='table table-bordered'>
<col width="10">
- <tr class = "danger">
+ <tr>
<td><b>Error:</b></td>
<td>{{error.error_msg}}</td>
</tr>
@@ -268,12 +268,28 @@ Status : <b style="color: green;"> Passed </b><br/>
</div>
<div class="panel-body">
- {% if question.type != "code" %}
+ {% if question.type == "code" %}
+ <pre><code>{{ ans.answer.answer.strip|safe }}</code></pre>
+ {% elif question.type == "mcc"%}
<div class="well well-sm">
- {{ ans.answer.answer.strip|safe }}
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" in ans.answer.answer.strip|safe %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endif %}
+ {% endfor %}
+ </div>
+ {% elif question.type == "mcq"%}
+ <div class="well well-sm">
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" == ans.answer.answer.strip|safe %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endif %}
+ {% endfor %}
</div>
{% else %}
- <pre><code>{{ ans.answer.answer.strip|safe }}</code></pre>
+ <div class="well well-sm">
+ {{ ans.answer.answer.strip|safe }}
+ </div>
{% endif %}
</div>
</div>
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 }}"
<div class="panel-body">
{% if question.type == "mcq" %}
{% for test_case in test_cases %}
- {% if last_attempt and last_attempt|safe == test_case.options|safe %}
- <input name="answer" type="radio" value="{{ test_case.options }}" checked />
+ {% if last_attempt and last_attempt|safe == test_case.id|safe %}
+ <input name="answer" type="radio" value="{{ test_case.id }}" checked />
{{ test_case.options|safe }} <br/>
{% else %}
- <input name="answer" type="radio" value="{{ test_case.options }}" />
+ <input name="answer" type="radio" value="{{ test_case.id }}" />
{{ test_case.options|safe }} <br/>
{% 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 %}
- <input name="answer" type="checkbox" value="{{ test_case.options }}" checked/> {{ test_case.options }}
+ {% if last_attempt and test_case.id|safe in last_attempt|safe %}
+ <input name="answer" type="checkbox" value="{{ test_case.id }}" checked/> {{ test_case.options }}
<br>
{% else %}
- <input name="answer" type="checkbox" value="{{ test_case.options }}">
+ <input name="answer" type="checkbox" value="{{ test_case.id }}">
{{ test_case.options}}
<br/>
{% 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 }}
</div>
<div class="panel-body">
<h5><u>Student answer:</u></h5>
+ {% if question.type == "mcc"%}
+ <div class="well well-sm">
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" in answers.0.answer|safe %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endif %}
+ {% endfor %}
+ </div>
+ {% elif question.type == "mcq"%}
+ <div class="well well-sm">
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" == answers.0.answer|safe %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endif %}
+ {% endfor %}
+ </div>
+ {%else%}
<div class="well well-sm">
{{ answers.0.answer|safe }}
</div>
</div>
</div>
+ {% endif %}
{% else %}
<h5>Student answer: </h5>
{% for answer in answers %}
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html
index 9edff5a..850d789 100644
--- a/yaksh/templates/yaksh/view_answerpaper.html
+++ b/yaksh/templates/yaksh/view_answerpaper.html
@@ -82,16 +82,35 @@
Autocheck: {{ answers.0.error_list.0 }}
</div>
<div class="panel-body">
- <h5><u>Student answer:</u></h5>
- <div class="well well-sm">
- {{ answers.0.answer|safe }}
- {% if question.type == "upload" and has_user_assignment %}
+ {% if question.type == "mcc"%}
+ <div class="well well-sm">
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" in answers.0.answer|safe %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endif %}
+ {% endfor %}
+ </div>
+ {% elif question.type == "mcq"%}
+ <div class="well well-sm">
+ {% for testcases in question.get_test_cases %}
+ {%if testcases.id|stringformat:"i" == answers.0.answer|safe %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endif %}
+ {% endfor %}
+ </div>
+ {% elif question.type == "upload" and has_user_assignment %}
<a href="{{URL_ROOT}}/exam/download/user_assignment/{{question.id}}/{{data.user.id}}/{{paper.question_paper.quiz.id}}">
+ <div class="well well-sm">
<div class="panel">
Assignment File for {{ data.user.get_full_name.title }}
</div></a>
- {% endif %}
</div>
+ {% else %}
+ <h5><u>Student answer:</u></h5>
+ <div class="well well-sm">
+ {{ answers.0.answer|safe }}
+ </div>
+ {% endif %}
</div>
</div>
{% else %}