always update numberoffiles

This commit is contained in:
j 2013-08-25 14:54:30 +02:00
parent f30a3fa70c
commit 2d7def5c05

View file

@ -828,6 +828,7 @@ class Item(models.Model):
s.words = sum([len(a.value.split()) for a in self.annotations.exclude(value='')]) s.words = sum([len(a.value.split()) for a in self.annotations.exclude(value='')])
s.clips = self.clips.count() s.clips = self.clips.count()
s.numberoffiles = self.files.all().count()
videos = self.files.filter(selected=True).filter(Q(is_video=True)|Q(is_audio=True)) videos = self.files.filter(selected=True).filter(Q(is_video=True)|Q(is_audio=True))
if videos.count() > 0: if videos.count() > 0:
s.duration = sum([v.duration for v in videos]) s.duration = sum([v.duration for v in videos])
@ -843,7 +844,6 @@ class Item(models.Model):
if not s.aspectratio and v.display_aspect_ratio: if not s.aspectratio and v.display_aspect_ratio:
s.aspectratio = float(utils.parse_decimal(v.display_aspect_ratio)) s.aspectratio = float(utils.parse_decimal(v.display_aspect_ratio))
s.pixels = sum([v.pixels for v in videos]) s.pixels = sum([v.pixels for v in videos])
s.numberoffiles = self.files.all().count()
s.parts = videos.count() s.parts = videos.count()
s.size = sum([v.size for v in videos]) #FIXME: only size of movies? s.size = sum([v.size for v in videos]) #FIXME: only size of movies?
if s.duration: if s.duration: