summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/templates/500.html2
-rw-r--r--yaksh/templates/base.html2
-rw-r--r--yaksh/templates/manage.html1
-rw-r--r--yaksh/templates/yaksh/grade_user.html26
-rw-r--r--yaksh/templates/yaksh/preview_questionpaper.html2
-rw-r--r--yaksh/templates/yaksh/show_video.html63
-rw-r--r--yaksh/templates/yaksh/user_data.html506
-rw-r--r--yaksh/templates/yaksh/view_answerpaper.html24
-rw-r--r--yaksh/views.py6
9 files changed, 329 insertions, 303 deletions
diff --git a/yaksh/templates/500.html b/yaksh/templates/500.html
index b3bf710..f2455d4 100644
--- a/yaksh/templates/500.html
+++ b/yaksh/templates/500.html
@@ -13,6 +13,6 @@
<center>
Internal Server error.<br />
This event will be reported.<br />
-Sorry for the inconvinience.
+Sorry for the inconvenience.
</center>
{% endblock %}
diff --git a/yaksh/templates/base.html b/yaksh/templates/base.html
index 2842c8b..e5d1a56 100644
--- a/yaksh/templates/base.html
+++ b/yaksh/templates/base.html
@@ -60,7 +60,7 @@
<div class="content">
<div class="header">
- <h3><center>{% block pagetitle %}{% endblock pagetitle %}</center></h2>
+ <h3><center>{% block pagetitle %}{% endblock pagetitle %}</center></h3>
</div>
{% block content %}
{% endblock %}
diff --git a/yaksh/templates/manage.html b/yaksh/templates/manage.html
index f8edeef..1dee595 100644
--- a/yaksh/templates/manage.html
+++ b/yaksh/templates/manage.html
@@ -32,6 +32,7 @@
<div class="dropdown-divider"></div>
<a class="dropdown-item" id="user_logout" href="{{URL_ROOT}}/exam/logout/"><i class="fa fa-sign-out"></i> Logout</a>
</div>
+ </li>
</ul>
</div>
</div>
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index 2a22bd9..a76f2c7 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -164,27 +164,27 @@ Status : <b style="color: red;"> Failed </b><br/>
{% for testcase in question.get_test_cases %}
{% if testcase.correct %}
<br/>
- <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ <strong>{{ forloop.counter }}. {{ testcase.options }}</strong>
<span class="alert alert-success"> Correct </span>
{% else %}
<br/><strong>
- {{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ {{ forloop.counter }}. {{ testcase.options }}</strong>
{% endif %}
{% endfor %}
{% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
<h5> <u>Correct Answer:</u></h5>
{% for testcase in question.get_test_cases %}
- <strong>{{ testcase.correct|safe }}</strong>
+ <strong>{{ testcase.correct }}</strong>
{% if testcase.error_margin %}
- <strong>{{ testcase.error_margin|safe }}</strong>
+ <strong>{{ testcase.error_margin }}</strong>
{% endif %}
{% endfor %}
{% elif question.type == "arrange" %}
<h5> <u>Correct Order:</u></h5>
<div class="list-group" >
{% for testcase in question.get_test_cases %}
- <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li>
+ <li class="list-group-item"><strong>{{ testcase.options }}</strong></li>
{% endfor %}
</div>
@@ -303,7 +303,7 @@ Status : <b style="color: red;"> Failed </b><br/>
</div>
</div> <!-- Closes card -->
{% else %}
- <pre><code> {{error|safe}} </code></pre>
+ <pre><code> {{error}} </code></pre>
{% endif %}
{% endfor %}
{% endwith %}
@@ -311,13 +311,13 @@ Status : <b style="color: red;"> Failed </b><br/>
<div class="card-body">
{% if question.type == "code" %}
- <pre><code>{{ ans.answer.answer.strip|safe }}</code></pre>
+ <pre><code>{{ ans.answer.answer.strip }}</code></pre>
{% elif question.type == "mcc"%}
<div class="card">
<div class="card-body">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" in ans.answer.answer.strip|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" in ans.answer.answer.strip %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -326,8 +326,8 @@ Status : <b style="color: red;"> Failed </b><br/>
<div class="card">
<div class="card-body">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" == ans.answer.answer.strip|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" == ans.answer.answer.strip %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -338,7 +338,7 @@ Status : <b style="color: red;"> Failed </b><br/>
<div class="card-body">
{% get_answer_for_arrange_options ans.answer.answer question as tc_list %}
{% for testcases in tc_list %}
- <li>{{ testcases.options.strip|safe }}</li>
+ <li>{{ testcases.options.strip }}</li>
{% endfor %}
</div>
</div>
@@ -346,7 +346,7 @@ Status : <b style="color: red;"> Failed </b><br/>
{% else %}
<div class="card">
<div class="card-body">
- {{ ans.answer.answer.strip|safe }}
+ {{ ans.answer.answer.strip }}
</div>
</div>
{% endif %}
diff --git a/yaksh/templates/yaksh/preview_questionpaper.html b/yaksh/templates/yaksh/preview_questionpaper.html
index 7293351..d6391e1 100644
--- a/yaksh/templates/yaksh/preview_questionpaper.html
+++ b/yaksh/templates/yaksh/preview_questionpaper.html
@@ -27,7 +27,7 @@
<h5><u>Question:</u></h5> <strong>{{ question.description|safe }}</strong>
<br/><b>Answer:</b><br/>
{% if question.type == "code" %}
- <div class="card">{{ question.snippet }}<br/></div>
+ <div class="card"><pre>{{ question.snippet }}</pre><br/></div>
{% endif %}
{% if question.type == "mcq" or question.type == "mcc" %}
<h5> <u>Choices:</u></h5>
diff --git a/yaksh/templates/yaksh/show_video.html b/yaksh/templates/yaksh/show_video.html
index 575c296..9f92bc3 100644
--- a/yaksh/templates/yaksh/show_video.html
+++ b/yaksh/templates/yaksh/show_video.html
@@ -25,39 +25,36 @@
{{module}}
</a>
{% for unit in module.get_learning_units %}
- <span id="menudrop">
- {% if unit.type == "quiz" %}
- <a href="{{ URL_ROOT }}/exam/start/{{unit.quiz.questionpaper_set.get.id}}/{{module.id}}/{{course.id}}" class="list-group-item" data-parent="#menu1">
- {% if status == "completed" %}
- <i class="fa fa-check-square yakshgreen"></i>
- {% else %}
- <i class="fa fa-square-o"></i>
- {% endif %}
- {% get_unit_status course module unit user as status %}
- {{ unit.quiz.description }}
- {% if unit.id == current_unit.id %}
- <i class="fa fa-thumb-tack yakshred" data-toggle="tooltip" title="Currently on">
- </i>
- {% endif %}
- </a>
- {% else %}
- <a href="{{ URL_ROOT }}/exam/show_lesson/{{unit.lesson.id}}/{{module.id}}/{{course.id}}" class="list-group-item" data-parent="#menu1">
- {% if status == "completed" %}
- <i class="fa fa-check-square yakshgreen"></i>
- {% else %}
- <i class="fa fa-square-o"></i>
- {% endif %}
- {% get_unit_status course module unit user as status %}
-
-
- {{ unit.lesson.name }}
- {% if unit.id == current_unit.id %}
- <i class="fa fa-thumb-tack yakshred" data-toggle="tooltip" title="Currently on">
- </i>
- {% endif %}
- </a>
- {% endif %}
- </span>
+ {% get_unit_status course module unit user as status %}
+ <span id="menudrop">
+ {% if unit.type == "quiz" %}
+ <a href="{{ URL_ROOT }}/exam/start/{{unit.quiz.questionpaper_set.get.id}}/{{module.id}}/{{course.id}}" class="list-group-item" data-parent="#menu1">
+ {% if status == "completed" %}
+ <i class="fa fa-check-square yakshgreen"></i>
+ {% else %}
+ <i class="fa fa-square-o"></i>
+ {% endif %}
+ {{ unit.quiz.description }}
+ {% if unit.id == current_unit.id %}
+ <i class="fa fa-thumb-tack yakshred" data-toggle="tooltip" title="Currently on">
+ </i>
+ {% endif %}
+ </a>
+ {% else %}
+ <a href="{{ URL_ROOT }}/exam/show_lesson/{{unit.lesson.id}}/{{module.id}}/{{course.id}}" class="list-group-item" data-parent="#menu1">
+ {% if status == "completed" %}
+ <i class="fa fa-check-square yakshgreen"></i>
+ {% else %}
+ <i class="fa fa-square-o"></i>
+ {% endif %}
+ {{ unit.lesson.name }}
+ {% if unit.id == current_unit.id %}
+ <i class="fa fa-thumb-tack yakshred" data-toggle="tooltip" title="Currently on">
+ </i>
+ {% endif %}
+ </a>
+ {% endif %}
+ </span>
{% endfor %}
</div>
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html
index d424e54..317cb15 100644
--- a/yaksh/templates/yaksh/user_data.html
+++ b/yaksh/templates/yaksh/user_data.html
@@ -1,264 +1,294 @@
{% extends "manage.html" %}
{% load custom_filters %}
-
{% block pagetitle %} Data for user {{ data.user.get_full_name.title }} {% endblock pagetitle %}
-
{% block content %}
-
{% block script %}
<script src= "{{ URL_ROOT }}/static/yaksh/js/edit_question.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/mathjax/MathJax.js?config=TeX-MML-AM_CHTML"></script>
-
{% endblock %}
<div class="yakshwell container">
-<form action="" method="post">
- <div class="card col-md-4">
-<p class="card-body">
-Name: {{ data.user.get_full_name.title }} <br/>
-Username: {{ data.user.username }} <br/>
-{% if data.profile %}
-Roll number: {{ data.profile.roll_number }} <br/>
-Position: {{ data.profile.position }} <br/>
-Department: {{ data.profile.department }} <br/>
-Institute: {{ data.profile.institute }} <br/>
-{% endif %}
-Email: {{ data.user.email }} <br/>
-Date joined: {{ data.user.date_joined }} <br/>
-Last login: {{ data.user.last_login }}
-</p>
-</div>
-{% if data.papers %}
-<p class="text-center"><a href="{{URL_ROOT}}/exam/manage/gradeuser/{{data.papers.0.question_paper.quiz.id}}/{{ data.user.id }}/{{course_id}}/" class="btn btn-info ">
- Grade/correct paper</a>
-</p>
-
-{% for paper in data.papers %}
-{% if forloop.counter == 2 and data.questionpaperid %}
-<hr>
-<U><h2> Previous attempts </h2></U>
-{% endif %}
-<h2> Quiz: {{ paper.question_paper.quiz.description }} </h2>
-
-<p>
-Attempt Number: {{ paper.attempt_number }}<br/>
-Questions correctly answered: {{ paper.get_answered_str }} <br/>
-Total attempts at questions: {{ paper.answers.count }} <br/>
-Marks obtained: {{ paper.marks_obtained }} <br/>
-Start time: {{ paper.start_time }} <br/>
-User IP address: {{ paper.user_ip }}
-</p>
-
-{% if paper.answers.count %}
-<h3> Answers </h3>
-{% for question, answers in paper.get_question_answers.items %}
-<div class="panel panel-info">
- <div class="panel-heading">
-
- <strong> Details: {{forloop.counter}}. {{ question.summary }}
- <a href="" onClick="grade_data('show_question{{question.id}}{{paper.attempt_number}}'); return false;"> Show Question </a>
- <span class="marks pull-right"> Mark(s): {{ question.points }} </span>
- </strong>
- </div>
- <div class="panel-body" id="show_question{{question.id}}{{paper.attempt_number}}" style="display: none;">
-
- <h5><u>Question:</u></h5> <strong>{{ question.description|safe }}</strong>
- {% if question.type == "mcq" or question.type == "mcc" %}
- <h5> <u>Choices:</u></h5>
- {% for testcase in question.get_test_cases %}
- {% if testcase.correct %}
- <br/>
- <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong>
- <span class="label label-success"> Correct </span>
- {% else %}
- <br/><strong>
- {{ forloop.counter }}. {{ testcase.options|safe }}</strong>
- {% endif %}
- {% endfor %}
-
- {% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
- <h5> <u>Correct Answer:</u></h5>
- {% for testcase in question.get_test_cases %}
- <strong>{{ testcase.correct|safe }}</strong>
- {% endfor %}
-
- {% elif question.type == "arrange" %}
- <h5> <u>Correct Order:</u></h5>
- <div class="list-group" >
- {% for testcase in question.get_test_cases %}
- <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li>
- {% endfor %}
- </div>
-
- {% else %}
- <h5> <u>Test cases: </u></h5>
- {% for testcase in question.get_test_cases %}
- <br/><strong>{{ forloop.counter }}. {{ testcase.test_case }}</strong>
- {% endfor %}
- {%endif%}
- </div>
- </div>
- {% if question.type != "code" %}
- {% if "Correct answer" in answers.0.error_list %}
- <div class="panel panel-success">
- <div class="panel-heading"><strong>Correct</strong></div>
- {% else %}
- <div class="panel panel-danger">
- <div class="panel-heading"><strong> Incorrect</strong></div>
- {% endif %}
- <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>
-
- {% elif question.type == "arrange"%}
- <div class="well well-sm">
- {% get_answer_for_arrange_options answers.0.answer question as tc_list %}
- {% for testcases in tc_list %}
- <li>{{ testcases.options.strip|safe }}</li>
- {% endfor %}
- </div>
-
- {%else%}
- <div class="well well-sm">
- {{ answers.0.answer|safe }}
- </div>
- {% endif %}
+ <div class="card col-md-4">
+ <p class="card-body">
+ Name: {{ data.user.get_full_name.title }} <br/>
+ Username: {{ data.user.username }} <br/>
+ {% if data.profile %}
+ Roll number: {{ data.profile.roll_number }} <br/>
+ Position: {{ data.profile.position }} <br/>
+ Department: {{ data.profile.department }} <br/>
+ Institute: {{ data.profile.institute }} <br/>
+ {% endif %}
+ Email: {{ data.user.email }} <br/>
+ Date joined: {{ data.user.date_joined }} <br/>
+ Last login: {{ data.user.last_login }}
+ </p>
+ </div>
+ {% if data.papers %}
+ <p class="text-center"><a href="{{URL_ROOT}}/exam/manage/gradeuser/{{data.papers.0.question_paper.quiz.id}}/{{ data.user.id }}/{{course_id}}/" class="btn btn-info ">
+ Grade/correct paper</a>
+ </p>
+ {% for paper in data.papers %}
+ {% if forloop.counter == 2 and data.questionpaperid %}
+ <hr>
+ <u>
+ <h2> Previous attempts </h2>
+ </u>
+ {% endif %}
+ <h2> Quiz: {{ paper.question_paper.quiz.description }} </h2>
+ <p>
+ Attempt Number: {{ paper.attempt_number }}<br/>
+ Questions correctly answered: {{ paper.get_answered_str }} <br/>
+ Total attempts at questions: {{ paper.answers.count }} <br/>
+ Marks obtained: {{ paper.marks_obtained }} <br/>
+ Start time: {{ paper.start_time }} <br/>
+ User IP address: {{ paper.user_ip }}
+ </p>
+ {% if paper.answers.count %}
+ <div class="table-wrapper-2">
+ <h3> Answers </h3>
+ <br>
+ {% for question, answers in paper.get_question_answers.items %}
+ <div class = "yakshlabel">
+ <div class="card">
+ <div class="card-heading alert-info" id="question_{{question.id}}">
+ <strong> Details: {{forloop.counter}}. {{ question.summary }}
+ <a href="" onClick="grade_data('show_question{{question.id}}{{paper.attempt_number}}'); return false;"> Show Question </a>
+ <span class="marks pull-right"> Mark(s): {{ question.points }} </span>
+ </strong>
+ </div>
+ <div class="card-body" id="show_question{{question.id}}{{paper.attempt_number}}" style="display: none;">
+ <h5><u>Question:</u></h5>
+ <strong>{{ question.description|safe }}</strong>
+ {% if question.type == "mcq" or question.type == "mcc" %}
+ <h5> <u>Choices:</u></h5>
+ {% for testcase in question.get_test_cases %}
+ {% if testcase.correct %}
+ <br/>
+ <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ <span class="badge badge-success">Correct </span>
+ {% else %}
+ <br/><strong>
+ {{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ {% endif %}
+ {% endfor %}
+ {% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
+ <h5> <u>Correct Answer:</u></h5>
+ {% for testcase in question.get_test_cases %}
+ <strong>{{ testcase.correct|safe }}</strong>
+ {% if testcase.error_margin %}
+ <strong>{{ testcase.error_margin|safe }}</strong>
+ {% endif %}
+ {% endfor %}
+ {% elif question.type == "arrange" %}
+ <h5> <u>Correct Order:</u></h5>
+ <div class="list-group" >
+ {% for testcase in question.get_test_cases %}
+ <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li>
+ {% endfor %}
+ </div>
+ {% else %}
+ <h5> <u>Test cases: </u></h5>
+ {% for testcase in question.get_test_cases %}
+ <br/><strong>{{ forloop.counter }}. {{ testcase }}</strong>
+ {% endfor %}
+ {%endif%}
+ </div>
</div>
- </div>
- {% else %}
- <h5>Student answer: </h5>
- {% for answer in answers %}
-
- {% if answer.answer.correct %}
- <div class="panel panel-success">
- <div class="panel-heading">Correct answer
- {% else %}
- <div class="panel panel-danger">
- <div class="panel-heading">Error<br/>
- {% with answer.error_list as err %}
- {% for error in err %}
- {% if error.type == 'stdio' %}
- <div class = "well well-sm">
- {% if error.given_input %}
- <table class="table table-bordered table-responsive-sm">
- <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 table-responsive-sm" width="100%" id="output" style="table-layout: fixed">
- <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 table-responsive-sm">
- <col width="10">
- <tr class = "danger">
- <td><b>Error:</b></td>
- <td>{{error.error_msg}}</td>
- </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>
+ <h5>Student answer: </h5>
+ {% if question.type == "upload" %}
+ {% if has_user_assignments %}
+ <a href="{{URL_ROOT}}/exam/manage/download/user_assignment/{{question.id}}/{{data.user.id}}/{{paper.question_paper.quiz.id}}/{{course_id}}">
+ <div class="btn btn-outline-info text-center">
+ Assignment File for {{ data.user.get_full_name.title }}
+ </div>
+ </a>
+ {% with answers|last as answer%}
+ {% if answer.answer.correct %}
+ <div class="card ">
+ <div class="card-heading alert-success">Correct answer</div>
+ </div>
+ {% else %}
+ <div class="card ">
+ <div class="card-heading alert-danger">Incorrect Answer</div>
+ </div>
{% endif %}
- <p> <b>The following error took place: </b></p>
- <div class="well well-sm">
- <table class="table table-bordered table-responsive-sm" width="100%" style="table-layout: fixed">
- <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>
+ {% endwith %}
+ {% else %}
+ <center>
+ <div class="alert alert-warning animated flash">
+ <h5>No Assignment submitted by {{ data.user.get_full_name.title }}</h5>
+ </div>
+ </center>
{% endif %}
- </tr>
- </table>
- </div> <!-- Closes well -->
- {% else %}
- <pre><code> {{error|safe}} </code></pre>
- {% endif %}
- {% endfor %}
- {% endwith %}
- {% endif %}
-
- </div>
- <div class="panel-body">
- {% if question.type != "code" %}
- <div class="well well-sg">
- {{question.type}}
- {{ answer.answer.answer.strip|safe }}
- </div>
- {% else %}
- <pre><code>{{ answer.answer.answer.strip|safe }}</code></pre>
- {% endif %}
- </div>
- </div>
+ {% else %}
+ {% for ans in answers %}
+ {% if ans.answer.correct %}
+ <div class="card ">
+ <div class="card-heading alert-success">
+ Correct answer:
+ {% else %}
+ <div class="card ">
+ <div class="card-heading-heading alert-danger">
+ Error:
+ {% endif %}
+ {% with ans.error_list as err %}
+ {% for error in err %}
+ {% if error.type == 'stdio' %}
+ <div class = "card">
+ <div class="card-body">
+ {% if error.given_input %}
+ <table class="table table-bordered table-responsive-sm">
+ <col width="30%">
+ <tr class = "table-active">
+ <td> For given Input value(s):</td>
+ <td>{{error.given_input}}</td>
+ </tr>
+ </table>
+ {% endif %}
+ <table class="table table-bordered table-responsive-sm" width="100%" id="output" style="table-layout: fixed">
+ <col width="10%">
+ <col width="40%">
+ <col width="40%">
+ <col width="10%">
+ <tr>
+ <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 %}
+ <tr>
+ <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 ="fa fa-times text-warning"></span></td>
+ {% else %}
+ <td><span class ="fa fa-check text-success"></span></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </table>
+ <table width="100%" class="table table-bordered table-responsive-sm">
+ <col width="10">
+ <tr>
+ <td><b>Error:</b></td>
+ <td>{{error.error_msg}}</td>
+ </tr>
+ </table>
+ </div>
+ </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="card">
+ <div class="card-body">
+ <table class="table table-bordered table-responsive-sm" width="100%" style="table-layout: fixed">
+ <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>
+ </div>
+ <!-- Closes card -->
+ {% else %}
+ <pre><code> {{error|safe}} </code></pre>
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
+ </div>
+ <div class="card-body">
+ {% if question.type == "code" %}
+ <pre><code>{{ ans.answer.answer.strip|safe }}</code></pre>
+ {% elif question.type == "mcc"%}
+ <div class="card">
+ <div class="card-body">
+ {% 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>
+ </div>
+ {% elif question.type == "mcq"%}
+ <div class="card">
+ <div class="card-body">
+ {% 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>
+ </div>
+ {% elif question.type == "arrange"%}
+ <div class="card">
+ <div class="card-body">
+ {% get_answer_for_arrange_options ans.answer.answer question as tc_list %}
+ {% for testcases in tc_list %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endfor %}
+ </div>
+ </div>
+ {% else %}
+ <div class="card">
+ <div class="card-body">
+ {{ ans.answer.answer.strip|safe }}
+ </div>
+ </div>
+ {% endif %}
+ </div>
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% with answers|last as answer %}
+ Marks: <input id="q{{ question.id }}" type="text"
+ name="q{{ question.id }}_marks" size="4"
+ value="{{ answer.answer.marks }}"><br><br>
+ {% endwith %}
+ <hr/>
+ </div>
+
+ {% endfor %} {# for question, answers ... #}
+ </div>
- {% endfor %}
- {% endif %}
- <hr>
- {% endfor %} {# for question, answers ... #}
<h3>Teacher comments: </h3>
{{ paper.comments|default:"None" }}
{% endif %} {# if paper.answers.count #}
-
{% endfor %} {# for paper in data.papers #}
-
{% endif %} {# if data.papers #}
+</div>
+
<br />
<hr />
-
{% with data.papers.0 as paper %}
<a href="{{URL_ROOT}}/exam/manage/gradeuser/{{paper.question_paper.quiz.id}}/{{ data.user.id }}/{{course_id}}/">Grade/correct paper</a>
{% endwith %}
<br />
-
{% if data.papers.count > 1 %}
<a href="{{URL_ROOT}}/exam/manage/monitor/">Monitor quiz</a>
{% else %}
@@ -266,6 +296,4 @@ User IP address: {{ paper.user_ip }}
<a href="{{URL_ROOT}}/exam/manage/monitor/{{paper.question_paper.id}}/">Monitor quiz</a>
{% endwith %}
{% endif %}
-</div>
-
-{% endblock %}
+{% endblock %} \ No newline at end of file
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html
index 2246db1..b87c818 100644
--- a/yaksh/templates/yaksh/view_answerpaper.html
+++ b/yaksh/templates/yaksh/view_answerpaper.html
@@ -54,32 +54,32 @@
</strong>
</div>
<div class="card-body">
- <h5><u>Question:</u></h5> <strong>{{ question.description|safe }}</strong>
+ <h5><u>Question:</u></h5> <strong>{{ question.description }}</strong>
{% if question.type == "mcq" or question.type == "mcc" %}
<h5> <u>Choices:</u></h5>
{% get_ordered_testcases question paper as testcases %}
{% for testcase in testcases %}
{% if testcase.correct %}
<br/>
- <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ <strong>{{ forloop.counter }}. {{ testcase.options }}</strong>
<span class="alert alert-success"> Correct</span>
{% else %}
<br/><strong>
- {{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ {{ forloop.counter }}. {{ testcase.options }}</strong>
{% endif %}
{% endfor %}
{% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
<h5> <u>Correct Answer:</u></h5>
{% for testcase in question.get_test_cases %}
- <strong>{{ testcase.correct|safe }}</strong>
+ <strong>{{ testcase.correct }}</strong>
{% endfor %}
{% elif question.type == "arrange" %}
<h5> <u>Correct Order:</u></h5>
<div class="list-group">
{% for testcase in question.get_test_cases %}
- <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li>
+ <li class="list-group-item"><strong>{{ testcase.options }}</strong></li>
{% endfor %}
</div>
@@ -106,8 +106,8 @@
<div class="card">
<div class="card-body">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" in answers.0.answer|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" in answers.0.answer %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -116,8 +116,8 @@
<div class="card">
<div class="card-body">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" == answers.0.answer|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" == answers.0.answer %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -127,7 +127,7 @@
<div class="card-body">
{% get_answer_for_arrange_options answers.0.answer question as tc_list %}
{% for testcases in tc_list %}
- <li>{{ testcases.options.strip|safe }}</li>
+ <li>{{ testcases.options.strip }}</li>
{% endfor %}
</div>
</div>
@@ -142,7 +142,7 @@
<h5><u>Student answer:</u></h5>
<div class="card">
<div class="card-body">
- {{ answers.0.answer|safe }}
+ {{ answers.0.answer }}
</div>
</div>
{% endif %}
@@ -236,7 +236,7 @@
</table>
</div> <!-- Closes well -->
{% else %}
- <pre><code> {{error|safe}} </code></pre>
+ <pre><code> {{error}} </code></pre>
{% endif %}
{% endfor %}
{% endwith %}
diff --git a/yaksh/views.py b/yaksh/views.py
index de6a1a2..0f81931 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -383,7 +383,7 @@ def prof_manage(request, msg=None):
if not is_moderator(user):
return my_redirect('/exam/')
courses = Course.objects.filter(Q(creator=user) | Q(teachers=user),
- is_trial=False)
+ is_trial=False).distinct()
trial_paper = AnswerPaper.objects.filter(
user=user, question_paper__quiz__is_trial=True,
course__is_trial=True
@@ -905,8 +905,8 @@ def complete(request, reason=None, attempt_num=None, questionpaper_id=None,
"""Show a page to inform user that the quiz has been completed."""
user = request.user
if questionpaper_id is None:
- message = reason or "An Unexpected Error occurred. Please contact your '\
- 'instructor/administrator.'"
+ message = (reason or "An Unexpected Error occurred. Please contact your"
+ " instructor/administrator.")
context = {'message': message}
return my_render_to_response(request, 'yaksh/complete.html', context)
else: