summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaheshgudi2017-02-03 01:28:50 +0530
committermaheshgudi2017-02-03 11:57:03 +0530
commitb277f9191bf8720533901e58db36851675b8f430 (patch)
treeb38157409549b13c801cdfc9d2115eb237e6a210
parentf3731c3314410377133431ae1c6ac0199ed822e2 (diff)
downloadonline_test-b277f9191bf8720533901e58db36851675b8f430.tar.gz
online_test-b277f9191bf8720533901e58db36851675b8f430.tar.bz2
online_test-b277f9191bf8720533901e58db36851675b8f430.zip
added skip question feature. closes #191
The can_skip_questions attribute is to be set True for students to be able to skip questions. If it is set as False, students wont be able to skip to the next question.
-rw-r--r--yaksh/models.py4
-rw-r--r--yaksh/templates/exam.html4
-rw-r--r--yaksh/templates/yaksh/question.html5
3 files changed, 12 insertions, 1 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index b917889..b2ba91f 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -580,6 +580,10 @@ class Quiz(models.Model):
view_answerpaper = models.BooleanField('Allow student to view their answer\
paper', default=False)
+ can_skip_questions = models.BooleanField("Allow students to skip questions",
+ default=True
+ )
+
objects = QuizManager()
class Meta:
diff --git a/yaksh/templates/exam.html b/yaksh/templates/exam.html
index 101f3f3..00633a3 100644
--- a/yaksh/templates/exam.html
+++ b/yaksh/templates/exam.html
@@ -31,6 +31,7 @@
<p> Question Navigator </p>
<ul class="pagination pagination-sm">
{% for qid in paper.questions.all %}
+ {%if paper.question_paper.quiz.can_skip_questions%}
{% if qid in paper.questions_unanswered.all %}
{% if qid.id == question.id %}
<li class="active"><a style="width:25%" href="#"data-toggle="tooltip"
@@ -44,6 +45,9 @@
{% if qid in paper.questions_answered.all %}
<li class="disabled"><a style="background-color:#B4B8BA; width:25%" href="#" data-toggle="tooltip" title="{{ qid.description }}" >{{ forloop.counter }}</a></li>
{% endif %}
+ {% else %}
+ <li><a style="width:25%" href="#" data-toggle="tooltip" title="{{ qid.description|striptags }}">{{ forloop.counter }}</a></li>
+ {% endif %}
{% endfor %}
</ul>
<p>Question(s) left: <b>{{ paper.questions_left }}</b></p>
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index 41634f2..8fea8b3 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -199,14 +199,17 @@ function call_skip(url)
{% else %}
<button class="btn btn-primary" type="submit" name="check" id="check" onClick="submitCode();">Check Answer <span class="glyphicon glyphicon-cog"></span></button>&nbsp;&nbsp;
{% endif %}
+ {% if paper.question_paper.quiz.can_skip_questions %}
{% if paper.unanswered.all|length != 1 %}
<button class="btn btn-primary" onclick="call_skip('{{ URL_ROOT }}/exam/{{ question.id }}/skip/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')" name="skip" id="skip">Attempt Later <span class="glyphicon glyphicon-arrow-right"></span></button>
- {% endif %}
</div>
</div>
</div>
</form>
+ {% endif %}
+ {% endif %}
+
<!-- Modal -->
<div class="modal fade " id="upload_alert" >
<div class="modal-dialog">