avoid updating item if another annotation was added or edited since dispatching the update_item event
This commit is contained in:
parent
380185efd4
commit
34f2cfe290
1 changed files with 14 additions and 13 deletions
|
@ -109,16 +109,17 @@ def update_item(id):
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
from clip.models import Clip
|
from clip.models import Clip
|
||||||
a = models.Annotation.objects.get(pk=id)
|
a = models.Annotation.objects.get(pk=id)
|
||||||
#cleanup orphaned clips
|
if a.modified >= a.item.annotations.order_by('-modified')[0].modified:
|
||||||
Clip.objects.filter(item__id=a.item.id, annotations__id=None).delete()
|
#cleanup orphaned clips
|
||||||
#update facets if needed
|
Clip.objects.filter(item__id=a.item.id, annotations__id=None).delete()
|
||||||
with transaction.commit_on_success():
|
#update facets if needed
|
||||||
if filter(lambda f: f['id'] == a.layer and f.get('filter'), settings.CONFIG['itemKeys']):
|
with transaction.commit_on_success():
|
||||||
a.item.update_layer_facet(a.layer)
|
if filter(lambda f: f['id'] == a.layer and f.get('filter'), settings.CONFIG['itemKeys']):
|
||||||
Item.objects.filter(id=a.item.id).update(modified=a.modified)
|
a.item.update_layer_facet(a.layer)
|
||||||
a.item.modified = a.modified
|
Item.objects.filter(id=a.item.id).update(modified=a.modified)
|
||||||
a.item.update_find()
|
a.item.modified = a.modified
|
||||||
a.item.update_sort()
|
a.item.update_find()
|
||||||
a.item.update_facets()
|
a.item.update_sort()
|
||||||
if a.item.update_languages():
|
a.item.update_facets()
|
||||||
a.item.save()
|
if a.item.update_languages():
|
||||||
|
a.item.save()
|
||||||
|
|
Loading…
Reference in a new issue