remove clips without annotations

This commit is contained in:
j 2012-02-15 22:03:19 +05:30
parent d7affcb0fe
commit f3d20abe99

View file

@ -49,7 +49,10 @@ def update_matching_places(id):
@task(ignore_resulsts=True, queue='default') @task(ignore_resulsts=True, queue='default')
def update_item(id): def update_item(id):
from item.models import Item from item.models import Item
from clip.models import Clip
a = models.Annotation.objects.get(pk=id) a = models.Annotation.objects.get(pk=id)
#cleanup orphaned clips
Clip.objects.filter(annotations__id=None).delete()
#update facets if needed #update facets if needed
if filter(lambda f: f['id'] == a.layer, settings.CONFIG['filters']): if filter(lambda f: f['id'] == a.layer, settings.CONFIG['filters']):
a.item.update_layer_facet(a.layer) a.item.update_layer_facet(a.layer)