|
|
|
@ -75,7 +75,6 @@ open class Filter : RealmObject() { |
|
|
|
it.filterSectionRow == section |
|
|
|
it.filterSectionRow == section |
|
|
|
} |
|
|
|
} |
|
|
|
.apply { |
|
|
|
.apply { |
|
|
|
|
|
|
|
|
|
|
|
if (this.size == 1) { |
|
|
|
if (this.size == 1) { |
|
|
|
filterConditions.add(FilterCondition(this.first())) |
|
|
|
filterConditions.add(FilterCondition(this.first())) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -88,14 +87,14 @@ open class Filter : RealmObject() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun countBy(filterCategoryRow: FilterCategoryRow) : Int { |
|
|
|
fun countBy(filterCategoryRow: FilterCategoryRow): Int { |
|
|
|
val sections = filterCategoryRow.filterSectionRows |
|
|
|
val sections = filterCategoryRow.filterSectionRows |
|
|
|
return filterConditions.count { |
|
|
|
return filterConditions.count { |
|
|
|
sections.contains(FilterSectionRow.valueOf(it.sectionName ?: throw PokerAnalyticsException.FilterElementUnknownSectionName)) |
|
|
|
sections.contains(FilterSectionRow.valueOf(it.sectionName ?: throw PokerAnalyticsException.FilterElementUnknownSectionName)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun contains(filterElementRow:FilterElementRow) : Boolean { |
|
|
|
fun contains(filterElementRow: FilterElementRow): Boolean { |
|
|
|
val filtered = filterConditions.filter { |
|
|
|
val filtered = filterConditions.filter { |
|
|
|
it.filterName == filterElementRow.filterName |
|
|
|
it.filterName == filterElementRow.filterName |
|
|
|
} |
|
|
|
} |
|
|
|
@ -105,6 +104,18 @@ open class Filter : RealmObject() { |
|
|
|
return filterElementRow.contains(filtered) |
|
|
|
return filterElementRow.contains(filtered) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun getValueForElement(filterElementRow: FilterElementRow): Any? { |
|
|
|
|
|
|
|
val filtered = filterConditions.filter { |
|
|
|
|
|
|
|
it.filterName == filterElementRow.filterName |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (filtered.isNotEmpty()) { |
|
|
|
|
|
|
|
return filtered.first().getValue(filterElementRow) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inline fun <reified T : Filterable> results(): RealmResults<T> { |
|
|
|
inline fun <reified T : Filterable> results(): RealmResults<T> { |
|
|
|
var realmQuery = realm.where<T>() |
|
|
|
var realmQuery = realm.where<T>() |
|
|
|
this.filterConditions.map { |
|
|
|
this.filterConditions.map { |
|
|
|
|