From 9484e8bebcd4363fa3aa1c2fc842de1bdcc25a10 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 23 Feb 2017 17:33:07 +0530 Subject: Allow revisiting all types of question to resubmit answer --- yaksh/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 2d84622..61c9059 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -988,7 +988,8 @@ class AnswerPaper(models.Model): questions and returns the next question. """ next_question = self.next_question(question_id) - self.questions_answered.add(question_id) + if question_id not in self.questions_answered.all(): + self.questions_answered.add(question_id) self.questions_unanswered.remove(question_id) if next_question.id == int(question_id): return None -- cgit From 0f2a42799d3140de132c203cc255516caa69d617 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 2 Mar 2017 10:34:37 +0530 Subject: Rename completed_question model method to add_completed_question --- yaksh/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 61c9059..b80482c 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -982,7 +982,7 @@ class AnswerPaper(models.Model): """Returns the number of questions left.""" return self.questions_unanswered.count() - def completed_question(self, question_id): + def add_completed_question(self, question_id): """ Adds the completed question to the list of answered questions and returns the next question. -- cgit From d0d4c9ab3a409c68766bc044825bf22b0519f6a3 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Fri, 3 Mar 2017 16:35:18 +0530 Subject: Multiple changes: - Fix movement from one question to another in next_question - Fix random display of errors from MCQs - Add Notification display if question has been attempted - Fix test cases for changes made --- yaksh/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index b80482c..f0f4ca6 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1000,8 +1000,8 @@ class AnswerPaper(models.Model): Skips the current question and returns the next sequentially available question. """ - unanswered_questions = self.questions_unanswered.all() - questions = list(unanswered_questions.values_list('id', flat=True)) + all_questions = self.questions.all() + questions = list(all_questions.values_list('id', flat=True)) if len(questions) == 0: return None try: @@ -1009,7 +1009,7 @@ class AnswerPaper(models.Model): next_id = questions[index+1] except (ValueError, IndexError): next_id = questions[0] - return unanswered_questions.get(id=next_id) + return all_questions.get(id=next_id) def time_left(self): """Return the time remaining for the user in seconds.""" -- cgit From a53df8040785cffaf46bfc1775c59eed7c4a15c3 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Mon, 6 Mar 2017 19:56:56 +0530 Subject: Multiple fixes: - Add error message details to SeleniumTestError - Fix next question cycling in models - Fix model test cases --- yaksh/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index f0f4ca6..398f508 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -987,11 +987,12 @@ class AnswerPaper(models.Model): Adds the completed question to the list of answered questions and returns the next question. """ - next_question = self.next_question(question_id) if question_id not in self.questions_answered.all(): self.questions_answered.add(question_id) self.questions_unanswered.remove(question_id) - if next_question.id == int(question_id): + + next_question = self.next_question(question_id) + if next_question and next_question.id == int(question_id): return None return next_question @@ -1001,9 +1002,12 @@ class AnswerPaper(models.Model): available question. """ all_questions = self.questions.all() + unanswered_questions = self.questions_unanswered.all() 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] -- cgit