History fixes (#3921)

(cherry picked from commit 776a4b2a2414f5f35b28f5d8c830baca6351e123)
This commit is contained in:
jobobby04
2020-10-10 16:05:29 -04:00
committed by GitHub
parent a249373bf5
commit efc951191d
4 changed files with 13 additions and 13 deletions

View File

@@ -29,8 +29,8 @@ interface HistoryQueries : DbProvider {
.listOfObjects(MangaChapterHistory::class.java)
.withQuery(
RawQuery.builder()
.query(getRecentMangasQuery(limit, offset, search))
.args(date.time)
.query(getRecentMangasQuery(search))
.args(date.time, limit, offset)
.observesTables(HistoryTable.TABLE)
.build()
)

View File

@@ -50,7 +50,7 @@ fun getRecentsQuery() =
* The select statement returns all information of chapters that have the same id as the chapter in max_last_read
* and are read after the given time period
*/
fun getRecentMangasQuery(limit: Int = 25, offset: Int = 0, search: String = "") =
fun getRecentMangasQuery(search: String = "") =
"""
SELECT ${Manga.TABLE}.${Manga.COL_URL} as mangaUrl, ${Manga.TABLE}.*, ${Chapter.TABLE}.*, ${History.TABLE}.*
FROM ${Manga.TABLE}
@@ -68,7 +68,7 @@ fun getRecentMangasQuery(limit: Int = 25, offset: Int = 0, search: String = "")
AND max_last_read.${History.COL_CHAPTER_ID} = ${History.TABLE}.${History.COL_CHAPTER_ID}
AND lower(${Manga.TABLE}.${Manga.COL_TITLE}) LIKE '%$search%'
ORDER BY max_last_read.${History.COL_LAST_READ} DESC
LIMIT $limit OFFSET $offset
LIMIT ? OFFSET ?
"""
fun getHistoryByMangaId() =