summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorPrabhu Ramachandran2011-11-23 14:58:16 +0530
committerPrabhu Ramachandran2011-11-23 14:58:16 +0530
commit30f56443790841901f15b5ab435f97fba1c81d85 (patch)
tree006abd7932ca468661f5481e998c6a79f3058ecd /templates
parentba2097a382b581dacced5cb9bd70087396a054f0 (diff)
downloadonline_test-30f56443790841901f15b5ab435f97fba1c81d85.tar.gz
online_test-30f56443790841901f15b5ab435f97fba1c81d85.tar.bz2
online_test-30f56443790841901f15b5ab435f97fba1c81d85.zip
ENH: Cleanup and adding error/comments for answers
Adding error and marks field to each answer. Adding a new comment field to the question paper and also a profile field for convenience. Changing the views, templates and dump scripts to use the models rather than Python code. This cleans things up a lot more. The user data logged and printed is also way more comprehensive, paving the way for easy online grading as well in the next phase of changes.
Diffstat (limited to 'templates')
-rw-r--r--templates/exam/monitor.html34
-rw-r--r--templates/exam/user_data.html59
2 files changed, 52 insertions, 41 deletions
diff --git a/templates/exam/monitor.html b/templates/exam/monitor.html
index 1ce6c69..8f34a7f 100644
--- a/templates/exam/monitor.html
+++ b/templates/exam/monitor.html
@@ -6,7 +6,7 @@
{% block content %}
-{% if not quiz_data and not paper_list %}
+{% if not quizzes and not papers %}
<h1> Quiz results </h1>
<p> No quizzes available. </p>
@@ -15,23 +15,23 @@
{# ############################################################### #}
{# This is rendered when we are just viewing exam/monitor #}
-{% if quiz_data %}
+{% if quizzes %}
<h1> Available quizzes </h1>
<ul>
-{% for quiz_id, quiz_name in quiz_data.items %}
-<li><a href="{{URL_ROOT}}/exam/monitor/{{quiz_id}}/">{{ quiz_name }}</a></li>
+{% for quiz in quizzes %}
+<li><a href="{{URL_ROOT}}/exam/monitor/{{quiz.id}}/">{{ quiz.description }}</a></li>
{% endfor %}
</ul>
{% endif %}
{# ############################################################### #}
{# This is rendered when we are just viewing exam/monitor/quiz_num #}
-{% if paper_list %}
-<h1> {{ quiz_name }} results </h1>
+{% if papers %}
+<h1> {{ quiz.description }} results </h1>
{# <p> Quiz: {{ quiz_name }}</p> #}
-<p>Number of papers: {{ paper_list|length }} </p>
+<p>Number of papers: {{ papers|length }} </p>
<table border="1" cellpadding="3">
<tr>
@@ -43,19 +43,21 @@
<th> Total marks </th>
<th> Attempts </th>
</tr>
- {% for paper in paper_list %}
+ {% for paper in papers %}
<tr>
- <td> <a href="{{URL_ROOT}}/exam/user_data/{{paper.username}}">{{ paper.name.title }}</a> </td>
- <td> <a href="{{URL_ROOT}}/exam/user_data/{{paper.username}}">{{ paper.username }}</a> </td>
- <td> {{ paper.rollno }} </td>
- <td> {{ paper.institute }} </td>
- <td> {{ paper.answered }} </td>
- <td> {{ paper.total }} </td>
- <td> {{ paper.attempts }} </td>
+ <td> <a href="{{URL_ROOT}}/exam/user_data/{{paper.user.username}}">
+ {{ paper.user.get_full_name.title }}</a> </td>
+ <td> <a href="{{URL_ROOT}}/exam/user_data/{{paper.user.username}}">
+ {{ paper.user.username }}</a> </td>
+ <td> {{ paper.profile.roll_number }} </td>
+ <td> {{ paper.profile.institute }} </td>
+ <td> {{ paper.get_answered_str }} </td>
+ <td> {{ paper.get_total_marks }} </td>
+ <td> {{ paper.answers.count }} </td>
</tr>
{% endfor %}
</table>
-{% else %} {% if quiz_name %}
+{% else %} {% if quiz %}
<p> No answer papers so far. </p>
{% endif %}
{% endif %}
diff --git a/templates/exam/user_data.html b/templates/exam/user_data.html
index c2e8014..7563e0e 100644
--- a/templates/exam/user_data.html
+++ b/templates/exam/user_data.html
@@ -1,49 +1,58 @@
{% extends "base.html" %}
-{% block title %} Data for user {{ user_data.name.title }} {% endblock title %}
+{% block title %} Data for user {{ data.user.get_full_name.title }} {% endblock title %}
{% block content %}
-<h1> Data for user {{ user_data.name.title }} </h1>
+<h1> Data for user {{ data.user.get_full_name.title }} </h1>
<p>
-Name: {{ user_data.name.title }} <br/>
-Username: {{ user_data.username }} <br/>
-Roll number: {{ user_data.rollno }} <br/>
-Email: {{ user_data.email }} <br/>
-Position: {{ user_data.position }} <br/>
-Department: {{ user_data.department }} <br/>
-Institute: {{ user_data.institute }} <br/>
-Date joined: {{ user_data.date_joined }} <br/>
-Last login: {{ user_data.last_login }}
+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>
-{% if user_data.papers %}
+{% if data.papers %}
-{% for paper in user_data.papers %}
+{% for paper in data.papers %}
-<h2> Quiz: {{ paper.name }} </h2>
+<h2> Quiz: {{ paper.quiz.description }} </h2>
<p>
-Answered questions: {{ paper.answered }} <br/>
-Total attempts at questions: {{ paper.attempts }} <br/>
-Total marks: {{ paper.total }} <br/>
+Questions correctly answered: {{ paper.get_answered_str }} <br/>
+Total attempts at questions: {{ paper.answers.count }} <br/>
+Marks obtained: {{ paper.get_total_marks }} <br/>
Start time: {{ paper.start_time }} <br/>
User IP address: {{ paper.user_ip }}
</p>
-{% if paper.answers %}
+{% if paper.answers.count %}
<h3> Answers </h3>
-{% for question, answer in paper.answers.items %}
-<p><strong> Question: {{ question }} </strong> </p>
+{% for question, answers in paper.get_question_answers.items %}
+<p><strong> Question: {{ question.id }}. {{ question.summary }} (Points: {{ question.points }})</strong> </p>
+{% for answer in answers %}
<pre>
-{{ answer|safe }}
+################################################################################
+{{ answer.answer|safe }}
+# Autocheck: {{ answer.error }}
+# Marks: {{ answer.marks }}
</pre>
-{% endfor %}
-{% endif %} {# if paper.answers #}
+{% endfor %} {# for answer in answers #}
+{% endfor %} {# for question, answers ... #}
+<h3>Teacher comments: </h3>
+{{ paper.comments|default:"None" }}
+{% endif %} {# if paper.answers.count #}
-{% endfor %} {# for paper in user_data.papers #}
+{% endfor %} {# for paper in data.papers #}
-{% endif %} {# if user_data.papers #}
+{% endif %} {# if data.papers #}
{% endblock content %}