summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-12-23 13:40:44 +0530
committerGitHub2016-12-23 13:40:44 +0530
commit48366e84b98157ac32b22b2aa19b1c1cde68afd4 (patch)
treeadb07f2709621b8906b5047da02010958bebba67 /yaksh/templates
parent77e8a6c1cde9190daf9075d71caf6017dc1380e7 (diff)
parent0e56fc6a77ec21db05c9bafb42b1acc652354a32 (diff)
downloadonline_test-48366e84b98157ac32b22b2aa19b1c1cde68afd4.tar.gz
online_test-48366e84b98157ac32b22b2aa19b1c1cde68afd4.tar.bz2
online_test-48366e84b98157ac32b22b2aa19b1c1cde68afd4.zip
Merge pull request #166 from ankitjavalkar/error-refactor-for-mod
Prettify Error rendering during code questions and grading page
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/yaksh/grade_user.html36
-rw-r--r--yaksh/templates/yaksh/question.html40
-rw-r--r--yaksh/templates/yaksh/user_data.html8
3 files changed, 51 insertions, 33 deletions
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index 38f31ca..6fb8187 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -118,6 +118,7 @@ Status : <b style="color: green;"> Passed </b><br/>
method="post">
{% csrf_token %}
{% for question, answers in paper.get_question_answers.items %}
+
<div class="panel panel-info">
<div class="panel-heading">
<strong> Details: {{forloop.counter}}. {{ question.summary }}
@@ -134,44 +135,31 @@ Status : <b style="color: green;"> Passed </b><br/>
{% else %}
<h5> <u>Test cases: </u></h5>
{% for testcase in question.get_test_cases %}
- <br/><strong>{{ forloop.counter }}. {{ testcase.test_case }}</strong>
+ <br/><strong>{{ forloop.counter }}. {{ testcase }}</strong>
{% endfor %}
{%endif%}
</div>
</div>
- {% if question.type == "mcq" or question.type == "mcc" %}
- {% if "Correct answer" in answers.0.error %}
- <div class="panel panel-success">
- {% else %}
- <div class="panel panel-danger">
- {% endif %}
- <div class="panel-heading">
- Autocheck: {{ answers.0.error }}
- </div>
- <div class="panel-body">
- <h5><u>Student answer:</u></h5>
- <pre><code>{{forloop.counter}}. {{ answers.0 }}</code></pre>
- </div>
- </div>
- {% else %}
<h5>Student answer: </h5>
- {% for answer in answers %}
- {% if not answer.skipped %}
- {% if answer.correct %}
+ {% for ans in answers %}
+ {% if ans.answer.correct %}
<div class="panel panel-success">
+ <div class="panel-heading">Correct:
{% else %}
<div class="panel panel-danger">
+ <div class="panel-heading">Error:
{% endif %}
- <div class="panel-heading">Autocheck: {{ answer.error }}</div>
- <div class="panel-body"><pre><code>{{ answer.answer.strip }}</code></pre></div>
+ {% for err in ans.error_list %}
+ <div><pre>{{ err }}</pre></div>
+ {% endfor %}
+ </div>
+ <div class="panel-body"><pre><code>{{ ans.answer.answer.strip }}</code></pre></div>
</div>
- {% endif %}
{% endfor %}
- {% endif %}
{% with answers|last as answer %}
Marks: <input id="q{{ question.id }}" type="text"
name="q{{ question.id }}_marks" size="4"
- value="{{ answer.marks }}"><br><br>
+ value="{{ answer.0.marks }}"><br><br>
{% endwith %}
<hr/>
{% endfor %} {# for question, answers ... #}
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index 74ac786..0279f0d 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -162,16 +162,32 @@ function call_skip(url)
<div class="panel-body">
{% if question.type == "mcq" %}
{% if error_message %}
- <p>{{ error_message }}</p>
- {% endif %}
+ <p>
+ <div class="panel panel-danger">
+ <div class="panel-heading">
+ {% for err in error_message %}
+ {{ err }}
+ {% endfor %}
+ </div>
+ </div>
+ </p>
+ {% endif %}
{% for test_case in test_cases %}
<input name="answer" type="radio" value="{{ test_case.options }}" />{{ test_case.options }} <br/>
{% endfor %}
{% endif %}
{% if question.type == "mcc" %}
{% if error_message %}
- <p>{{ error_message }}</p>
- {% endif %}
+ <p>
+ <div class="panel panel-danger">
+ <div class="panel-heading">
+ {% for err in error_message %}
+ {{ err }}
+ {% endfor %}
+ </div>
+ </div>
+ </p>
+ {% endif %}
{% for test_case in test_cases %}
<input name="answer" type="checkbox" value="{{ test_case.options }}"> {{ test_case.options }}
<br>
@@ -209,11 +225,19 @@ function call_skip(url)
</div>
{% if question.type == "code" %}
<div class="panel-footer">
+
{% if error_message %}
- <p> Output Message</p>
- <div class="alert alert-danger" role="alert">
- <textarea style="width:100%" class="error" readonly="yes">{{ error_message }}</textarea>
- </div>
+ {% 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>
+ {% endfor %}
+
{% endif %}
</div>
{% endif %}
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html
index 378e7fd..856433d 100644
--- a/yaksh/templates/yaksh/user_data.html
+++ b/yaksh/templates/yaksh/user_data.html
@@ -99,7 +99,13 @@ User IP address: {{ paper.user_ip }}
{% else %}
<div class="panel panel-danger">
{% endif %}
- <div class="panel-heading">Autocheck: {{ answer.error }}</div>
+ <div class="panel-heading">
+ {% for error in error %}
+ <div class="panel-body">
+ <pre><code>{{ error }}</code></pre>
+ </div>
+ {% endfor %}
+ </div>
<div class="panel-body"><pre><code>{{ answer.answer.strip }}</code></pre></div>
</div>
{% endif %}