mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-13 15:54:35 -05:00
Fix chapter duplicates if its a different url but same chapter list size (#759)
This commit is contained in:
@@ -45,7 +45,6 @@ import suwayomi.tachidesk.manga.model.table.MangaTable
|
||||
import suwayomi.tachidesk.manga.model.table.PageTable
|
||||
import suwayomi.tachidesk.manga.model.table.toDataClass
|
||||
import suwayomi.tachidesk.server.serverConfig
|
||||
import java.lang.Long
|
||||
import java.time.Instant
|
||||
import java.util.TreeSet
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -202,11 +201,9 @@ object Chapter {
|
||||
val deletedReadChapterNumbers = TreeSet<Float>()
|
||||
val deletedBookmarkedChapterNumbers = TreeSet<Float>()
|
||||
val deletedDownloadedChapterNumbers = TreeSet<Float>()
|
||||
val deletedChapterNumberDateFetchMap = mutableMapOf<Float, kotlin.Long>()
|
||||
val deletedChapterNumberDateFetchMap = mutableMapOf<Float, Long>()
|
||||
|
||||
// clear any orphaned/duplicate chapters that are in the db but not in `chapterList`
|
||||
val dbChapterCount = chaptersInDb.count()
|
||||
if (dbChapterCount > chapterList.size) { // we got some clean up due
|
||||
val chapterUrls = chapterList.map { it.url }.toSet()
|
||||
|
||||
val chaptersIdsToDelete =
|
||||
@@ -223,6 +220,8 @@ object Chapter {
|
||||
}
|
||||
}
|
||||
|
||||
// we got some clean up due
|
||||
if (chaptersIdsToDelete.isNotEmpty()) {
|
||||
transaction {
|
||||
PageTable.deleteWhere { PageTable.chapter inList chaptersIdsToDelete }
|
||||
ChapterTable.deleteWhere { ChapterTable.id inList chaptersIdsToDelete }
|
||||
|
||||
Reference in New Issue
Block a user