mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 00:51:49 +01:00
Include bookmark state when migrating chapters (closes #2729)
This commit is contained in:
parent
c2330fe3af
commit
8a243ffb57
@ -84,14 +84,23 @@ class SearchPresenter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking()
|
val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking()
|
||||||
val maxChapterRead = prevMangaChapters.filter { it.read }
|
val maxChapterRead = prevMangaChapters
|
||||||
|
.filter { it.read }
|
||||||
.maxBy { it.chapter_number }?.chapter_number
|
.maxBy { it.chapter_number }?.chapter_number
|
||||||
|
val bookmarkedChapters = prevMangaChapters
|
||||||
|
.filter { it.bookmark && it.isRecognizedNumber }
|
||||||
|
.map { it.chapter_number }
|
||||||
if (maxChapterRead != null) {
|
if (maxChapterRead != null) {
|
||||||
val dbChapters = db.getChapters(manga).executeAsBlocking()
|
val dbChapters = db.getChapters(manga).executeAsBlocking()
|
||||||
for (chapter in dbChapters) {
|
for (chapter in dbChapters) {
|
||||||
if (chapter.isRecognizedNumber && chapter.chapter_number <= maxChapterRead) {
|
if (chapter.isRecognizedNumber) {
|
||||||
|
if (chapter.chapter_number <= maxChapterRead) {
|
||||||
chapter.read = true
|
chapter.read = true
|
||||||
}
|
}
|
||||||
|
if (chapter.chapter_number in bookmarkedChapters) {
|
||||||
|
chapter.bookmark = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
db.insertChapters(dbChapters).executeAsBlocking()
|
db.insertChapters(dbChapters).executeAsBlocking()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user