added holiday rating plan test

This commit is contained in:
Radu Ioan Fericean
2015-05-19 13:59:04 +03:00
parent 3043065267
commit da7e2580b7
3 changed files with 37 additions and 2 deletions

View File

@@ -327,6 +327,9 @@ func (i *RateInterval) GetCost(duration, startSecond time.Duration) float64 {
// Gets the price for a the provided start second
func (i *RateInterval) GetRateParameters(startSecond time.Duration) (rate float64, rateIncrement, rateUnit time.Duration) {
if i.Rating == nil {
return -1, -1, -1
}
i.Rating.Rates.Sort()
for index, price := range i.Rating.Rates {
if price.GroupIntervalStart <= startSecond && (index == len(i.Rating.Rates)-1 ||