mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Fix stats count not being accurate when filtering categories
only happens when manga are in multiple categories
This commit is contained in:
parent
0c94c8fa82
commit
4cd9c81b92
1 changed files with 4 additions and 4 deletions
|
@ -399,11 +399,11 @@ class StatsDetailsPresenter(
|
|||
* Filter the stat data according to the chips selected
|
||||
*/
|
||||
private fun List<LibraryManga>.filterByChip(): List<LibraryManga> {
|
||||
return this.filterBySeriesType(selectedStat == Stats.SERIES_TYPE)
|
||||
return this.filterByCategory(selectedStat == Stats.CATEGORY)
|
||||
.filterBySeriesType(selectedStat == Stats.SERIES_TYPE)
|
||||
.filterByStatus(selectedStat == Stats.STATUS)
|
||||
.filterByLanguage(selectedStat == Stats.LANGUAGE || (selectedStat != Stats.SOURCE && selectedSource.isNotEmpty()))
|
||||
.filterBySource(selectedStat in listOf(Stats.SOURCE, Stats.LANGUAGE) || selectedLanguage.isNotEmpty())
|
||||
.filterByCategory(selectedStat == Stats.CATEGORY)
|
||||
}
|
||||
|
||||
private fun List<LibraryManga>.filterBySeriesType(noFilter: Boolean = false): List<LibraryManga> {
|
||||
|
@ -450,9 +450,9 @@ class StatsDetailsPresenter(
|
|||
return if (noFilter || selectedCategory.isEmpty()) {
|
||||
this
|
||||
} else {
|
||||
filter { manga ->
|
||||
libraryMangas.filter { manga ->
|
||||
manga.category in selectedCategory.map { it.id }
|
||||
}
|
||||
}.distinct()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue