diff --git a/data/models.py b/data/models.py index 4d61bf8..a3269d8 100644 --- a/data/models.py +++ b/data/models.py @@ -2,6 +2,7 @@ import json import logging import re +import cProfile from django.conf import settings from django.core.exceptions import ValidationError, FieldError @@ -120,7 +121,7 @@ def get_student(self, key_str): return student def __str__(self): - return "%s (%s)" % (self.name, self.created) + return "%s (%s) id:%s" % (self.name, self.created, self.key) class Exercise(models.Model): @@ -222,13 +223,20 @@ def top_comparisons(self, rows): return sorted_unique_set def comparisons_for_student(self, student): - return self._comparisons_by_submission( + student_list = self._comparisons_by_submission( self.valid_matched_submissions\ .filter(student=student)\ .order_by("created")\ .values_list("id", flat=True) ) + unique_set = set() + + for student in student_list: + unique_set.update(student["matches"]) + + return unique_set + def _comparisons_by_submission(self, submissions): comparisons = [] for s_id in submissions: diff --git a/review/templates/review/_comparisontable_new.html b/review/templates/review/_comparisontable_unique.html similarity index 80% rename from review/templates/review/_comparisontable_new.html rename to review/templates/review/_comparisontable_unique.html index 1e56f7e..9ed26b9 100644 --- a/review/templates/review/_comparisontable_new.html +++ b/review/templates/review/_comparisontable_unique.html @@ -2,7 +2,7 @@
{% student_td course comparison %} | +{% student_td course comparison %} | {% if forloop.counter|divisibleby:10 %}