Fixing admin results report
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 13 Nov 2013 12:21:11 +0000 (13:21 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 15 Jan 2014 10:18:59 +0000 (11:18 +0100)
wtem/models.py
wtem/templatetags/wtem_csv.py

index 5325a58..56c814c 100644 (file)
@@ -83,7 +83,7 @@ class Submission(models.Model):
         if exercise_checked_manually(exercise):
             marks_by_examiner = self.get_exercise_marks_by_examiner(exercise_id)
             if len(marks_by_examiner):
-                return max(marks_by_examiner.values())
+                return max(map(int, marks_by_examiner.values()))
             else:
                 return None
         else:
index 9d444e7..be3a905 100644 (file)
@@ -14,11 +14,12 @@ def csv_header(exercise_id, submissionSet):
 
 @register.simple_tag
 def csv_row_fragment(exercise_id, submission, submissionSet):
-    toret = '%s' % submission.final_result
-    examiners = submissionSet.examiners_by_exercise[exercise_id]
+    final_mark = submission.get_final_exercise_mark(exercise_id)
+    toret = str(final_mark) if isinstance(final_mark, int) else '-'
+    examiners = submissionSet.examiners_by_exercise.get(exercise_id, [])
     marks_by_examiner = submission.get_exercise_marks_by_examiner(exercise_id)
     for examiner in examiners:
-        mark = marks_by_examiner[examiner.id]
+        mark = marks_by_examiner.get(str(examiner.id), None)
         toret += ','
         if mark is None:
             toret += '-'