|
|
|
|
@ -86,7 +86,6 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
interface asListOfDouble { var doubleValues : ArrayList<Double> } |
|
|
|
|
interface asListOfBoolean { var booleanValues : ArrayList<Boolean> } |
|
|
|
|
interface asListOfString { var stringValues : ArrayList<String> } |
|
|
|
|
interface asDateValue { |
|
|
|
|
var dateValue: Date |
|
|
|
|
@ -147,7 +146,7 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
return when (this) { |
|
|
|
|
is StaticDataQueryCondition -> label() |
|
|
|
|
is QueryDataCondition<*> -> label() |
|
|
|
|
is BLIND -> this.blind!! |
|
|
|
|
is BLIND -> label() |
|
|
|
|
else -> baseId |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -248,11 +247,19 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class BLIND: QueryCondition(), asListOfString, asListOfBoolean { |
|
|
|
|
var blind: String? = null |
|
|
|
|
var hasDefaultCurrency: Boolean = false |
|
|
|
|
override var booleanValues = ArrayList<Boolean>() |
|
|
|
|
class BLIND: QueryCondition(), asListOfString { |
|
|
|
|
override var stringValues = ArrayList<String>() |
|
|
|
|
|
|
|
|
|
fun label(): String { |
|
|
|
|
val completeLabel = when (stringValues.size) { |
|
|
|
|
0 -> return NULL_TEXT |
|
|
|
|
1,2 -> { |
|
|
|
|
return stringValues.map { it }.joinToString(", ") |
|
|
|
|
} |
|
|
|
|
else -> "${stringValues.size} $baseId" |
|
|
|
|
} |
|
|
|
|
return completeLabel |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class LAST_GAMES: SingleValueQueryCondition() |
|
|
|
|
@ -355,31 +362,9 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
} |
|
|
|
|
realmQuery |
|
|
|
|
} |
|
|
|
|
is BLIND -> { |
|
|
|
|
val blinds: Array<String> = stringValues.toTypedArray() |
|
|
|
|
val hasDefaultCurrency: Array<Boolean> = booleanValues.toTypedArray() |
|
|
|
|
//realmQuery.`in`(fieldName, blinds) |
|
|
|
|
blinds.forEachIndexed { index, s -> |
|
|
|
|
val isUsingDefaultCurrency = hasDefaultCurrency[index] |
|
|
|
|
realmQuery.beginGroup() |
|
|
|
|
if (isUsingDefaultCurrency) { |
|
|
|
|
realmQuery.endsWith(fieldName, s) |
|
|
|
|
.and() |
|
|
|
|
.isNull("bankroll.currency.code") |
|
|
|
|
} else { |
|
|
|
|
realmQuery.equalTo(fieldName, s) |
|
|
|
|
} |
|
|
|
|
.endGroup() |
|
|
|
|
if (index < blinds.size - 1) { |
|
|
|
|
realmQuery.or() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
realmQuery |
|
|
|
|
} |
|
|
|
|
is BLIND -> realmQuery.`in`(fieldName, stringValues.toTypedArray()) |
|
|
|
|
is QueryDataCondition<*> -> realmQuery.`in`(fieldName, stringValues.toTypedArray()) |
|
|
|
|
is StaticDataQueryCondition -> { |
|
|
|
|
realmQuery.`in`(fieldName, intValues.toTypedArray()) |
|
|
|
|
} |
|
|
|
|
is StaticDataQueryCondition -> realmQuery.`in`(fieldName, intValues.toTypedArray()) |
|
|
|
|
is DateQuery -> { |
|
|
|
|
if (this is Less) { |
|
|
|
|
realmQuery.lessThanOrEqualTo(fieldName, dateValue) |
|
|
|
|
@ -444,10 +429,7 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
is asListOfDouble -> filterCondition.doubleValues.map { doubleValues.add(it) } |
|
|
|
|
is QueryDataCondition<*> -> filterCondition.ids.map { stringValues.add(it) } |
|
|
|
|
is DateQuery -> dateValue = filterCondition.date |
|
|
|
|
is BLIND -> { |
|
|
|
|
filterCondition.blinds.map { stringValues.add(it) } |
|
|
|
|
filterCondition.hasDefaultCurrency.map { booleanValues.add(it) } |
|
|
|
|
} |
|
|
|
|
is BLIND -> filterCondition.blinds.map { stringValues.add(it) } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|