add numberofdocuments

This commit is contained in:
j 2014-01-02 13:54:35 +00:00
parent 3b661fe05b
commit 8103f01a36
2 changed files with 12 additions and 1 deletions

View file

@ -539,6 +539,15 @@
"columnWidth": 60,
"sort": true
},
{
"id": "numberofdocuments",
"title": "Number of Documents",
"type": "integer",
"columnWidth": 60,
"format": {"type": "number", "args": []},
"sort": true,
"value": {"key": "documents", "type": "length"}
},
{
"id": "numberoffiles",
"title": "Number of Files",

View file

@ -748,6 +748,7 @@ class Item(models.Model):
'modified',
'numberofannotations',
'numberofcuts',
'numberofdocuments',
'numberoffiles',
'parts',
'pixels',
@ -867,8 +868,9 @@ class Item(models.Model):
for key in ('hue', 'saturation', 'lightness'):
if key in self.data:
setattr(s, key, self.data.get(key, None))
s.numberofannotations = self.annotations.all().count()
s.numberofannotations = self.annotations.count()
s.numberofcuts = len(self.data.get('cuts', []))
s.numberofdocuments = self.documents.count()
if s.duration:
s.cutsperminute = s.numberofcuts / (s.duration/60)
s.wordsperminute = s.words / (s.duration / 60)