summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authoradityacp2020-11-03 17:52:24 +0530
committeradityacp2020-11-03 17:54:33 +0530
commitaef2589eadaf7f3252e281286ab1bb83e690ba6a (patch)
tree1764959aca48f835be56c0819cddd286aeb8b4df /yaksh/models.py
parent167b53a673630c4243c5d82a5966797213a5fa28 (diff)
parent81f96a24954d375ab32ab8dfb1ee8aba299655c6 (diff)
downloadonline_test-aef2589eadaf7f3252e281286ab1bb83e690ba6a.tar.gz
online_test-aef2589eadaf7f3252e281286ab1bb83e690ba6a.tar.bz2
online_test-aef2589eadaf7f3252e281286ab1bb83e690ba6a.zip
Resolve conflicts
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 932e38c..2a06cc8 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -2379,15 +2379,24 @@ class AnswerPaper(models.Model):
'error_list': [e for e in json.loads(answer.error)]
}]
+ q_a.update(
+ { q: [] for q in self.questions_unanswered.all() }
+ )
+
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
- ])
- })
+ if answers:
+ q_a[question].append({
+ 'marks': max([
+ answer['answer'].marks
+ for answer in answers
+ if question == answer['answer'].question
+ ]),
+ })
+ else:
+ q_a[question].append({
+ 'marks': 0.0,
+ })
return q_a