diff options
author | Prabhu Ramachandran | 2017-02-03 18:46:24 +0530 |
---|---|---|
committer | GitHub | 2017-02-03 18:46:24 +0530 |
commit | a3886ca604760acee2940daae162940e86b7ac98 (patch) | |
tree | f8e989b5aa79f8c531b068f4dbd201b0d6874796 /yaksh | |
parent | 227557f9047d4e382fa84ac5aff8079a5544f111 (diff) | |
parent | 1d5cd5253b125eb6406dd67e9f267c208658bcfc (diff) | |
download | online_test-a3886ca604760acee2940daae162940e86b7ac98.tar.gz online_test-a3886ca604760acee2940daae162940e86b7ac98.tar.bz2 online_test-a3886ca604760acee2940daae162940e86b7ac98.zip |
Merge pull request #206 from maheshgudi/fix-191
added skip question feature. closes #191
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 3 | ||||
-rw-r--r-- | yaksh/templates/exam.html | 12 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 5 |
3 files changed, 16 insertions, 4 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 3a6b326..49ba32a 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -580,6 +580,9 @@ class Quiz(models.Model): view_answerpaper = models.BooleanField('Allow student to view their answer\ paper', default=False) + allow_skip = 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..dfcaf2d 100644 --- a/yaksh/templates/exam.html +++ b/yaksh/templates/exam.html @@ -31,7 +31,8 @@ <p> Question Navigator </p> <ul class="pagination pagination-sm"> {% for qid in paper.questions.all %} - {% if qid in paper.questions_unanswered.all %} + {%if paper.question_paper.quiz.allow_skip %} + {% if qid in paper.get_questions_unanswered %} {% if qid.id == question.id %} <li class="active"><a style="width:25%" href="#"data-toggle="tooltip" title="{{ qid.description|striptags }}" @@ -41,9 +42,16 @@ onclick="call_skip('{{ URL_ROOT }}/exam/{{ question.id }}/skip/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ forloop.counter }}</a></li> {% endif %} {% endif %} - {% if qid in paper.questions_answered.all %} + {% if qid in paper.get_questions_answered %} <li class="disabled"><a style="background-color:#B4B8BA; width:25%" href="#" data-toggle="tooltip" title="{{ qid.description }}" >{{ forloop.counter }}</a></li> {% endif %} + {% else %} + {% if qid.id == question.id %} + <li class="active"><a style="width:25%" data-toggle="tooltip" title="{{ qid.description|striptags }}">{{ forloop.counter }}</a></li> + {% else %} + <li class="disabled"><a style="width:25%" data-toggle="tooltip" title="{{ qid.description|striptags }}">{{ forloop.counter }}</a></li> + {% endif %} + {% 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..6218b18 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -199,14 +199,15 @@ 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> {% endif %} - {% if paper.unanswered.all|length != 1 %} + {% if paper.question_paper.quiz.allow_skip and not paper.get_questions_unanswered|length_is:"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 %} + <!-- Modal --> <div class="modal fade " id="upload_alert" > <div class="modal-dialog"> |