summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorCruiseDevice2020-08-28 18:30:42 +0530
committerCruiseDevice2020-08-28 18:36:17 +0530
commitb41cf01f58544a6c71c16bab1854142a3ffc8e03 (patch)
tree196fce9ca16bdef2d37ec038cc1cd3581b962b26 /yaksh/models.py
parent9569e3ef6bbaeb8b36ad78c272006a538e044894 (diff)
downloadonline_test-b41cf01f58544a6c71c16bab1854142a3ffc8e03.tar.gz
online_test-b41cf01f58544a6c71c16bab1854142a3ffc8e03.tar.bz2
online_test-b41cf01f58544a6c71c16bab1854142a3ffc8e03.zip
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.
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py11
1 files changed, 11 insertions, 0 deletions
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):