chore (MangaRestorer): use getChapterByUrlAndMangaId directly instead of getChapterByUrl then find

This commit is contained in:
Cuong-Tran 2025-02-11 13:52:36 +07:00
parent f2bf5d8664
commit 58dc3b3e79

View file

@ -397,8 +397,10 @@ class MangaRestorer(
val item = history.getHistoryImpl()
if (dbHistory == null) {
val chapter = handler.awaitList { chaptersQueries.getChapterByUrl(history.url) }
.find { it.manga_id == manga.id }
// KMK -->
val chapter = handler.awaitList { chaptersQueries.getChapterByUrlAndMangaId(history.url, manga.id) }
.firstOrNull()
// KMK <--
return@mapNotNull if (chapter == null) {
// Chapter doesn't exist; skip
null