diff options
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/exam.html | 54 | ||||
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 57 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 3 | ||||
-rw-r--r-- | yaksh/templates/yaksh/user_data.html | 54 | ||||
-rw-r--r-- | yaksh/templates/yaksh/view_answerpaper.html | 52 |
5 files changed, 206 insertions, 14 deletions
diff --git a/yaksh/templates/exam.html b/yaksh/templates/exam.html index a18a962..45b85f0 100644 --- a/yaksh/templates/exam.html +++ b/yaksh/templates/exam.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load custom_filters %} {% block css%} <link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/dashboard.css" type="text/css" /> {% endblock %} @@ -77,13 +78,56 @@ {% if error_message %} <div class="row" id="error_panel"> {% for error in error_message %} - {% if error == "Correct answer" %} - <div class="panel panel-success"> - {% else %} <div class="panel panel-danger"> - {% endif %} <div class="panel-heading">Testcase No. {{ forloop.counter }}</div> - <div class="panel-body"><pre><code>{{ error }}</code></pre></div> + <div class="panel-body"> + <div class="well well-sm"> + {% if not error.expected_output %} + <pre><code> {{error|safe}} </code></pre> + {% else %} + {% 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_line_numbers 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_msg}}</td> + </tr> + </table> + + {% endif %} + </div> + </div> </div> {% endfor %} diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index c93ec10..9cdfb1a 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_line_numbers 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_msg}}</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/question.html b/yaksh/templates/yaksh/question.html index 0dad59d..ee33523 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -6,6 +6,7 @@ <link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/dashboard.css" type="text/css" /> <link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/question.css" type="text/css" /> <link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/codemirror/lib/codemirror.css" type="text/css" /> +<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/exam.css" type="text/css" /> <style> .CodeMirror{ border-style: groove; @@ -238,7 +239,7 @@ function call_skip(url) <div class="from-group"> {% if question.type == "mcq" or "mcc" or "integer" or "float" or "string" %} - <br><button class="btn btn-primary" type="submit" name="check" id="check">Submit Answer</button> + <br><button class="btn btn-primary" type="submit" name="check" id="check">Submit Answer</button> <br/> {% elif question.type == "upload" %} <br><button class="btn btn-primary" type="submit" name="check" id="check" onClick="return validate();">Upload</button> diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html index 6e62b66..a8adc22 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_line_numbers 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_msg}}</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..9edff5a 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_line_numbers 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_msg}}</td> + </tr> + </table> + </div> + {% endif %} + {% endfor %} + {% endwith %} <div class="panel-body"> <pre><code>{{ answer.answer.answer.strip }}</code></pre> </div> |