diff --git a/rater/storage_mysql.go b/rater/storage_mysql.go index 303a8d1ff..2cf62437e 100644 --- a/rater/storage_mysql.go +++ b/rater/storage_mysql.go @@ -155,15 +155,10 @@ func (mys *MySQLStorage) SetCdr(cdr CDR) (err error) { return } -func (mys *MySQLStorage) SetRatedCdr(cdr CDR, callcost *CallCost) (err error) { - rate, err := cdr.GetRate() - if err != nil { - fmt.Println("Could not find rate in cdr") - return err - } +func (mys *MySQLStorage) SetRatedCdr(cdr CDR, cc *CallCost) (err error) { _, err = mys.Db.Exec(fmt.Sprintf("INSERT INTO rated_cdrs VALUES ('%s', '%s', '%s', '%s')", cdr.GetCgrId(), - rate, + cc.Cost, "cgrcostid", "cdrsrc", )) diff --git a/rater/storage_postgres.go b/rater/storage_postgres.go index d4b303706..57b6d6028 100644 --- a/rater/storage_postgres.go +++ b/rater/storage_postgres.go @@ -155,14 +155,13 @@ func (psl *PostgresStorage) SetCdr(cdr CDR) (err error) { return } -func (psl *PostgresStorage) SetRatedCdr(cdr CDR, callcost *CallCost) (err error) { - rate, err := cdr.GetRate() +func (psl *PostgresStorage) SetRatedCdr(cdr CDR, cc *CallCost) (err error) { if err != nil { return err } _, err = psl.Db.Exec(fmt.Sprintf("INSERT INTO cdrs_extra VALUES ('%s', '%s', '%s', '%s')", cdr.GetCgrId(), - rate, + cc.Cost, "cgrcostid", "cdrsrc", ))