From 30982be0a92bc09e33cb0c754338495e8f38e675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Tue, 28 Mar 2017 18:43:15 +0200 Subject: [PATCH] Updated the comic model for getting the reading comics properly sorted. //TODO This should be using the method in the DBHelper. --- YACReaderLibrary/db/comic_model.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/YACReaderLibrary/db/comic_model.cpp b/YACReaderLibrary/db/comic_model.cpp index ec758603..2995c92e 100644 --- a/YACReaderLibrary/db/comic_model.cpp +++ b/YACReaderLibrary/db/comic_model.cpp @@ -607,9 +607,11 @@ void ComicModel::setupReadingModelData(const QString &databasePath) QSqlQuery selectQuery(db); selectQuery.prepare("SELECT ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read,ci.isBis,ci.currentPage,ci.rating,ci.hasBeenOpened " "FROM comic c INNER JOIN comic_info ci ON (c.comicInfoId = ci.id) " - "WHERE ci.hasBeenOpened = 1 AND ci.read = 0 AND ci.currentPage != ci.numPages AND ci.currentPage != 1"); + "WHERE ci.hasBeenOpened = 1 AND ci.read = 0 AND ci.currentPage != ci.numPages AND ci.currentPage != 1 " + "ORDER BY ci.lastTimeOpened DESC"); selectQuery.exec(); - setupModelData(selectQuery); + + setupModelDataForList(selectQuery); } db.close(); QSqlDatabase::removeDatabase(_databasePath);