format
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
|
||||
Reference in New Issue
Block a user