summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormahesh2017-05-17 18:29:33 +0530
committermahesh2017-05-17 18:29:33 +0530
commit6c4ab452538fd23d67c1c2d508cb4768e601d688 (patch)
tree0bdaa025a1a427b7bfe79b47c6d5248f4d8013a1
parent94f51e9c4286224057a404e48fad5069a4ed332c (diff)
downloadonline_test-6c4ab452538fd23d67c1c2d508cb4768e601d688.tar.gz
online_test-6c4ab452538fd23d67c1c2d508cb4768e601d688.tar.bz2
online_test-6c4ab452538fd23d67c1c2d508cb4768e601d688.zip
changes answerpaper design to accommodate new stdio error look
-rw-r--r--yaksh/templates/yaksh/grade_user.html57
-rw-r--r--yaksh/templates/yaksh/user_data.html54
-rw-r--r--yaksh/templates/yaksh/view_answerpaper.html52
3 files changed, 155 insertions, 8 deletions
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index c93ec10..a711fc2 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -1,4 +1,5 @@
{% extends "manage.html" %}
+{% load custom_filters %}
{% block title %} Grade User {% endblock %}
@@ -132,6 +133,7 @@ Status : <b style="color: green;"> Passed </b><br/>
{% csrf_token %}
{% for question, answers in paper.get_question_answers.items %}
+<div class = "well well-sm">
<div class="panel panel-info">
<div class="panel-heading">
<strong> Details: {{forloop.counter}}. {{ question.summary }}
@@ -198,10 +200,57 @@ Status : <b style="color: green;"> Passed </b><br/>
<div class="panel panel-danger">
<div class="panel-heading">Error:
{% endif %}
- {% for err in ans.error_list %}
- <div><pre>{{ err }}</pre></div>
- {% endfor %}
+ {% with ans.error_list as err %}
+ {% for error in err %}
+ {% if not error.expected_output %}
+ <pre><code> {{error|safe}} </code></pre>
+ {% else %}
+ <div class = "well well-sm">
+ {% if error.given_input %}
+ <table class="table table-bordered">
+ <col width="30%">
+ <tr class = "active">
+ <td> For given Input value(s):</td>
+ <td>{{error.given_input}}</td>
+ </tr>
+ </table>
+ {% endif %}
+ <table class="table table-bordered" width="100%" id="output">
+ <col width="10%">
+ <col width="40%">
+ <col width="40%">
+ <col width="10%">
+ <tr class="info">
+ <th><center>Line No.</center></th>
+ <th><center>Expected Output</center></th>
+ <th><center>User output</center></th>
+ <th><center>Status</center></th>
+ </tr>
+ {% for expected,user in error.expected_output|zip:error.user_output %}
+ <td> {{forloop.counter}} </td>
+ <td>{{expected|default:""}} </td>
+ <td>{{user|default:""}}</td>
+ {% if forloop.counter0 in error.error_no or not expected or not user %}
+ <td><span class ="glyphicon glyphicon-remove text-warning"/></td>
+ {% else %}
+ <td><span class ="glyphicon glyphicon-ok text-success"/></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </table>
+ <table width="100%" class='table table-bordered'>
+ <col width="10">
+ <tr class = "danger">
+ <td><b>Error:</b></td>
+ <td>{{error.error}}</td>
+ </tr>
+ </table>
</div>
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
+ </div>
+
<div class="panel-body">
{% if question.type != "code" %}
<div class="well well-sm">
@@ -220,6 +269,7 @@ Status : <b style="color: green;"> Passed </b><br/>
value="{{ answer.answer.marks }}"><br><br>
{% endwith %}
<hr/>
+ </div>
{% endfor %} {# for question, answers ... #}
<div class="form-group">
<h3>Teacher comments: </h3>
@@ -233,6 +283,7 @@ Status : <b style="color: green;"> Passed </b><br/>
{% endif %} {# if paper.answers.count #}
+
{% endfor %} {# for paper in data.papers #}
{% endif %} {# if data.papers #}
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html
index 6e62b66..1af27e6 100644
--- a/yaksh/templates/yaksh/user_data.html
+++ b/yaksh/templates/yaksh/user_data.html
@@ -1,4 +1,5 @@
{% extends "manage.html" %}
+{% load custom_filters %}
{% block pagetitle %} Data for user {{ data.user.get_full_name.title }} {% endblock pagetitle %}
@@ -118,11 +119,56 @@ User IP address: {{ paper.user_ip }}
{% else %}
<div class="panel panel-danger">
<div class="panel-heading">Error
-
- {% for error in answer.error_list %}
- <div><pre><code>{{ error }}</code></pre></div>
+ {% with answer.error_list as err %}
+ {% for error in err %}
+ {% if not error.expected_output %}
+ <pre><code> {{error|safe}} </code></pre>
+ {% else %}
+ <div class = "well well-sm">
+ {% if error.given_input %}
+ <table class="table table-bordered">
+ <col width="30%">
+ <tr class = "active">
+ <td> For given Input value(s):</td>
+ <td>{{error.given_input}}</td>
+ </tr>
+ </table>
+ {% endif %}
+ <table class="table table-bordered" width="100%" id="output">
+ <col width="10%">
+ <col width="40%">
+ <col width="40%">
+ <col width="10%">
+ <tr class="info">
+ <th><center>Line No.</center></th>
+ <th><center>Expected Output</center></th>
+ <th><center>User output</center></th>
+ <th><center>Status</center></th>
+ </tr>
+ {% for expected,user in error.expected_output|zip:error.user_output %}
+ <td> {{forloop.counter}} </td>
+ <td>{{expected|default:""}} </td>
+ <td>{{user|default:""}}</td>
+ {% if forloop.counter0 in error.error_no or not expected or not user %}
+ <td><span class ="glyphicon glyphicon-remove text-warning"/></td>
+ {% else %}
+ <td><span class ="glyphicon glyphicon-ok text-success"/></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </table>
+ <table width="100%" class='table table-bordered'>
+ <col width="10">
+ <tr class = "danger">
+ <td><b>Error:</b></td>
+ <td>{{error.error}}</td>
+ </tr>
+ </table>
+ </div>
+ {% endif %}
{% endfor %}
- {% endif %}
+ {% endwith %}
+ {% endif %}
</div>
<div class="panel-body">
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html
index f4c8846..71536eb 100644
--- a/yaksh/templates/yaksh/view_answerpaper.html
+++ b/yaksh/templates/yaksh/view_answerpaper.html
@@ -1,4 +1,5 @@
{% extends "user.html" %}
+{% load custom_filters %}
{% block pagetitle %} Answer Paper for {{ quiz.description }}{% endblock pagetitle %}
@@ -102,7 +103,56 @@
{% else %}
<div class="panel panel-danger">
{% endif %}
- <div class="panel-heading">Autocheck: {{ answer.error }}</div>
+ <div class="panel-heading">Error:</div>
+ {% with answer.error_list as err %}
+ {% for error in err %}
+ {% if not error.expected_output %}
+ <pre><code> {{error|safe}} </code></pre>
+ {% else %}
+ <div class = "well well-sm">
+ {% if error.given_input %}
+ <table class="table table-bordered">
+ <col width="30%">
+ <tr class = "active">
+ <td> For given Input value(s):</td>
+ <td>{{error.given_input}}</td>
+ </tr>
+ </table>
+ {% endif %}
+ <table class="table table-bordered" width="100%" id="output">
+ <col width="10%">
+ <col width="40%">
+ <col width="40%">
+ <col width="10%">
+ <tr class="info">
+ <th><center>Line No.</center></th>
+ <th><center>Expected Output</center></th>
+ <th><center>User output</center></th>
+ <th><center>Status</center></th>
+ </tr>
+ {% for expected,user in error.expected_output|zip:error.user_output %}
+ <td> {{forloop.counter}} </td>
+ <td>{{expected|default:""}} </td>
+ <td>{{user|default:""}}</td>
+ {% if forloop.counter0 in error.error_no or not expected or not user %}
+ <td><span class ="glyphicon glyphicon-remove text-warning"/></td>
+ {% else %}
+ <td><span class ="glyphicon glyphicon-ok text-success"/></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </table>
+ <table width="100%" class='table table-bordered'>
+ <col width="10">
+ <tr class = "danger">
+ <td><b>Error:</b></td>
+ <td>{{error.error}}</td>
+ </tr>
+ </table>
+ </div>
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
<div class="panel-body">
<pre><code>{{ answer.answer.answer.strip }}</code></pre>
</div>