all the refactor
Build and Publish / BuildAndDeployAmd64 (push) Failing after 5s
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s

This commit is contained in:
2026-06-28 17:51:52 +02:00
parent 7db0d236c7
commit aa8b2bdedc
84 changed files with 4328 additions and 2344 deletions
+7 -4
View File
@@ -7,6 +7,8 @@ import (
"strconv"
"strings"
"unicode"
"git.k6n.net/mats/platform/money"
)
/*
@@ -74,7 +76,7 @@ const (
type ruleCondition struct {
Kind RuleKind
StringVals []string // For sku / category multi-value list
MinValue *int64 // For numeric threshold rules
MinValue *money.Cents // For numeric threshold rules (minor units)
// Operator reserved for future (e.g., >, >=, ==). Currently always ">=" for numeric kinds.
Operator string
}
@@ -90,13 +92,13 @@ type RuleSet struct {
type Item struct {
Sku string
Category string
UnitPrice int64 // Inc VAT (single unit)
UnitPrice money.Cents // Inc VAT (single unit)
}
// EvalContext bundles cart-like data necessary for evaluation.
type EvalContext struct {
Items []Item
CartTotalInc int64
CartTotalInc money.Cents
}
// Applies returns true if all rule conditions pass for the context.
@@ -268,9 +270,10 @@ func parseNumericRule(frag string) (ruleCondition, error) {
return ruleCondition{}, fmt.Errorf("negative threshold %d", value)
}
mv := money.Cents(value)
return ruleCondition{
Kind: kind,
MinValue: &value,
MinValue: &mv,
Operator: ">=",
}, nil
}