From 30f56443790841901f15b5ab435f97fba1c81d85 Mon Sep 17 00:00:00 2001 From: Prabhu Ramachandran Date: Wed, 23 Nov 2011 14:58:16 +0530 Subject: 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. --- templates/exam/monitor.html | 34 +++++++++++++------------ templates/exam/user_data.html | 59 +++++++++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 41 deletions(-) (limited to 'templates') 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 %}

Quiz results

No quizzes available.

@@ -15,23 +15,23 @@ {# ############################################################### #} {# This is rendered when we are just viewing exam/monitor #} -{% if quiz_data %} +{% if quizzes %}

Available quizzes

{% endif %} {# ############################################################### #} {# This is rendered when we are just viewing exam/monitor/quiz_num #} -{% if paper_list %} -

{{ quiz_name }} results

+{% if papers %} +

{{ quiz.description }} results

{#

Quiz: {{ quiz_name }}

#} -

Number of papers: {{ paper_list|length }}

+

Number of papers: {{ papers|length }}

@@ -43,19 +43,21 @@ - {% for paper in paper_list %} + {% for paper in papers %} - - - - - - - + + + + + + + {% endfor %}
Total marks Attempts
{{ paper.name.title }} {{ paper.username }} {{ paper.rollno }} {{ paper.institute }} {{ paper.answered }} {{ paper.total }} {{ paper.attempts }} + {{ paper.user.get_full_name.title }} + {{ paper.user.username }} {{ paper.profile.roll_number }} {{ paper.profile.institute }} {{ paper.get_answered_str }} {{ paper.get_total_marks }} {{ paper.answers.count }}
-{% else %} {% if quiz_name %} +{% else %} {% if quiz %}

No answer papers so far.

{% 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 %} -

Data for user {{ user_data.name.title }}

+

Data for user {{ data.user.get_full_name.title }}

-Name: {{ user_data.name.title }}
-Username: {{ user_data.username }}
-Roll number: {{ user_data.rollno }}
-Email: {{ user_data.email }}
-Position: {{ user_data.position }}
-Department: {{ user_data.department }}
-Institute: {{ user_data.institute }}
-Date joined: {{ user_data.date_joined }}
-Last login: {{ user_data.last_login }} +Name: {{ data.user.get_full_name.title }}
+Username: {{ data.user.username }}
+{% if data.profile %} +Roll number: {{ data.profile.roll_number }}
+Position: {{ data.profile.position }}
+Department: {{ data.profile.department }}
+Institute: {{ data.profile.institute }}
+{% endif %} +Email: {{ data.user.email }}
+Date joined: {{ data.user.date_joined }}
+Last login: {{ data.user.last_login }}

-{% if user_data.papers %} +{% if data.papers %} -{% for paper in user_data.papers %} +{% for paper in data.papers %} -

Quiz: {{ paper.name }}

+

Quiz: {{ paper.quiz.description }}

-Answered questions: {{ paper.answered }}
-Total attempts at questions: {{ paper.attempts }}
-Total marks: {{ paper.total }}
+Questions correctly answered: {{ paper.get_answered_str }}
+Total attempts at questions: {{ paper.answers.count }}
+Marks obtained: {{ paper.get_total_marks }}
Start time: {{ paper.start_time }}
User IP address: {{ paper.user_ip }}

-{% if paper.answers %} +{% if paper.answers.count %}

Answers

-{% for question, answer in paper.answers.items %} -

Question: {{ question }}

+{% for question, answers in paper.get_question_answers.items %} +

Question: {{ question.id }}. {{ question.summary }} (Points: {{ question.points }})

+{% for answer in answers %}
 
-{{ answer|safe }}
+################################################################################
+{{ answer.answer|safe }}
+# Autocheck: {{ answer.error }}
+# Marks: {{ answer.marks }}
 
-{% endfor %} -{% endif %} {# if paper.answers #} +{% endfor %} {# for answer in answers #} +{% endfor %} {# for question, answers ... #} +

Teacher comments:

+{{ 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 %} -- cgit