Added Tenant to resources

This commit is contained in:
edwardro22
2017-09-13 09:08:09 +00:00
parent c5a1464d6b
commit d01f8b58dc
12 changed files with 52 additions and 34 deletions

View File

@@ -588,7 +588,7 @@ func (self *SQLStorage) SetTPStats(sts []*utils.TPStats) error {
tx := self.db.Begin()
for _, stq := range sts {
// Remove previous
if err := tx.Where(&TpStats{Tpid: stq.TPid,Tenant: stq.Tenant,Tag: stq.ID}).Delete(TpStats{}).Error; err != nil {
if err := tx.Where(&TpStats{Tpid: stq.TPid,Tag: stq.ID}).Delete(TpStats{}).Error; err != nil {
tx.Rollback()
return err
}
@@ -1171,8 +1171,6 @@ func (self *SQLStorage) GetTPDestinationRates(tpid, id string, pagination *utils
func (self *SQLStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, error) {
var tpTimings TpTimings
q := self.db.Where("tpid = ?", tpid)
utils.Logger.Debug(fmt.Sprintf("#1 Id care trimite %s", id))
utils.Logger.Debug(fmt.Sprintf("#1 TPId care trimite %s", tpid))
if len(id) != 0 {
q = q.Where("tag = ?", id)
}
@@ -1180,7 +1178,6 @@ func (self *SQLStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, e
return nil, err
}
ts := tpTimings.AsTPTimings()
utils.Logger.Debug(fmt.Sprintf("#2 ce gaseste : %s", ts))
if len(ts) == 0 {
return ts, utils.ErrNotFound
}