diff options
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index d051e68..8297ec8 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -2323,6 +2323,17 @@ class AnswerPaper(models.Model): 'answer': answer, 'error_list': [e for e in json.loads(answer.error)] }] + + for question, answers in q_a.items(): + answers = q_a[question] + q_a[question].append({ + 'marks': max([ + answer['answer'].marks + for answer in answers + if question == answer['answer'].question + ]) + }) + return q_a def get_latest_answer(self, question_id): @@ -2332,7 +2343,7 @@ class AnswerPaper(models.Model): return self.questions.filter(active=True) def get_questions_answered(self): - return self.questions_answered.all() + return self.questions_answered.all().distinct() def get_questions_unanswered(self): return self.questions_unanswered.all() |