Prioritize finding selected chapter when deduping reader chapters

Fixes #9054
This commit is contained in:
arkon 2023-02-08 21:35:59 -05:00
parent 34a586ce48
commit 23432e4405

View File

@ -177,10 +177,11 @@ class ReaderViewModel(
}.run {
if (readerPreferences.skipDupe().get()) {
groupBy { it.chapterNumber }
.mapValues { (_, chapters) ->
chapters.find { it.id == chapterId || it.scanlator == selectedChapter.scanlator } ?: chapters.first()
.map { (_, chapters) ->
chapters.find { it.id == selectedChapter.id }
?: chapters.find { it.scanlator == selectedChapter.scanlator }
?: chapters.first()
}
.values
} else {
this
}