remove duplicate courses to scoreboard counts
authorBryan <btbonval@gmail.com>
Mon, 30 Mar 2015 17:54:04 +0000 (13:54 -0400)
committerBryan <btbonval@gmail.com>
Mon, 30 Mar 2015 17:54:04 +0000 (13:54 -0400)
closes #421

karmaworld/apps/courses/models.py

index 13b39d7241be6f25c457473cdcc20cead9add9c6..0746f644289dfe95902e80b8bc60825981557043 100644 (file)
@@ -93,11 +93,11 @@ class School(models.Model):
             contained course.file_count
         """
         # find all courses without a department
-        course_list = list(self.course_set.all())
+        course_list = set(self.course_set.all())
         # find all courses with a department
         for department in self.department_set.all():
             for course in department.course_set.all():
-                course_list.append(course)
+                course_list.add(course)
         self.file_count = sum([course.file_count for course in course_list])
         self.save()