fix some mangadex manga not being marked as complete in status

This commit is contained in:
Jobobby04 2020-10-14 17:48:12 -04:00
parent 7f73094bb4
commit c789203ff8

View File

@ -156,8 +156,13 @@ class ApiMangaParser(private val langs: List<String>) {
}
}
}
val removeOneshots = filteredChapters.filter { !it.value.chapter.isNullOrBlank() }
return removeOneshots.size.toString() == finalChapterNumber.toDouble().floor().toString()
val removeOneshots = filteredChapters.asSequence()
.map { it.value.chapter!!.toDoubleOrNull() }
.filter { it != null }
.map { it!!.floor() }
.filter { it != 0 }
.toList().distinctBy { it }
return removeOneshots.toList().size == finalChapterNumber.toDouble().floor()
}
private fun filterChapterForChecking(serializer: ApiMangaSerializer): List<Map.Entry<String, ChapterSerializer>> {
@ -166,7 +171,7 @@ class ApiMangaParser(private val langs: List<String>) {
.filter { langs.contains(it.value.lang_code) }
.filter {
it.value.chapter?.let { chapterNumber ->
if (chapterNumber.toIntOrNull() == null) {
if (chapterNumber.toDoubleOrNull() == null) {
return@filter false
}
return@filter true