format
All checks were successful
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m3s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m30s

This commit is contained in:
matst80
2025-10-20 18:38:57 +02:00
parent e1de5a00a0
commit 246a5ebd85

View File

@@ -3,6 +3,7 @@ package promotions
import ( import (
"errors" "errors"
"fmt" "fmt"
"slices"
"strings" "strings"
"time" "time"
@@ -346,11 +347,9 @@ func evaluateBaseCondition(b BaseCondition, ctx *PromotionEvalContext) bool {
} }
func evalAnyItemMatch(pred func(PromotionItem) bool, b BaseCondition, ctx *PromotionEvalContext) bool { func evalAnyItemMatch(pred func(PromotionItem) bool, b BaseCondition, ctx *PromotionEvalContext) bool {
for _, it := range ctx.Items { if slices.ContainsFunc(ctx.Items, pred) {
if pred(it) {
return true return true
} }
}
switch normalizeOperator(string(b.Operator)) { switch normalizeOperator(string(b.Operator)) {
case string(OpNotIn), string(OpNotContains): case string(OpNotIn), string(OpNotContains):
return true return true
@@ -704,12 +703,7 @@ func normalizeLogicOperator(op string) string {
} }
func sliceFloatContains(list []float64, v float64) bool { func sliceFloatContains(list []float64, v float64) bool {
for _, x := range list { return slices.Contains(list, v)
if x == v {
return true
}
}
return false
} }
// ---------------------------- // ----------------------------