testing promotion actions
All checks were successful
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m16s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m19s

This commit is contained in:
matst80
2025-10-20 20:58:34 +02:00
parent 246a5ebd85
commit 9ecd91c163
3 changed files with 57 additions and 17 deletions

View File

@@ -380,7 +380,7 @@ func WalkConditions(conds []Condition, fn func(c Condition) bool) {
}
type PromotionState struct {
Vouchers []PromotionRule `json:"promotions"`
Promotions []PromotionRule `json:"promotions"`
}
type StateFile struct {
@@ -389,7 +389,7 @@ type StateFile struct {
}
func (sf *StateFile) GetPromotion(id string) (*PromotionRule, bool) {
for _, v := range sf.State.Vouchers {
for _, v := range sf.State.Promotions {
if v.ID == id {
return &v, true
}
@@ -397,14 +397,14 @@ func (sf *StateFile) GetPromotion(id string) (*PromotionRule, bool) {
return nil, false
}
func LoadStateFile(fileName string) (*PromotionState, error) {
func LoadStateFile(fileName string) (*StateFile, error) {
f, err := os.Open(fileName)
if err != nil {
return nil, err
}
defer f.Close()
dec := json.NewDecoder(f)
sf := &PromotionState{}
sf := &StateFile{}
err = dec.Decode(sf)
if err != nil {
return nil, err