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