summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-09-08 08:37:18 +0530
committerGitHub2016-09-08 08:37:18 +0530
commitdd7d6933d4312276aec47d401678f853961b5427 (patch)
tree57daa5bcc4fc13412da0d9c4c1f93333aa1572d2 /yaksh
parent68db5b034de8e3fe021a84ed4f64b60679fa3255 (diff)
parentbd0ed17050159e4ca3ba4493bdc520f26d85120c (diff)
downloadonline_test-dd7d6933d4312276aec47d401678f853961b5427.tar.gz
online_test-dd7d6933d4312276aec47d401678f853961b5427.tar.bz2
online_test-dd7d6933d4312276aec47d401678f853961b5427.zip
Merge pull request #135 from maheshgudi/view_answerpaper
students can view questions in view answerpaper
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/static/yaksh/css/view_answerpaper.css61
-rw-r--r--yaksh/templates/yaksh/view_answerpaper.html69
2 files changed, 114 insertions, 16 deletions
diff --git a/yaksh/static/yaksh/css/view_answerpaper.css b/yaksh/static/yaksh/css/view_answerpaper.css
new file mode 100644
index 0000000..50eab55
--- /dev/null
+++ b/yaksh/static/yaksh/css/view_answerpaper.css
@@ -0,0 +1,61 @@
+.panel {
+ margin-bottom: 20px;
+ background-color: #fff;
+ border: 1px solid transparent;
+ border-radius: 4px;
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
+}
+.panel-body {
+ padding: 15px;
+}
+.panel-heading {
+ padding: 10px 15px;
+ border-bottom: 1px solid transparent;
+ border-top-left-radius: 3px;
+ border-top-right-radius: 3px;
+}
+ .panel-info {
+ border-color: #bce8f1;
+}
+.panel-info > .panel-heading {
+ color: #31708f;
+ background-color: #d9edf7;
+ border-color: #bce8f1;
+}
+.panel-danger {
+ border-color: #ebccd1;
+}
+.panel-danger > .panel-heading {
+ color: #a94442;
+ background-color: #f2dede;
+ border-color: #ebccd1;
+}
+.panel-danger > .panel-body > pre > code {
+ background-color:transparent;
+ color: red;
+}
+.panel-success {
+ border-color: #d6e9c6;
+}
+.panel-success > .panel-heading {
+ color: #3c763d;
+ background-color: #dff0d8;
+ border-color: #d6e9c6;
+}
+.panel-success > .panel-body > pre > code {
+ background-color:transparent;
+ color: green;
+}
+.marks{
+ float:right;
+}
+mark{
+ background-color: #dff0d8;
+}
+code{
+ background-color: transparent;
+}
+pre{
+ background-color: transparent;
+} \ No newline at end of file
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html
index ae70e69..9227561 100644
--- a/yaksh/templates/yaksh/view_answerpaper.html
+++ b/yaksh/templates/yaksh/view_answerpaper.html
@@ -1,4 +1,7 @@
{% extends "user.html" %}
+{% block css %}
+<link rel="stylesheet" media="all" type="text/css" href="{{ URL_ROOT }}/static/yaksh/css/view_answerpaper.css" />
+{% endblock %}
{% block title %} Answer Paper for {{ quiz.description }}{% endblock title %}
@@ -6,7 +9,6 @@
{% block subtitle %} Answer Paper for {{ quiz.description }}{% endblock %}
-
{% if not data.papers %}
<p><b> You have not attempted the quiz {{ quiz.description }} </b></p>
{% else %}
@@ -21,32 +23,67 @@
Questions correctly answered: {{ paper.get_answered_str }} <br/>
Marks obtained: {{ paper.marks_obtained }} <br/>
Start time: {{ paper.start_time }} <br/>
+ End time : {{ paper.end_time }} <br/>
+ Percentage obtained: {{ paper.percent }}% <br/>
+ {% if paper.passed == 0 %}
+ Status : <b style="color: red;"> Failed </b><br/>
+ {% else %}
+ Status : <b style="color: green;"> Passed </b><br/>
+ {% endif %}
</p>
{% if paper.answers.count %}
- <h3> Answers </h3>
+ <h3> Answerpaper: </h3>
{% for question, answers in paper.get_question_answers.items %}
- <p><strong> Question: {{ question.id }}. {{ question.summary }} (Mark(s): {{ question.points }})</strong> </p>
+
+ <div class="panel panel-info">
+ <div class="panel-heading">
+ <strong> Details: {{forloop.counter}}. {{ question.summary }}
+ <span class="marks"> Mark(s): {{ question.points }} </span>
+ </strong>
+ </div>
+ <div class="panel-body">
+ <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 %}
+ <br/><strong>{{ forloop.counter }}. {{ testcase.options }}</strong>
+ {% endfor %}
+ {%endif%}
+
+ </div>
+ </div>
{% if question.type == "mcq" or question.type == "mcc" %}
- <p> Choices:
- {% for testcase in question.get_test_cases %} <br>{{ testcase.options }} {% endfor %}
- </p>
- <p>Student answer: {{ answers.0 }}</p>
- Autocheck: {{ answers.0.error }}
- {% else %}{# non-mcq questions #}
- <p>Student answer: </p>
+ {% 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 %}
- <pre>
- ###############################################################################
- {{ answer.answer.strip }}
- # Autocheck: {{ answer.error }}
- </pre>
+ {% if "Correct answer" in answer.error %}
+ <div class="panel panel-success">
+ {% else %}
+ <div class="panel panel-danger">
+ {% endif %}
+ <div class="panel-heading">Autocheck: {{ answer.error }}</div>
+ <div class="panel-body"><pre><code>{{ answer.answer.strip }}</code></pre></div>
+ </div>
{% endif %}
{% endfor %}
{% endif %}
{% with answers|last as answer %}
- <p><em>Obtained Marks: {{answer.marks}} </em> </p>
+ <p><em><mark>Obtained Marks: {{answer.marks}}</mark></em> </p>
{% endwith %}
<hr>
{% endfor %} {# for question, answers ... #}