Keep a stored track's remote entry when restoring
Restoring over an existing track took the backup's remote id and library id but kept the stored url and title, pairing one remote entry's id with another's details. The stored track now wins like the rest of an entry's stored data, and the backup only moves its last chapter read forward.
This commit is contained in:
@@ -257,17 +257,10 @@ class RestoreRepositoryImpl(
|
|||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (track.forComparison() == dbTrack.forComparison()) {
|
if (track.lastChapterRead <= dbTrack.lastChapterRead) return@mapNotNull null
|
||||||
// Same state; skip
|
|
||||||
return@mapNotNull null
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update to an existing track
|
// Update to an existing track
|
||||||
dbTrack.copy(
|
dbTrack.copy(lastChapterRead = track.lastChapterRead)
|
||||||
remoteId = track.remoteId,
|
|
||||||
libraryId = track.libraryId,
|
|
||||||
lastChapterRead = max(dbTrack.lastChapterRead, track.lastChapterRead),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
.partition { it.id > 0 }
|
.partition { it.id > 0 }
|
||||||
|
|
||||||
@@ -295,8 +288,6 @@ class RestoreRepositoryImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Track.forComparison() = this.copy(id = 0L, mangaId = 0L)
|
|
||||||
|
|
||||||
private suspend fun restoreExcludedScanlators(manga: Manga, excludedScanlators: List<String>) {
|
private suspend fun restoreExcludedScanlators(manga: Manga, excludedScanlators: List<String>) {
|
||||||
if (excludedScanlators.isEmpty()) return
|
if (excludedScanlators.isEmpty()) return
|
||||||
val existingExcludedScanlators = database.excluded_scanlatorsQueries
|
val existingExcludedScanlators = database.excluded_scanlatorsQueries
|
||||||
|
|||||||
Reference in New Issue
Block a user