+ def update_complete(self):
+ marks = self.mark_set.all()
+ if len(marks) < 2:
+ complete = False
+ need_arbiter = False
+ elif len(marks) == 2:
+ mark1, mark2 = marks
+ complete = abs(mark1.points - mark2.points) < 0.2 * self.assignment.max_points
+ need_arbiter = not complete
+ else:
+ complete = True
+ need_arbiter = False
+ self.complete = complete
+ self.need_arbiter = need_arbiter
+ self.save()
+
+ def score(self):
+ marks = self.mark_set.all()
+ if len(marks) < 2:
+ return None
+ return self.mark_set.aggregate(models.Avg('points'))
+