diff options
author | prathamesh | 2016-03-30 09:49:19 +0530 |
---|---|---|
committer | prathamesh | 2016-04-01 17:04:56 +0530 |
commit | 0b2a7623a7a5e225ee7a29b438872705b2c4ba5b (patch) | |
tree | 04e80f4dc8a474f23ea18c756e1b9ef770086b10 /yaksh/templates | |
parent | d65ba142c47780fe3ff818f583f110453d31a92f (diff) | |
download | online_test-0b2a7623a7a5e225ee7a29b438872705b2c4ba5b.tar.gz online_test-0b2a7623a7a5e225ee7a29b438872705b2c4ba5b.tar.bz2 online_test-0b2a7623a7a5e225ee7a29b438872705b2c4ba5b.zip |
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.
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/complete.html | 10 | ||||
-rw-r--r-- | yaksh/templates/yaksh/intro.html | 30 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 39 | ||||
-rw-r--r-- | yaksh/templates/yaksh/quit.html | 44 | ||||
-rw-r--r-- | yaksh/templates/yaksh/quizzes_user.html | 17 | ||||
-rw-r--r-- | yaksh/templates/yaksh/results_user.html | 9 |
6 files changed, 73 insertions, 76 deletions
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 %} <br><center><table class="bordered-table zebra-striped span8" style="text-align:left;"> <tr><td><b>Submitted Questions</b></td> <td> - {% if submitted %} - {{ submitted|join:", " }} + {% if paper.questions_answered.all %} + {{ paper.questions_answered.all|join:", " }} {% else %} <p><b>No Questions have been Submitted</b></p> {% endif %} </td></tr> <tr><td><b>Unattempted Questions</b></td> <td> - {% if unattempted %} - {{ unattempted|join:", " }} + {% if paper.questions_unanswered.all %} + {{ paper.questions_unanswered.all|join:", " }} {% else %} <p><b>All Questions have been Submitted</b></p> {% endif %} </td></tr> </table></center> - {% endif %} <center><h2> Good bye! </h2></center> <center><h4> {{message}} </h4></center> <br><center><h4>You may now close the browser.</h4></center><br> 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 %} - <div class="alert alert-error"> - This Quiz has expired. You can no longer attempt this Quiz. + {% if questionpaper.quiz.is_expired %} + <div class="alert alert-error"> + This Quiz has expired. You can no longer attempt this Quiz. + <br/> + </div> + {% else %} + <div class="alert"> + You can attempt this Quiz at any time between {{ questionpaper.quiz.start_date_time }} GMT and {{ questionpaper.quiz.end_date_time }} GMT <br/> - </div> - {% else %} - <div class="alert"> - You can attempt this Quiz at any time between {{ enable_quiz_time }} GMT and {{ disable_quiz_time }} GMT - <br/> - You are not allowed to attempt the Quiz before or after this duration - <br/> - </div> - {% endif %} - {% endif %} + You are not allowed to attempt the Quiz before or after this duration + <br/> + </div> + {% endif %} <p> Welcome <strong>{{user.first_name.title}} {{user.last_name.title}}</strong>, to the programming quiz! </p> <p> This examination system has been developed with the intention of making you @@ -44,8 +42,8 @@ {% csrf_token %} <center><button class="btn" name="home">Home</button></center> </form> - {% if not quiz_expired %} - <form action="{{URL_ROOT}}/exam/start/{{ attempt_num }}/{{ paper_id }}/" method="post" align="center"> + {% if not questionpaper.quiz.is_expired %} + <form action="{{URL_ROOT}}/exam/start/{{ attempt_num }}/{{ questionpaper.id }}/" method="post" align="center"> {% csrf_token %} <center><button class="btn" type="submit" name="start">Start Exam!</button></center> </form> 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 @@ <script src="{{ URL_ROOT }}/static/yaksh/js/bootstrap-modal.js"></script> <script> -var time_left = {{ time_left }} +var time_left = {{ paper.time_left }} function getTimeRemaining(endtime){ var t = Date.parse(endtime) - Date.parse(new Date()); @@ -117,10 +117,10 @@ function call_skip(url) <div class="container"> <h3 class="brand"><strong>Online Test</h3></strong> <ul> - <li><h5><a> Hi {{user.first_name.title}} {{user.last_name.title}} </a></h5></li> + <li><h5><a> Hi {{ paper.user.first_name.title}} {{ paper.user.last_name.title}} </a></h5></li> </ul><br> <div class=time-div id="time_left"></div> - <h5 class=td1-class>You have {{ paper.questions_left }} question(s) left in {{ quiz_name }}</h5> + <h5 class=td1-class>You have {{ paper.questions_left }} question(s) left in {{ paper.question_paper.quiz.description }}</h5> </div> </div> </div> @@ -128,20 +128,21 @@ function call_skip(url) <div class="sidebar"> <p>Question Navigator </p> <div class="pagination"> - <ul> - {% for qid, num in questions.items %} - {% if qid.id|slugify in to_attempt %} - {% if qid.id|slugify == question.id|slugify %} - <li class="active"><a href="#" data-toggle="tooltip" title="{{ qid.description }}" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ num }}</a></li> - {% else %} - <li><a href="#" data-toggle="tooltip" title="{{ qid.description }}" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ num }}</a></li> - {% endif %} - {% endif %} - {% if qid.id|slugify in submitted %} - <li class="disabled"><a href="#">{{ num }}</a></li> - {% endif %} - {% endfor %} - </ul> + <ul> + {% for qid in paper.questions.all %} + {% if qid in paper.questions_unanswered.all %} + {% if qid.id == question.id %} + {{ q.id}} + <li class="active"><a href="#" data-toggle="tooltip" title="{{ qid.description }}" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ forloop.counter }}</a></li> + {% else %} + <li><a href="#" data-toggle="tooltip" title="{{ qid.description }}" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ forloop.counter }}</a></li> + {% endif %} + {% endif %} + {% if qid in paper.questions_answered.all %} + <li class="disabled"><a href="#">{{ forloop.counter }}</a></li> + {% endif %} + {% endfor %} + </ul> </div> </div> </div> @@ -191,7 +192,7 @@ function call_skip(url) <script type="text/javascript"> addLineNumbers('answer'); - </script> + </script> <script>addLineNumbers('snippet');</script> {% endif %} @@ -202,7 +203,7 @@ function call_skip(url) {% else %} <button class="btn" type="submit" name="check" id="check" onClick="submitCode();">Check Answer</button> {% endif %} - {% if to_attempt|length != 1 %} + {% if paper.unanswered.all|length != 1 %} <button class="btn" type="submit" name="skip" id="skip">Attempt Later</button> {% endif %} </form> 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 %} - <br><center><table class="bordered-table zebra-striped span8" - style="text-align:left;"> - <tr><td><b>Submitted Questions</b></td> - <td> - {% if submitted %} - {{ submitted|join:", " }} - {% else %} - <p><b>No Questions have been Submitted</b></p> - {% endif %} - </td></tr> - <tr><td><b>Unattempted Questions</b></td> - <td> - {% if unattempted %} - {{ unattempted|join:", " }} - {% else %} - <p><b>All Questions have been Submitted</b></p> - {% endif %} - </td></tr> - </table></center> - {% endif %} + <br><center><table class="bordered-table zebra-striped span8" + style="text-align:left;"> + <tr><td><b>Submitted Questions</b></td> + <td> + {% if paper.questions_answered.all %} + {{ paper.questions_answered.all|join:", " }} + {% else %} + <p><b>No Questions have been Submitted</b></p> + {% endif %} + </td></tr> + <tr><td><b>Unattempted Questions</b></td> + <td> + {% if paper.questions_unanswered.all %} + {{ paper.questions_unanswered.all|join:", " }} + {% else %} + <p><b>All Questions have been Submitted</b></p> + {% endif %} + </td></tr> + </table></center> <center><h4>Your current answers are saved.</h4></center> <center><h4> Are you sure you wish to quit the exam?</h4></center> <center><h4> Be sure, as you won't be able to restart this exam.</h4></center> - <form action="{{URL_ROOT}}/exam/complete/{{ attempt_num }}/{{ id }}/" method="post"> + <form action="{{URL_ROOT}}/exam/complete/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" method="post"> {% csrf_token %} - <center><button class="btn" type="submit" name="yes">Yes!</button> <button class="btn" type="button" name="no" onClick="window.location='{{ URL_ROOT }}/exam/start/{{ attempt_num }}/{{ id }}/'">No!</button></center> + <center><button class="btn" type="submit" name="yes">Yes!</button> <button class="btn" type="button" name="no" onClick="window.location='{{ URL_ROOT }}/exam/start/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/'">No!</button></center> </form> {% 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 @@ <table> <th>Quiz</th> <th>Pre requisite quiz</th> - {% for paper in quizzes %} - {% if paper.quiz.course_id == course.id %} + {% for quiz in quizzes %} + {% if quiz.course_id == course.id %} <tr> - {% if paper in unexpired_quizzes %} + {% if not quiz.is_expired %} <td> - <a href="{{ URL_ROOT }}/exam/intro/{{paper.id}}">{{ paper.quiz.description }}</a><br> + <a href="{{ URL_ROOT }}/exam/intro/{{quiz.questionpaper_set.get.id}}">{{ quiz.description }}</a><br> </td> {% else %} <td> - {{ paper.quiz.description }} <span class="label important">Expired</span><br> + <a href="{{ URL_ROOT }}/exam/intro/{{quiz.questionpaper_set.get.id}}">{{ quiz.description }}</a><br> + {{ quiz.description }} <span class="label important">INACTIVE</span><br> </td> {% endif %} <td> - {% 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 %} </td> </tr> 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 @@ <th>Percentage {% for paper in papers %} <tr> - {% for i in paper %} - <td>{{ i }} - {% endfor %} - <br> + <td>{{ paper.question_paper.quiz.description }}</td> + <td>{{ paper.marks_obtained }}</td> + <td>{{ paper.question_paper.total_marks }}</td> + <td>{{ paper.percent }}</td> + </tr> {% endfor %} </table></center> </form> |