]> git.phdru.name Git - m_librarian.git/commitdiff
Fix bugs in counting extensions and languages
authorOleg Broytman <phd@phdru.name>
Sun, 8 May 2016 21:19:09 +0000 (00:19 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 8 May 2016 21:19:09 +0000 (00:19 +0300)
m_librarian/db.py

index 93631679139da91072146144debc2419950e5a1d..c06fab81b6e3858ec1b72956b21a490bf3bdfeb7 100755 (executable)
@@ -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():