From 246a5ebd85cc4e45e3f20b3698b5fbada7e8fa56 Mon Sep 17 00:00:00 2001 From: matst80 Date: Mon, 20 Oct 2025 18:38:57 +0200 Subject: [PATCH] format --- pkg/promotions/eval.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/pkg/promotions/eval.go b/pkg/promotions/eval.go index c30addc..aebb66a 100644 --- a/pkg/promotions/eval.go +++ b/pkg/promotions/eval.go @@ -3,6 +3,7 @@ package promotions import ( "errors" "fmt" + "slices" "strings" "time" @@ -346,10 +347,8 @@ 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) { - return true - } + if slices.ContainsFunc(ctx.Items, pred) { + return true } switch normalizeOperator(string(b.Operator)) { case string(OpNotIn), string(OpNotContains): @@ -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) } // ----------------------------