update
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 35s
Build and Publish / BuildAndDeployArm64 (push) Successful in 3m45s

This commit is contained in:
matst80
2025-11-27 12:45:34 +01:00
parent c2a137d8d4
commit aea168160e
14 changed files with 335 additions and 335 deletions

View File

@@ -26,7 +26,7 @@ func (NoopTracer) Trace(string, map[string]any) {}
// for the purpose of promotion condition evaluation.
type PromotionItem struct {
SKU string
Quantity int
Quantity uint16
Category string
PriceIncVat int64
}
@@ -36,7 +36,7 @@ type PromotionItem struct {
// customer/order metadata.
type PromotionEvalContext struct {
CartTotalIncVat int64
TotalItemQuantity int
TotalItemQuantity uint32
Items []PromotionItem
CustomerSegment string
CustomerLifetimeValue float64
@@ -89,7 +89,7 @@ func NewContextFromCart(g *cart.CartGrain, opts ...ContextOption) *PromotionEval
Category: strings.ToLower(category),
PriceIncVat: it.Price.IncVat,
})
ctx.TotalItemQuantity += it.Quantity
ctx.TotalItemQuantity += uint32(it.Quantity)
}
for _, o := range opts {
o(ctx)

View File

@@ -58,7 +58,7 @@ func (t *testTracer) Count(name string) int {
func makeCart(totalOverride int64, items []struct {
sku string
category string
qty int
qty uint16
priceInc int64
}) *cart.CartGrain {
g := cart.NewCartGrain(1, time.Now())
@@ -92,7 +92,7 @@ func TestEvaluateRuleBasicAND(t *testing.T) {
g := makeCart(12000, []struct {
sku string
category string
qty int
qty uint16
priceInc int64
}{
{"SKU-1", "summer", 2, 3000},
@@ -226,7 +226,7 @@ func TestEvaluateProductCategoryIN(t *testing.T) {
g := makeCart(-1, []struct {
sku string
category string
qty int
qty uint16
priceInc int64
}{
{"A", "shoes", 1, 5000},
@@ -268,7 +268,7 @@ func TestEvaluateGroupOR(t *testing.T) {
g := makeCart(3000, []struct {
sku string
category string
qty int
qty uint16
priceInc int64
}{
{"ONE", "x", 1, 3000},