From b41cf01f58544a6c71c16bab1854142a3ffc8e03 Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Fri, 28 Aug 2020 18:30:42 +0530 Subject: Show max marks for all attempts in answerpaper - Latest attempt marks were shown in the answerpaper, which made it difficult to analyze the paper. This PR fixes the issue and the best marks of all the attempt are provided. --- yaksh/models.py | 11 +++++++++++ yaksh/templates/yaksh/user_data.html | 24 +++++++++++------------- yaksh/views.py | 1 - 3 files changed, 22 insertions(+), 14 deletions(-) (limited to 'yaksh') diff --git a/yaksh/models.py b/yaksh/models.py index 1094bb0..0456b52 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -2305,6 +2305,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): diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html index 6252fb3..a79071d 100644 --- a/yaksh/templates/yaksh/user_data.html +++ b/yaksh/templates/yaksh/user_data.html @@ -74,19 +74,17 @@
- {% for question, answers in paper.get_question_answers.items %} - {% with answers|last as answer %} -