Skip to content

Commit

Permalink
Fix a bug with add_if and scientific notation
Browse files Browse the repository at this point in the history
  • Loading branch information
ronensc committed Mar 7, 2022
1 parent 83d22d7 commit 849941b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/pipeline/transform/transform_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ func (n *Network) Transform(inputEntry config.GenericMap) config.GenericMap {
outputEntries[rule.Output+"_Matched"] = true
}
case api.TransformNetworkOperationName("AddIf"):
expressionString := fmt.Sprintf("%v%s", outputEntries[rule.Input], rule.Parameters)
expressionString := fmt.Sprintf("val %s", rule.Parameters)
expression, err := govaluate.NewEvaluableExpression(expressionString)
if err != nil {
log.Errorf("Can't evaluate AddIf rule: %+v expression: %v. err %v", rule, expressionString, err)
continue
}
result, evaluateErr := expression.Evaluate(nil)
result, evaluateErr := expression.Evaluate(map[string]interface{}{"val": outputEntries[rule.Input]})
if evaluateErr == nil && result.(bool) {
outputEntries[rule.Output] = outputEntries[rule.Input]
outputEntries[rule.Output+"_Evaluate"] = true
Expand Down

0 comments on commit 849941b

Please sign in to comment.