From 66021cbe211a1e960635f2dfb28216bf01118c80 Mon Sep 17 00:00:00 2001 From: DanB Date: Tue, 20 Oct 2020 20:14:54 +0200 Subject: [PATCH] Small reorganisation inside rateprofile --- engine/rateprofile.go | 57 ++++++++++--------------------------------- rates/librates.go | 3 ++- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/engine/rateprofile.go b/engine/rateprofile.go index 2daeedadb..70a0d9932 100644 --- a/engine/rateprofile.go +++ b/engine/rateprofile.go @@ -82,6 +82,15 @@ func (rt *Rate) UID() string { return rt.uID } +type IntervalRate struct { + IntervalStart time.Duration // Starting point when the Rate kicks in + Unit time.Duration // RateUnit + Increment time.Duration // RateIncrement + Value float64 // RateValue + + val *utils.Decimal // cached version of the Decimal +} + func (rt *Rate) Compile() (err error) { aTime := rt.ActivationTimes if aTime == utils.EmptyString { @@ -96,39 +105,6 @@ func (rt *Rate) Compile() (err error) { // RunTimes returns the set of activation and deactivation times for this rate on the interval between >=sTime and