simpler rules
Some checks failed
Build and Publish / Metadata (push) Successful in 9s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m6s
Build and Publish / BuildAndDeployArm64 (push) Has been cancelled

This commit is contained in:
matst80
2025-10-18 15:21:11 +02:00
parent d58409e3fc
commit b7f0990269
4 changed files with 114 additions and 209 deletions

View File

@@ -92,10 +92,10 @@ type CartGrain struct {
}
type Voucher struct {
Code string `json:"code"`
Rules []*messages.VoucherRule `json:"rules"`
Id uint32 `json:"id"`
Value int64 `json:"value"`
Code string `json:"code"`
Rules []string `json:"rules"`
Id uint32 `json:"id"`
Value int64 `json:"value"`
}
func (v *Voucher) AppliesTo(cart *CartGrain) ([]*CartItem, bool) {
@@ -127,8 +127,8 @@ func (v *Voucher) AppliesTo(cart *CartGrain) ([]*CartItem, bool) {
}
// All voucher rules must pass (logical AND)
for _, rule := range v.Rules {
expr := rule.GetCondition()
for _, expr := range v.Rules {
if expr == "" {
// Empty condition treated as pass (acts like a comment / placeholder)
continue