Tariff: support >48 slots
This commit is contained in:
parent
76650945c1
commit
fc377138d1
1 changed files with 3 additions and 2 deletions
|
|
@ -123,16 +123,17 @@ func (t *Tariff) priceRates() (api.Rates, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
res := make(api.Rates, 48)
|
||||
res := make(api.Rates, 0, 48)
|
||||
start := now.BeginningOfHour()
|
||||
|
||||
for i := 0; i < len(res); i++ {
|
||||
slot := start.Add(time.Duration(i) * time.Hour)
|
||||
res[i] = api.Rate{
|
||||
rate := api.Rate{
|
||||
Start: slot,
|
||||
End: slot.Add(time.Hour),
|
||||
Price: t.totalPrice(price),
|
||||
}
|
||||
res = append(res, rate)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue