From f8ceb65f0e58da923066b5a7f31c1da594ea6f2d Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 5 Oct 2025 08:14:05 +0200 Subject: [PATCH] chore: use slot wrapper only where necessary --- tariff/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tariff/config.go b/tariff/config.go index 57aae51eb..650573531 100644 --- a/tariff/config.go +++ b/tariff/config.go @@ -28,5 +28,10 @@ func NewFromConfig(ctx context.Context, typ string, other map[string]interface{} return nil, fmt.Errorf("cannot create tariff type '%s': %w", typ, err) } + // check slot length + if rr, err := v.Rates(); err == nil && len(rr) > 0 && rr[0].End.Sub(rr[0].Start) == SlotDuration { + return v, nil + } + return &SlotWrapper{Tariff: v}, nil }