summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-10-29 10:34:43 +0530
committerGitHub2020-10-29 10:34:43 +0530
commit602f88e334865c995d86a457acdca6cc43b354ef (patch)
tree49ff94d897f8c9ea996ba776829e6b87930d55d3
parent9442104635daa5bee6952bbe2c7905b319373946 (diff)
parent5d1c3f0ba11bfd84be1d3074a327b021eced56e5 (diff)
downloadonline_test-602f88e334865c995d86a457acdca6cc43b354ef.tar.gz
online_test-602f88e334865c995d86a457acdca6cc43b354ef.tar.bz2
online_test-602f88e334865c995d86a457acdca6cc43b354ef.zip
Merge pull request #782 from ankitjavalkar/fix-disp-unans-quest
Display unanswered questions in grading view
-rw-r--r--yaksh/models.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index da2327c..cca2a2c 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -2378,15 +2378,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