From 0b2a7623a7a5e225ee7a29b438872705b2c4ba5b Mon Sep 17 00:00:00 2001 From: prathamesh Date: Wed, 30 Mar 2016 09:49:19 +0530 Subject: views functions related to exam flow are cleaned-up Cleaned views various functions related to the exam flow. That is, introduction, start, check, show questions. To check prerequisite, can attempt the quiz, start quiz in progress if time available, get all active quizzes all these functionalities are shifted from views to models. Still further it has to be cleaned. For Answerpaper model, made questions, questions_answered and questions_unanswered manytomany relation with the Question model. Corrected the testcases. --- yaksh/templates/yaksh/complete.html | 10 +++----- yaksh/templates/yaksh/intro.html | 30 +++++++++++----------- yaksh/templates/yaksh/question.html | 39 +++++++++++++++-------------- yaksh/templates/yaksh/quit.html | 44 ++++++++++++++++----------------- yaksh/templates/yaksh/quizzes_user.html | 17 +++++++------ yaksh/templates/yaksh/results_user.html | 9 ++++--- 6 files changed, 73 insertions(+), 76 deletions(-) (limited to 'yaksh/templates') diff --git a/yaksh/templates/yaksh/complete.html b/yaksh/templates/yaksh/complete.html index 08abe76..7ebd062 100644 --- a/yaksh/templates/yaksh/complete.html +++ b/yaksh/templates/yaksh/complete.html @@ -5,27 +5,25 @@ {% block pagetitle %}Online Test{% endblock %} {% block content %} {% csrf_token %} - {% if submitted or unattempted %}
Submitted Questions - {% if submitted %} - {{ submitted|join:", " }} + {% if paper.questions_answered.all %} + {{ paper.questions_answered.all|join:", " }} {% else %}

No Questions have been Submitted

{% endif %}
Unattempted Questions - {% if unattempted %} - {{ unattempted|join:", " }} + {% if paper.questions_unanswered.all %} + {{ paper.questions_unanswered.all|join:", " }} {% else %}

All Questions have been Submitted

{% endif %}
- {% endif %}

Good bye!

{{message}}


You may now close the browser.


diff --git a/yaksh/templates/yaksh/intro.html b/yaksh/templates/yaksh/intro.html index 2542795..1ed82e2 100644 --- a/yaksh/templates/yaksh/intro.html +++ b/yaksh/templates/yaksh/intro.html @@ -5,21 +5,19 @@ {% block formtitle %}Important instructions & rules {% endblock %} {% block content %} - {% if enable_quiz_time or disable_quiz_time %} - {% if quiz_expired %} -
- This Quiz has expired. You can no longer attempt this Quiz. + {% if questionpaper.quiz.is_expired %} +
+ This Quiz has expired. You can no longer attempt this Quiz. +
+
+ {% else %} +
+ You can attempt this Quiz at any time between {{ questionpaper.quiz.start_date_time }} GMT and {{ questionpaper.quiz.end_date_time }} GMT
-
- {% else %} -
- You can attempt this Quiz at any time between {{ enable_quiz_time }} GMT and {{ disable_quiz_time }} GMT -
- You are not allowed to attempt the Quiz before or after this duration -
-
- {% endif %} - {% endif %} + You are not allowed to attempt the Quiz before or after this duration +
+
+ {% endif %}

Welcome {{user.first_name.title}} {{user.last_name.title}}, to the programming quiz!

This examination system has been developed with the intention of making you @@ -44,8 +42,8 @@ {% csrf_token %}

- {% if not quiz_expired %} -
+ {% if not questionpaper.quiz.is_expired %} + {% csrf_token %}
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 0d1daee..8976fed 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -15,7 +15,7 @@ + {% endif %} @@ -202,7 +203,7 @@ function call_skip(url) {% else %}    {% endif %} - {% if to_attempt|length != 1 %} + {% if paper.unanswered.all|length != 1 %} {% endif %} diff --git a/yaksh/templates/yaksh/quit.html b/yaksh/templates/yaksh/quit.html index 91bce64..7be8ad5 100644 --- a/yaksh/templates/yaksh/quit.html +++ b/yaksh/templates/yaksh/quit.html @@ -3,33 +3,31 @@ {% block title %}Quit exam {% endblock %} {% block pagetitle %}Online Test {% endblock %} {% block content %} - {% if submitted or unattempted %} -
- - - - -
Submitted Questions - {% if submitted %} - {{ submitted|join:", " }} - {% else %} -

No Questions have been Submitted

- {% endif %} -
Unattempted Questions - {% if unattempted %} - {{ unattempted|join:", " }} - {% else %} -

All Questions have been Submitted

- {% endif %} -
- {% endif %} +
+ + + + +
Submitted Questions + {% if paper.questions_answered.all %} + {{ paper.questions_answered.all|join:", " }} + {% else %} +

No Questions have been Submitted

+ {% endif %} +
Unattempted Questions + {% if paper.questions_unanswered.all %} + {{ paper.questions_unanswered.all|join:", " }} + {% else %} +

All Questions have been Submitted

+ {% endif %} +

Your current answers are saved.

Are you sure you wish to quit the exam?

Be sure, as you won't be able to restart this exam.

-
+ {% csrf_token %} -
 
+
 
{% endblock content %} diff --git a/yaksh/templates/yaksh/quizzes_user.html b/yaksh/templates/yaksh/quizzes_user.html index a800e68..2ba7b6c 100644 --- a/yaksh/templates/yaksh/quizzes_user.html +++ b/yaksh/templates/yaksh/quizzes_user.html @@ -49,23 +49,24 @@ - {% for paper in quizzes %} - {% if paper.quiz.course_id == course.id %} + {% for quiz in quizzes %} + {% if quiz.course_id == course.id %} - {% if paper in unexpired_quizzes %} + {% if not quiz.is_expired %} {% else %} {% endif %} diff --git a/yaksh/templates/yaksh/results_user.html b/yaksh/templates/yaksh/results_user.html index 0f35c0d..3a6450d 100644 --- a/yaksh/templates/yaksh/results_user.html +++ b/yaksh/templates/yaksh/results_user.html @@ -17,10 +17,11 @@ - {% for i in paper %} - + + + + {% endfor %}
Quiz Pre requisite quiz
- {{ paper.quiz.description }}
+ {{ quiz.description }}
- {{ paper.quiz.description }} Expired
+ {{ quiz.description }}
+ {{ quiz.description }} INACTIVE
- {% if paper.quiz.prerequisite %} - You have to pass {{ paper.quiz.prerequisite.description }} for taking {{ paper.quiz.description }} + {% if quiz.prerequisite %} + You have to pass {{ quiz.prerequisite.description }} for taking {{ paper.quiz.description }} {% else %} - No pre requisites for {{ paper.quiz.description }} + No pre requisites for {{ quiz.description }} {% endif %}
Percentage {% for paper in papers %}
{{ i }} - {% endfor %} -
+
{{ paper.question_paper.quiz.description }}{{ paper.marks_obtained }}{{ paper.question_paper.total_marks }}{{ paper.percent }}
-- cgit