X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/b7fbbcfd919b7cf3d69da333a7e3f7c09eacd7e8..5d78f2b7af4ee0f1aa48f1e2538ef40ea6b19b00:/stage2/models.py?ds=sidebyside diff --git a/stage2/models.py b/stage2/models.py index 8407ef2..244322d 100644 --- a/stage2/models.py +++ b/stage2/models.py @@ -175,8 +175,8 @@ class Answer(models.Model): def total_points(self): criterion_count = self.assignment.markcriterion_set.count() - for expert in self.experts.all(): - marks = self.mark_set.filter(expert=expert) + for expert_id in self.mark_set.values_list('expert_id', flat=True).distinct(): + marks = self.mark_set.filter(expert_id=expert_id) if len(marks) == criterion_count: yield sum(mark.points for mark in marks)