Skip to content

Commit

Permalink
attempt to match optionId to value in case where optionId is not a uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
divporter committed Aug 17, 2024
1 parent 6dd343a commit aeccffc
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ export default function evaluateConditionalOptionsPredicate({
}): boolean {
return predicate.optionIds.some((optionId) => {
const option = predicateElement.options?.find((o) => o.id === optionId)
if (option) {
const optionValue = option?.value ?? optionId
if (optionValue) {
if (Array.isArray(value)) {
return value.some((modelValue) => {
return modelValue === option.value
return modelValue === optionValue
})
} else if (predicateElement.type === 'compliance' && value) {
return option.value === (value as { value: unknown }).value
return optionValue === (value as { value: unknown }).value
} else {
return option.value === value
return optionValue === value
}
} else {
return false
Expand Down

0 comments on commit aeccffc

Please sign in to comment.