Skip to content

Commit

Permalink
Check statisfied condition should return false when value is undefined
Browse files Browse the repository at this point in the history
Fixes: AFORM-3738
  • Loading branch information
hungoptimizely committed Nov 29, 2023
1 parent 4d71207 commit a4d511e
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ export class FormDependConditions {
for (let i = 0; i < conditionProps.conditions.length; i++) {
const condition = conditionProps.conditions[i]
const fieldValue = formSubmissions.filter(s => equals(s.elementKey, condition.field))[0]?.value as string
if (!isNull(fieldValue)) {
const conditionFunction = ConditionFunctions[condition.operator];
if (!isNull(conditionFunction)){
var checkResult = conditionFunction(fieldValue, condition.fieldValue)
if (conditionProps.conditionCombination === ConditionCombinationType.Any && checkResult) {
return true
}
if (conditionProps.conditionCombination !== ConditionCombinationType.Any && !checkResult) {
return false
}
const conditionFunction = ConditionFunctions[condition.operator];
if (!isNull(conditionFunction)){
let checkResult = conditionFunction(fieldValue, condition.fieldValue)
if (conditionProps.conditionCombination === ConditionCombinationType.Any && checkResult) {
return true
}
if (conditionProps.conditionCombination !== ConditionCombinationType.Any && !checkResult) {
return false
}
}
}
Expand Down

0 comments on commit a4d511e

Please sign in to comment.