diff options
author | maheshgudi | 2017-11-06 20:05:40 +0530 |
---|---|---|
committer | maheshgudi | 2017-11-07 14:50:09 +0530 |
commit | caf37373ec546d53db7caaf8aca9d5550d0ed4ad (patch) | |
tree | f1079a10b0c0d4b6c3f34884dc82316fc922ea6b /yaksh | |
parent | 08c076b7945dec8257efc10db4c9b141a8cf7f8c (diff) | |
download | online_test-caf37373ec546d53db7caaf8aca9d5550d0ed4ad.tar.gz online_test-caf37373ec546d53db7caaf8aca9d5550d0ed4ad.tar.bz2 online_test-caf37373ec546d53db7caaf8aca9d5550d0ed4ad.zip |
Modify answerpaper wrt to changes in assertion error output
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 31 | ||||
-rw-r--r-- | yaksh/templates/yaksh/user_data.html | 32 | ||||
-rw-r--r-- | yaksh/templates/yaksh/view_answerpaper.html | 31 |
3 files changed, 84 insertions, 10 deletions
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 37bc788..3339177 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -218,9 +218,8 @@ Status : <b style="color: green;"> Passed </b><br/> {% endif %} {% with ans.error_list as err %} {% for error in err %} - {% if not error.expected_output %} - <pre><code> {{error|safe}} </code></pre> - {% else %} + + {% if error.type == 'stdio' %} <div class = "well well-sm"> {% if error.given_input %} <table class="table table-bordered"> @@ -262,6 +261,32 @@ Status : <b style="color: green;"> Passed </b><br/> </tr> </table> </div> + {% elif error.type == 'assertion' %} + {% if error.test_case %} + <strong> We tried you code with the following test case:</strong><br/></br> + <pre><code><strong style="color:#d9534f">{{error.test_case}}</strong></code></pre> + {% endif %} + <p> <b>The following error took place: </b></p> + <div class="well well-sm"> + <table class="table table-bordered" width="100%"> + <col width="30%"> + <tr class = "active"> + <td><b>Exception Name: </b></td> + <td><span style="color: #d9534f">{{error.exception}}</span></td> + </tr> + <tr> + <td><b>Exception Message: </b></td><td>{{error.message}}</td> + </tr> + <tr> + {% if error.traceback %} + <td><b>Full Traceback: </b></td> + <td><pre>{{error.traceback}}</pre></td> + {% endif %} + </tr> + </table> + </div> <!-- Closes well --> + {% else %} + <pre><code> {{error|safe}} </code></pre> {% endif %} {% endfor %} {% endwith %} diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html index 6dfaac3..a0219dd 100644 --- a/yaksh/templates/yaksh/user_data.html +++ b/yaksh/templates/yaksh/user_data.html @@ -136,12 +136,10 @@ User IP address: {{ paper.user_ip }} <div class="panel-heading">Correct answer {% else %} <div class="panel panel-danger"> - <div class="panel-heading">Error + <div class="panel-heading">Error<br/> {% with answer.error_list as err %} {% for error in err %} - {% if not error.expected_output %} - <pre><code> {{error|safe}} </code></pre> - {% else %} + {% if error.type == 'stdio' %} <div class = "well well-sm"> {% if error.given_input %} <table class="table table-bordered"> @@ -183,6 +181,32 @@ User IP address: {{ paper.user_ip }} </tr> </table> </div> + {% elif error.type == 'assertion' %} + {% if error.test_case %} + <strong> We tried you code with the following test case:</strong><br/></br> + <pre><code><strong style="color:#d9534f">{{error.test_case}}</strong></code></pre> + {% endif %} + <p> <b>The following error took place: </b></p> + <div class="well well-sm"> + <table class="table table-bordered" width="100%"> + <col width="30%"> + <tr class = "active"> + <td><b>Exception Name: </b></td> + <td><span style="color: #d9534f">{{error.exception}}</span></td> + </tr> + <tr> + <td><b>Exception Message: </b></td><td>{{error.message}}</td> + </tr> + <tr> + {% if error.traceback %} + <td><b>Full Traceback: </b></td> + <td><pre>{{error.traceback}}</pre></td> + {% endif %} + </tr> + </table> + </div> <!-- Closes well --> + {% else %} + <pre><code> {{error|safe}} </code></pre> {% endif %} {% endfor %} {% endwith %} diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html index 79987b1..fa16a08 100644 --- a/yaksh/templates/yaksh/view_answerpaper.html +++ b/yaksh/templates/yaksh/view_answerpaper.html @@ -131,9 +131,8 @@ {% with answer.error_list as err %} {% for error in err %} - {% if not error.expected_output %} - <pre><code> {{error|safe}} </code></pre> - {% else %} + + {% if error.type == 'stdio' %} <div class = "well well-sm"> {% if error.given_input %} <table class="table table-bordered"> @@ -175,6 +174,32 @@ </tr> </table> </div> + {% elif error.type == 'assertion' %} + {% if error.test_case %} + <strong> We tried you code with the following test case:</strong><br/></br> + <pre><code><strong style="color:#d9534f">{{error.test_case}}</strong></code></pre> + {% endif %} + <p> <b>The following error took place: </b></p> + <div class="well well-sm"> + <table class="table table-bordered" width="100%"> + <col width="30%"> + <tr class = "active"> + <td><b>Exception Name: </b></td> + <td><span style="color: #d9534f">{{error.exception}}</span></td> + </tr> + <tr> + <td><b>Exception Message: </b></td><td>{{error.message}}</td> + </tr> + <tr> + {% if error.traceback %} + <td><b>Full Traceback: </b></td> + <td><pre>{{error.traceback}}</pre></td> + {% endif %} + </tr> + </table> + </div> <!-- Closes well --> + {% else %} + <pre><code> {{error|safe}} </code></pre> {% endif %} {% endfor %} {% endwith %} |