Move empty-chapterlist manga to end of Latest Chapter sort in Library view

This commit is contained in:
FlaminSarge 2020-02-16 07:17:43 -07:00
parent 50ef4cc5da
commit 247a39c0a9
2 changed files with 6 additions and 4 deletions

View File

@ -93,7 +93,7 @@ fun getLastReadMangaQuery() = """
ORDER BY max DESC ORDER BY max DESC
""" """
fun getTotalChapterMangaQuery()= """ fun getTotalChapterMangaQuery() = """
SELECT ${Manga.TABLE}.* SELECT ${Manga.TABLE}.*
FROM ${Manga.TABLE} FROM ${Manga.TABLE}
JOIN ${Chapter.TABLE} JOIN ${Chapter.TABLE}
@ -102,7 +102,7 @@ fun getTotalChapterMangaQuery()= """
ORDER by COUNT(*) ORDER by COUNT(*)
""" """
fun getLatestChapterMangaQuery()= """ fun getLatestChapterMangaQuery() = """
SELECT ${Manga.TABLE}.*, MAX(${Chapter.TABLE}.${Chapter.COL_DATE_UPLOAD}) AS max SELECT ${Manga.TABLE}.*, MAX(${Chapter.TABLE}.${Chapter.COL_DATE_UPLOAD}) AS max
FROM ${Manga.TABLE} FROM ${Manga.TABLE}
JOIN ${Chapter.TABLE} JOIN ${Chapter.TABLE}

View File

@ -207,8 +207,10 @@ class LibraryPresenter(
manga1TotalChapter.compareTo(mange2TotalChapter) manga1TotalChapter.compareTo(mange2TotalChapter)
} }
LibrarySort.LATEST_CHAPTER -> { LibrarySort.LATEST_CHAPTER -> {
val manga1latestChapter = latestChapterManga[i1.manga.id!!] ?: 0 val manga1latestChapter = latestChapterManga[i1.manga.id!!]
val manga2latestChapter = latestChapterManga[i2.manga.id!!] ?: 0 ?: latestChapterManga.size
val manga2latestChapter = latestChapterManga[i2.manga.id!!]
?: latestChapterManga.size
manga1latestChapter.compareTo(manga2latestChapter) manga1latestChapter.compareTo(manga2latestChapter)
} }
else -> throw Exception("Unknown sorting mode") else -> throw Exception("Unknown sorting mode")