Merge pull request #957 from CepGamer/cepgamer/filterRefactor

Calculate values for filter categories from the list of values.
This commit is contained in:
MM2-0 2024-07-19 23:09:41 +02:00 committed by GitHub
commit 61a9e018d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,9 +17,11 @@ data class SearchFilters(
val events: Boolean = true, val events: Boolean = true,
val tools: Boolean = true, val tools: Boolean = true,
) { ) {
private val categories = listOf(apps, websites, articles, places, files, shortcuts, contacts, events, tools)
val allCategoriesEnabled val allCategoriesEnabled
get() = apps && websites && articles && places && files && shortcuts && contacts && events && tools get() = categories.all { it }
val enabledCategories: Int val enabledCategories: Int
get() = apps.toInt() + websites.toInt() + articles.toInt() + places.toInt() + files.toInt() + shortcuts.toInt() + contacts.toInt() + events.toInt() + tools.toInt() get() = categories.count { it }
} }