mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 20:19:05 +01:00
fix: skip duplicate chapters on download ahead if option to skip duplicates is enabled (#9334)
* fix: skip duplicate chapters on download ahead if option is enabled * fix: Use a function to filter duplicates
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package eu.kanade.tachiyomi.util.chapter
|
||||
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
|
||||
/**
|
||||
* Returns a copy of the list with duplicate chapters removed
|
||||
*/
|
||||
fun List<Chapter>.removeDuplicates(currentChapter: Chapter): List<Chapter> {
|
||||
return groupBy { it.chapterNumber }
|
||||
.map { (_, chapters) ->
|
||||
chapters.find { it.id == currentChapter.id }
|
||||
?: chapters.find { it.scanlator == currentChapter.scanlator }
|
||||
?: chapters.first()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user