diff options
-rw-r--r-- | yaksh/models.py | 3 | ||||
-rw-r--r-- | yaksh/templates/exam.html | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 68bde48..906dd7e 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1170,6 +1170,7 @@ class AnswerPaper(models.Model): """Returns the current active question to display.""" if self.questions_unanswered.all(): return self.questions_unanswered.all()[0] + return self.questions.all()[0] def questions_left(self): """Returns the number of questions left.""" @@ -1199,8 +1200,6 @@ class AnswerPaper(models.Model): questions = list(all_questions.values_list('id', flat=True)) if len(questions) == 0: return None - if unanswered_questions.count() == 0: - return None try: index = questions.index(int(question_id)) next_id = questions[index+1] diff --git a/yaksh/templates/exam.html b/yaksh/templates/exam.html index 45b85f0..4d211d2 100644 --- a/yaksh/templates/exam.html +++ b/yaksh/templates/exam.html @@ -18,7 +18,13 @@ <form id="logout" action="{{URL_ROOT}}/exam/quit/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" method="post" class="pull-right"> {% csrf_token %} <ul class="nav navbar-nav navbar"> - <li style="padding: 10px"><button class="btn btn-danger btn-sm" type="submit" name="quit">Quit Exam <span class="glyphicon glyphicon-off"></span></button></li> + <li style="padding: 10px"><button class="btn btn-danger btn-sm" type="submit" name="quit"> + {% if paper.questions_unanswered.all %} + Quit Exam + {% else %} + Finish Exam + {% endif %} + <span class="glyphicon glyphicon-off"></span></button></li> </ul> </form> <div class="time-div" id="time_left"></div> |