From 158ce6fdda30938df1c07d71ec91472db660e604 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 9 May 2016 00:19:09 +0300 Subject: [PATCH] Fix bugs in counting extensions and languages --- m_librarian/db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(): -- 2.39.2