Skip to content

Commit

Permalink
Revert "Fix : In array condition is failing when attribute value is n…
Browse files Browse the repository at this point in the history
…ull" (#55)
  • Loading branch information
Tan108 authored Dec 23, 2024
1 parent 8533469 commit 47e3139
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/kotlin/com/featurevisor/sdk/Conditions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,18 @@ object Conditions {
}
}

attributeValue is AttributeValue.IntValue && conditionValue is ConditionValue.ArrayValue -> {
attributeValue is AttributeValue.StringValue && conditionValue is ConditionValue.ArrayValue -> {
when (operator) {
IN_ARRAY -> attributeValue.value.toString() in conditionValue.values
NOT_IN_ARRAY -> (attributeValue.value.toString() !in conditionValue.values)
IN_ARRAY -> attributeValue.value in conditionValue.values
NOT_IN_ARRAY -> (attributeValue.value !in conditionValue.values)
else -> false
}
}

conditionValue is ConditionValue.ArrayValue -> {
val valueInContext = (context[attributeKey] as? AttributeValue.StringValue)?.value
attributeValue is AttributeValue.IntValue && conditionValue is ConditionValue.ArrayValue -> {
when (operator) {
IN_ARRAY -> valueInContext in conditionValue.values
NOT_IN_ARRAY -> valueInContext !in conditionValue.values
IN_ARRAY -> attributeValue.value.toString() in conditionValue.values
NOT_IN_ARRAY -> (attributeValue.value.toString() !in conditionValue.values)
else -> false
}
}
Expand Down

0 comments on commit 47e3139

Please sign in to comment.