Fix manga migration

This commit is contained in:
Koitharu
2024-03-15 08:09:51 +02:00
parent 2e81684652
commit 569edd91c9

View File

@@ -91,7 +91,7 @@ class MigrateUseCase @Inject constructor(
val oldChapters = checkNotNull(oldManga.getChapters(branch))
var index = oldChapters.indexOfFirst { it.id == history.chapterId }
if (index < 0) {
index = (oldChapters.size * history.percent).toInt()
index = (oldChapters.lastIndex * history.percent).toInt()
}
val newChapters = checkNotNull(newManga.chapters).groupBy { it.branch }
val newBranch = if (newChapters.containsKey(branch)) {