Replace if else with shared variable

This commit is contained in:
TeoV
2020-08-21 10:28:52 +03:00
committed by Dan Christian Bogos
parent cf0656fd12
commit c726b1f5cc

View File

@@ -339,6 +339,7 @@ func (tpr *TpReader) LoadRatingProfilesFiltered(qriedRpf *utils.TPRatingProfile)
return err
}
for _, tpRpf := range rpfs {
resultRatingProfile = &RatingProfile{Id: tpRpf.KeyId()}
if tpr.dm.dataDB != nil { // check if we have a connection with dataDB and check if RatingProfile exists
if resultRatingProfile, err = tpr.dm.GetRatingProfile(tpRpf.KeyId(), false, utils.NonTransactional); err != nil {
if err == utils.ErrNotFound {
@@ -348,8 +349,6 @@ func (tpr *TpReader) LoadRatingProfilesFiltered(qriedRpf *utils.TPRatingProfile)
return err
}
}
} else {
resultRatingProfile = &RatingProfile{Id: tpRpf.KeyId()}
}
for _, tpRa := range tpRpf.RatingPlanActivations {