Series ordering fix and bug #5744

This commit is contained in:
Charles Haley 2010-06-07 20:49:51 +01:00
parent 5f3e1f5128
commit cb332cdfb5
2 changed files with 11 additions and 3 deletions

View File

@ -185,11 +185,17 @@ class TagsView(QTreeView): # {{{
if self.model():
self.model().clear_state()
def is_visible(self, idx):
item = idx.internalPointer()
if item.type == TagTreeItem.TAG:
idx = idx.parent()
return self.isExpanded(idx)
def recount(self, *args):
ci = self.currentIndex()
if not ci.isValid():
ci = self.indexAt(QPoint(10, 10))
path = self.model().path_for_index(ci)
path = self.model().path_for_index(ci) if self.is_visible(ci) else None
try:
self.model().refresh()
except: #Database connection could be closed if an integrity check is happening

View File

@ -1049,8 +1049,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
# new series index to each of the books.
# Get the list of books where we must update the series index
books = self.conn.get('''SELECT book from books_series_link
WHERE series=?''', (old_id,))
books = self.conn.get('''SELECT books.id
FROM books, books_series_link as lt
WHERE books.id = lt.book AND lt.series=?
ORDER BY books.series_index''', (old_id,))
# Get the next series index
index = self.get_next_series_num_for(new_name)
# Now update the link table