mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 12:49:18 +01:00
Include chapter fetch date when migrating
Based on ee4f3e6586
Co-authored-by: Jays2Kings <Jays2Kings@users.noreply.github.com>
This commit is contained in:
parent
5f0493f1e5
commit
1875c4a752
@ -105,19 +105,18 @@ class SearchPresenter(
|
|||||||
val maxChapterRead = prevMangaChapters
|
val maxChapterRead = prevMangaChapters
|
||||||
.filter { it.read }
|
.filter { it.read }
|
||||||
.maxByOrNull { it.chapter_number }?.chapter_number
|
.maxByOrNull { 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) {
|
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
|
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