Fix updates sorting in recents

This commit is contained in:
Jays2Kings 2021-04-09 02:10:49 -04:00
parent 720a78d968
commit 801568950f
2 changed files with 5 additions and 5 deletions

View File

@ -46,8 +46,8 @@ fun getRecentsQuery(search: String) =
SELECT ${Manga.TABLE}.${Manga.COL_URL} as mangaUrl, * FROM ${Manga.TABLE} JOIN ${Chapter.TABLE} SELECT ${Manga.TABLE}.${Manga.COL_URL} as mangaUrl, * FROM ${Manga.TABLE} JOIN ${Chapter.TABLE}
ON ${Manga.TABLE}.${Manga.COL_ID} = ${Chapter.TABLE}.${Chapter.COL_MANGA_ID} ON ${Manga.TABLE}.${Manga.COL_ID} = ${Chapter.TABLE}.${Chapter.COL_MANGA_ID}
WHERE ${Manga.COL_FAVORITE} = 1 WHERE ${Manga.COL_FAVORITE} = 1
AND ${Chapter.COL_DATE_UPLOAD} > ? AND ${Chapter.COL_DATE_FETCH} > ?
AND ${Chapter.COL_DATE_UPLOAD} < ? AND ${Chapter.COL_DATE_FETCH} < ?
AND ${Chapter.COL_DATE_FETCH} > ${Manga.COL_DATE_ADDED} AND ${Chapter.COL_DATE_FETCH} > ${Manga.COL_DATE_ADDED}
AND lower(${Manga.COL_TITLE}) LIKE '%$search%' AND lower(${Manga.COL_TITLE}) LIKE '%$search%'
ORDER BY ${Chapter.COL_DATE_UPLOAD} DESC ORDER BY ${Chapter.COL_DATE_UPLOAD} DESC
@ -80,8 +80,8 @@ fun getRecentsQueryDistinct(search: String, endless: Boolean) =
SELECT ${Chapter.TABLE}.${Chapter.COL_MANGA_ID},${Chapter.TABLE}.${Chapter.COL_ID} as ${History.COL_CHAPTER_ID},MAX(${Chapter.TABLE}.${Chapter.COL_DATE_UPLOAD}) SELECT ${Chapter.TABLE}.${Chapter.COL_MANGA_ID},${Chapter.TABLE}.${Chapter.COL_ID} as ${History.COL_CHAPTER_ID},MAX(${Chapter.TABLE}.${Chapter.COL_DATE_UPLOAD})
FROM ${Chapter.TABLE} JOIN ${Manga.TABLE} FROM ${Chapter.TABLE} JOIN ${Manga.TABLE}
ON ${Manga.TABLE}.${Manga.COL_ID} = ${Chapter.TABLE}.${Chapter.COL_MANGA_ID} ON ${Manga.TABLE}.${Manga.COL_ID} = ${Chapter.TABLE}.${Chapter.COL_MANGA_ID}
WHERE ${Chapter.COL_DATE_UPLOAD} > ? WHERE ${Chapter.COL_DATE_FETCH} > ?
AND ${Chapter.COL_DATE_UPLOAD} < ? AND ${Chapter.COL_DATE_FETCH} < ?
AND ${Chapter.COL_READ} = 0 AND ${Chapter.COL_READ} = 0
GROUP BY ${Chapter.TABLE}.${Chapter.COL_MANGA_ID}) AS newest_chapter GROUP BY ${Chapter.TABLE}.${Chapter.COL_MANGA_ID}) AS newest_chapter
ON ${Chapter.TABLE}.${Chapter.COL_MANGA_ID} = newest_chapter.${Chapter.COL_MANGA_ID} ON ${Chapter.TABLE}.${Chapter.COL_MANGA_ID} = newest_chapter.${Chapter.COL_MANGA_ID}

View File

@ -170,7 +170,7 @@ class RecentsPresenter(
else -> emptyList() else -> emptyList()
} }
rUpdates.forEach { rUpdates.forEach {
it.history.last_read = it.chapter.date_upload it.history.last_read = it.chapter.date_fetch
} }
val nAdditions = if (viewType < VIEW_TYPE_ONLY_HISTORY) { val nAdditions = if (viewType < VIEW_TYPE_ONLY_HISTORY) {
db.getRecentlyAdded(startCal.time, calDay.time, query, isUngrouped && !limit).executeOnIO() db.getRecentlyAdded(startCal.time, calDay.time, query, isUngrouped && !limit).executeOnIO()