From 48efe1cd915fffc5fa8a8bcb1875659d9f722f73 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Tue, 20 Mar 2018 12:26:51 +0100 Subject: [PATCH] update result csv for multiple mark criteria --- stage2/views.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/stage2/views.py b/stage2/views.py index a010ef4..11be830 100644 --- a/stage2/views.py +++ b/stage2/views.py @@ -258,11 +258,10 @@ def csv_results(request): participant.contact.body['school'], ] for assignment, expert in assignments_experts: - try: - row.append( - Mark.objects.get( - expert=expert, answer__assignment=assignment, answer__participant=participant).points) - except Mark.DoesNotExist: + marks = expert.mark_set.filter(answer__assignment=assignment, answer__participant=participant) + if marks: + row.append(sum(mark.points for mark in marks)) + else: row.append('') for assignment in assignments: row.append('%.2f' % participant.answer_set.get(assignment=assignment).score()) -- 2.20.1