1 # -*- coding: utf-8 -*-
2 from django import template
4 register = template.Library()
8 def csv_header(exercise_id, submissionSet):
9 examiners = submissionSet.examiners_by_exercise.get(exercise_id, [])
10 examiners_string = ','.join(['zad %s - %s' % (exercise_id, user.username) for user in examiners])
11 toret = ',zad %s' % exercise_id
13 toret += ',' + examiners_string
18 def csv_row_fragment(exercise_id, submission, submissionSet):
19 final_mark = submission.get_final_exercise_mark(exercise_id)
20 if final_mark is not None:
21 final_mark = ('%.2f' % final_mark).rstrip('0').rstrip('.')
22 toret = final_mark if final_mark else '-'
23 examiners = submissionSet.examiners_by_exercise.get(exercise_id, [])
24 marks_by_examiner = submission.get_exercise_marks_by_examiner(exercise_id)
25 for examiner in examiners:
26 mark = marks_by_examiner.get(str(examiner.id), None)