--- a/src/iconolab/models.py Tue May 23 16:49:39 2017 +0200
+++ b/src/iconolab/models.py Tue May 23 19:10:45 2017 +0200
@@ -54,12 +54,16 @@
show_image_on_home = models.BooleanField(default=False)
@cached_property
+ def items_count(self):
+ return self.items.count()
+
+ @cached_property
def completed_percent(self):
items_with_annotation = \
ImageStats.objects.filter(image__item__collection = self, annotations_count__gt=0)\
.values('image__item').distinct().count()
- total_items = Item.objects.filter(collection=self).count()
+ total_items = self.items_count
return int(round((items_with_annotation * 100) / total_items))