fixes
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Thu, 29 Dec 2011 09:03:55 +0000 (10:03 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Thu, 29 Dec 2011 09:03:55 +0000 (10:03 +0100)
apps/catalogue/models/book.py
apps/catalogue/tasks.py

index 772b121..4fbd194 100755 (executable)
@@ -271,6 +271,8 @@ class Book(models.Model):
     def get_on_track(self):
         if self.published:
             return -1
     def get_on_track(self):
         if self.published:
             return -1
+        if len(self) == 0:
+            return -1
         return min(ch.stage.ordering for ch in self) or 0
     on_track = cached_in_field('_on_track')(get_on_track)
 
         return min(ch.stage.ordering for ch in self) or 0
     on_track = cached_in_field('_on_track')(get_on_track)
 
index 547f36b..c84a291 100644 (file)
@@ -3,7 +3,7 @@ from django.utils import translation
 from django.conf import settings
 
 
 from django.conf import settings
 
 
-@task
+@task(ignore_result=True)
 def _refresh_by_pk(cls, pk, language=None):
     prev_language = translation.get_language()
     language and translation.activate(language)
 def _refresh_by_pk(cls, pk, language=None):
     prev_language = translation.get_language()
     language and translation.activate(language)
@@ -34,6 +34,6 @@ def publishable_error(book):
         translation.get_language()).wait()
 
 
         translation.get_language()).wait()
 
 
-@task
+@task(ignore_result=True)
 def book_content_updated(book):
     book.refresh_dc_cache()
 def book_content_updated(book):
     book.refresh_dc_cache()