Fix duplicate chapters in some sources

Fixes #714
pull/7308/head
Jays2Kings 4 years ago
parent 3e7ad9dbd3
commit d3a1d8a8a9

@ -36,13 +36,15 @@ fun syncChaptersWithSource(
// Chapters from db.
val dbChapters = db.getChapters(manga).executeAsBlocking()
val sourceChapters = rawSourceChapters.mapIndexed { i, sChapter ->
Chapter.create().apply {
copyFrom(sChapter)
manga_id = manga.id
source_order = i
val sourceChapters = rawSourceChapters
.distinctBy { it.url }
.mapIndexed { i, sChapter ->
Chapter.create().apply {
copyFrom(sChapter)
manga_id = manga.id
source_order = i
}
}
}
// Chapters from the source not in db.
val toAdd = mutableListOf<Chapter>()

Loading…
Cancel
Save