remove promotions for now
This commit is contained in:
@@ -82,7 +82,7 @@ func main() {
|
|||||||
|
|
||||||
inventoryPubSub := actor.NewPubSub[inventory.InventoryChange]()
|
inventoryPubSub := actor.NewPubSub[inventory.InventoryChange]()
|
||||||
|
|
||||||
promotionService := promotions.NewPromotionService(nil)
|
// promotionService := promotions.NewPromotionService(nil)
|
||||||
|
|
||||||
reg := cart.NewCartMultationRegistry()
|
reg := cart.NewCartMultationRegistry()
|
||||||
reg.RegisterProcessor(
|
reg.RegisterProcessor(
|
||||||
@@ -91,12 +91,14 @@ func main() {
|
|||||||
defer span.End()
|
defer span.End()
|
||||||
g.UpdateTotals()
|
g.UpdateTotals()
|
||||||
|
|
||||||
promotionCtx := promotions.NewContextFromCart(g, promotions.WithNow(time.Now()), promotions.WithCustomerSegment("vip"))
|
// promotionCtx := promotions.NewContextFromCart(g, promotions.WithNow(time.Now()), promotions.WithCustomerSegment("vip"))
|
||||||
_, actions := promotionService.EvaluateAll(promotionData.State.Promotions, promotionCtx)
|
// _, actions := promotionService.EvaluateAll(promotionData.State.Promotions, promotionCtx)
|
||||||
for _, action := range actions {
|
// for _, action := range actions {
|
||||||
log.Printf("apply: %+v", action)
|
|
||||||
g.UpdateTotals()
|
// log.Printf("apply: %+v", action)
|
||||||
}
|
|
||||||
|
// g.UpdateTotals()
|
||||||
|
// }
|
||||||
return nil
|
return nil
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package actor
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"iter"
|
"iter"
|
||||||
"log"
|
|
||||||
"slices"
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@@ -28,7 +27,7 @@ func (p *PubSub[V]) Subscribe(receiver ReceiverFunc[V]) {
|
|||||||
}
|
}
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
log.Printf("adding subscriber")
|
// log.Printf("adding subscriber")
|
||||||
p.subscribers = append(p.subscribers, &receiver)
|
p.subscribers = append(p.subscribers, &receiver)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ func (p *PubSub[V]) Unsubscribe(receiver ReceiverFunc[V]) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if sub == prt {
|
if sub == prt {
|
||||||
log.Printf("removing subscriber")
|
// log.Printf("removing subscriber")
|
||||||
p.subscribers = append(list[:i], list[i+1:]...)
|
p.subscribers = append(list[:i], list[i+1:]...)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user