From: Jan Szejko Date: Tue, 20 Mar 2018 11:26:51 +0000 (+0100) Subject: update result csv for multiple mark criteria X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/48efe1cd915fffc5fa8a8bcb1875659d9f722f73 update result csv for multiple mark criteria --- 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())