chore: use slot wrapper only where necessary
This commit is contained in:
parent
a48d3432c2
commit
f8ceb65f0e
1 changed files with 5 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue