add numberofdocuments
This commit is contained in:
parent
3b661fe05b
commit
8103f01a36
2 changed files with 12 additions and 1 deletions
|
@ -539,6 +539,15 @@
|
||||||
"columnWidth": 60,
|
"columnWidth": 60,
|
||||||
"sort": true
|
"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",
|
"id": "numberoffiles",
|
||||||
"title": "Number of Files",
|
"title": "Number of Files",
|
||||||
|
|
|
@ -748,6 +748,7 @@ class Item(models.Model):
|
||||||
'modified',
|
'modified',
|
||||||
'numberofannotations',
|
'numberofannotations',
|
||||||
'numberofcuts',
|
'numberofcuts',
|
||||||
|
'numberofdocuments',
|
||||||
'numberoffiles',
|
'numberoffiles',
|
||||||
'parts',
|
'parts',
|
||||||
'pixels',
|
'pixels',
|
||||||
|
@ -867,8 +868,9 @@ class Item(models.Model):
|
||||||
for key in ('hue', 'saturation', 'lightness'):
|
for key in ('hue', 'saturation', 'lightness'):
|
||||||
if key in self.data:
|
if key in self.data:
|
||||||
setattr(s, key, self.data.get(key, None))
|
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.numberofcuts = len(self.data.get('cuts', []))
|
||||||
|
s.numberofdocuments = self.documents.count()
|
||||||
if s.duration:
|
if s.duration:
|
||||||
s.cutsperminute = s.numberofcuts / (s.duration/60)
|
s.cutsperminute = s.numberofcuts / (s.duration/60)
|
||||||
s.wordsperminute = s.words / (s.duration / 60)
|
s.wordsperminute = s.words / (s.duration / 60)
|
||||||
|
|
Loading…
Reference in a new issue