Bible search fixes (Bug #608409)

This commit is contained in:
Jon Tibble 2010-07-24 03:14:08 +01:00
parent ccda22a962
commit 323090e141
3 changed files with 12 additions and 6 deletions

View File

@ -305,6 +305,13 @@ class BibleDB(QtCore.QObject, Manager):
Book.abbreviation.like(book + u'%'))
return db_book
def get_books(self):
"""
A wrapper so both local and web bibles have a get_books() method that
manager can call. Used in the media manager advanced search tab.
"""
return self.get_all_objects(Book, order_by_ref=Book.id)
def get_verses(self, reference_list):
"""
This is probably the most used function. It retrieves the list of

View File

@ -135,10 +135,10 @@ class HTTPBooks(object):
u'verses FROM chapters WHERE book_id = ?', (book[u'id'],))
if chapters:
return {
u'id': chapters[chapter][0],
u'book_id': chapters[chapter][1],
u'chapter': chapters[chapter][2],
u'verses': chapters[chapter][3]
u'id': chapters[chapter-1][0],
u'book_id': chapters[chapter-1][1],
u'chapter': chapters[chapter-1][2],
u'verses': chapters[chapter-1][3]
}
else:
return None

View File

@ -198,8 +198,7 @@ class BibleManager(object):
u'name': book.name,
u'chapters': self.db_cache[bible].get_chapter_count(book.name)
}
for book in self.db_cache[bible].get_all_objects(Book,
order_by_ref=Book.id)
for book in self.db_cache[bible].get_books()
]
def get_chapter_count(self, bible, book):