diff options
author | ankitjavalkar | 2020-10-15 23:45:23 +0530 |
---|---|---|
committer | ankitjavalkar | 2020-10-15 23:47:58 +0530 |
commit | 5d1c3f0ba11bfd84be1d3074a327b021eced56e5 (patch) | |
tree | c3b246a89eb391737ec817ad7a68b8bbf26250f0 /yaksh/models.py | |
parent | 430c8d1480d897e9fc0dc328bad173642d0a2946 (diff) | |
download | online_test-5d1c3f0ba11bfd84be1d3074a327b021eced56e5.tar.gz online_test-5d1c3f0ba11bfd84be1d3074a327b021eced56e5.tar.bz2 online_test-5d1c3f0ba11bfd84be1d3074a327b021eced56e5.zip |
Display unanswered questions in grading view
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 23 |
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 |