Fixes for searching with a query in recents

This commit is contained in:
Jays2Kings 2021-04-07 17:48:37 -04:00
parent 6c4936ac3a
commit 9fbe223970

View File

@ -163,7 +163,7 @@ class RecentsPresenter(
).executeOnIO() ).executeOnIO()
} else emptyList() } else emptyList()
val rUpdates = when { val rUpdates = when {
viewType == VIEW_TYPE_ONLY_UPDATES -> db.getRecentChapters(startCal.time, calWeek.time).executeOnIO().map { viewType == VIEW_TYPE_ONLY_UPDATES -> db.getRecentChapters(startCal.time, calWeek.time, query).executeOnIO().map {
MangaChapterHistory(it.manga, it.chapter, HistoryImpl()) MangaChapterHistory(it.manga, it.chapter, HistoryImpl())
} }
viewType != VIEW_TYPE_ONLY_HISTORY -> db.getUpdatedManga(startCal.time, calWeek.time, query, isUngrouped && !limit).executeOnIO() viewType != VIEW_TYPE_ONLY_HISTORY -> db.getUpdatedManga(startCal.time, calWeek.time, query, isUngrouped && !limit).executeOnIO()
@ -184,8 +184,8 @@ class RecentsPresenter(
}.distinctBy { }.distinctBy {
if (query.isEmpty() && viewType != VIEW_TYPE_ONLY_HISTORY) it.manga.id else it.chapter.id if (query.isEmpty() && viewType != VIEW_TYPE_ONLY_HISTORY) it.manga.id else it.chapter.id
}.filter { mch -> }.filter { mch ->
if (page > 0) { if (page > 0 && query.isEmpty()) {
if (query.isEmpty() && viewType != VIEW_TYPE_ONLY_HISTORY) { if (viewType != VIEW_TYPE_ONLY_HISTORY) {
recentItems.none { mch.manga.id == it.mch.manga.id } recentItems.none { mch.manga.id == it.mch.manga.id }
} else { } else {
recentItems.none { mch.chapter.id == it.mch.chapter.id } recentItems.none { mch.chapter.id == it.mch.chapter.id }