rebuild place/event matches once a day, this gets out of sync if new annotations are added

This commit is contained in:
j 2011-10-27 10:21:28 +02:00
parent e24a59fb70
commit 16d6c2c0fe
2 changed files with 14 additions and 0 deletions

View file

@ -7,6 +7,13 @@ from celery.decorators import task, periodic_task
import models
@periodic_task(run_every=timedelta(days=1), queue='encoding')
def update_all_matches(**kwargs):
ids = [e['id'] for e in models.Event.objects.all().values('id')]
for i in ids:
e = models.Event.objects.get(pk=i)
e.update_matches()
@task(ignore_resulsts=True, queue='default')
def update_matches(eventId):
event = models.Event.objects.get(pk=eventId)

View file

@ -7,6 +7,13 @@ from celery.decorators import task, periodic_task
import models
@periodic_task(run_every=timedelta(days=1), queue='encoding')
def update_all_matches(**kwargs):
ids = [p['id'] for p in models.Place.objects.all().values('id')]
for i in ids:
p = models.Place.objects.get(pk=i)
p.update_matches()
@task(ignore_resulsts=True, queue='default')
def update_matches(id):
place = models.Place.objects.get(pk=id)