mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 14:19:54 +05:00
fix for bad timespan
This commit is contained in:
@@ -236,6 +236,7 @@ func (cd *CallDescriptor) splitInTimeSpans(firstSpan *TimeSpan) (timespans []*Ti
|
||||
if newTs != nil {
|
||||
newTs.ratingPlan = rp
|
||||
timespans = append(timespans, newTs)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ func (ts *TimeSpan) SplitByRateInterval(i *RateInterval) (nts *TimeSpan) {
|
||||
i.Rates.Sort()
|
||||
for _, rate := range i.Rates {
|
||||
Logger.Debug(fmt.Sprintf("Rate: %+v", rate))
|
||||
if ts.GetGroupStart() < rate.GroupIntervalStart && ts.GetGroupEnd() >= rate.GroupIntervalStart {
|
||||
if ts.GetGroupStart() < rate.GroupIntervalStart && ts.GetGroupEnd() > rate.GroupIntervalStart {
|
||||
Logger.Debug(fmt.Sprintf("Splitting"))
|
||||
ts.SetRateInterval(i)
|
||||
splitTime := ts.TimeStart.Add(rate.GroupIntervalStart - ts.GetGroupStart())
|
||||
|
||||
@@ -188,6 +188,7 @@ func (ub *UserBalance) debitCreditBalance(cc *CallCost, count bool) error {
|
||||
}
|
||||
paid := false
|
||||
for _, b := range usefulMinuteBalances {
|
||||
|
||||
// check standard subject tags
|
||||
if b.RateSubject == ZEROSECOND || b.RateSubject == "" {
|
||||
amount := increment.Duration.Seconds()
|
||||
@@ -201,6 +202,7 @@ func (ub *UserBalance) debitCreditBalance(cc *CallCost, count bool) error {
|
||||
}
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
if b.RateSubject == ZEROMINUTE {
|
||||
amount := time.Minute.Seconds()
|
||||
@@ -256,6 +258,7 @@ func (ub *UserBalance) debitCreditBalance(cc *CallCost, count bool) error {
|
||||
}
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
// get the new rate
|
||||
cd := cc.CreateCallDescriptor()
|
||||
|
||||
Reference in New Issue
Block a user