From: Oleg Broytman Date: Sun, 8 May 2016 21:19:09 +0000 (+0300) Subject: Fix bugs in counting extensions and languages X-Git-Tag: 0.0.4~11 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=158ce6fdda30938df1c07d71ec91472db660e604;p=m_librarian.git Fix bugs in counting extensions and languages --- diff --git a/m_librarian/db.py b/m_librarian/db.py index 9363167..c06fab8 100755 --- a/m_librarian/db.py +++ b/m_librarian/db.py @@ -198,13 +198,13 @@ def update_counters(): author.count = AuthorBook.select(AuthorBook.q.author == author).count() for ext in Extension.select(): - ext.count = Book.select(Book.q.extension == ext.name).count() + ext.count = Book.select(Book.q.extension == ext.id).count() for genre in Genre.select(): genre.count = BookGenre.select(BookGenre.q.genre == genre).count() for language in Language.select(): - language.count = Book.select(Book.q.language == language.name).count() + language.count = Book.select(Book.q.language == language.id).count() def test():