From 1875c4a7522b18a233820759dc0d36375f0e587b Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 14 Apr 2021 08:57:00 -0400 Subject: [PATCH] Include chapter fetch date when migrating Based on https://github.com/Jays2Kings/tachiyomiJ2K/commit/ee4f3e6586910c8c4d62859c867c2a40e41eef67 Co-authored-by: Jays2Kings --- .../ui/browse/migration/search/SearchPresenter.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt index 9f15d2add..330ee1e04 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt @@ -105,19 +105,18 @@ class SearchPresenter( val maxChapterRead = prevMangaChapters .filter { it.read } .maxByOrNull { it.chapter_number }?.chapter_number - val bookmarkedChapters = prevMangaChapters - .filter { it.bookmark && it.isRecognizedNumber } - .map { it.chapter_number } if (maxChapterRead != null) { val dbChapters = db.getChapters(manga).executeAsBlocking() for (chapter in dbChapters) { if (chapter.isRecognizedNumber) { - if (chapter.chapter_number <= maxChapterRead) { + val prevChapter = prevMangaChapters + .find { it.isRecognizedNumber && it.chapter_number == chapter.chapter_number } + if (prevChapter != null) { + chapter.date_fetch = prevChapter.date_fetch + chapter.bookmark = prevChapter.bookmark + } else if (chapter.chapter_number <= maxChapterRead) { chapter.read = true } - if (chapter.chapter_number in bookmarkedChapters) { - chapter.bookmark = true - } } } db.insertChapters(dbChapters).executeAsBlocking()