mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Usage and Pdd fields should not be rounded to .0 decimals
This commit is contained in:
@@ -247,4 +247,4 @@
|
||||
//},
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -165,11 +165,11 @@ func (storedCdr *StoredCdr) FieldAsString(rsrFld *utils.RSRField) string {
|
||||
case utils.SETUP_TIME:
|
||||
return rsrFld.ParseValue(storedCdr.SetupTime.Format(time.RFC3339))
|
||||
case utils.PDD:
|
||||
return strconv.FormatFloat(utils.Round(storedCdr.Pdd.Seconds(), 0, utils.ROUNDING_MIDDLE), 'f', -1, 64)
|
||||
return strconv.FormatFloat(storedCdr.Pdd.Seconds(), 'f', -1, 64)
|
||||
case utils.ANSWER_TIME:
|
||||
return rsrFld.ParseValue(storedCdr.AnswerTime.Format(time.RFC3339))
|
||||
case utils.USAGE:
|
||||
return strconv.FormatFloat(utils.Round(storedCdr.Usage.Seconds(), 0, utils.ROUNDING_MIDDLE), 'f', -1, 64)
|
||||
return strconv.FormatFloat(storedCdr.Usage.Seconds(), 'f', -1, 64)
|
||||
case utils.SUPPLIER:
|
||||
return rsrFld.ParseValue(storedCdr.Supplier)
|
||||
case utils.DISCONNECT_CAUSE:
|
||||
|
||||
@@ -350,7 +350,7 @@ func TestStoredCdrForkCdr(t *testing.T) {
|
||||
storCdr := StoredCdr{CgrId: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()), OrderId: 123, TOR: utils.VOICE,
|
||||
AccId: "dsafdsaf", CdrHost: "192.168.1.1", CdrSource: utils.UNIT_TEST, ReqType: utils.META_RATED, Direction: "*out",
|
||||
Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1002",
|
||||
SetupTime: time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC), AnswerTime: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC), MediationRunId: utils.DEFAULT_RUNID,
|
||||
SetupTime: time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC), Pdd: time.Duration(200) * time.Millisecond, AnswerTime: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC), MediationRunId: utils.DEFAULT_RUNID,
|
||||
Usage: time.Duration(10) * time.Second, Supplier: "suppl1", ExtraFields: map[string]string{"field_extr1": "val_extr1", "field_extr2": "valextr2"},
|
||||
Cost: 1.01, RatedSubject: "dans"}
|
||||
rtSampleCdrOut, err := storCdr.ForkCdr("sample_run1", &utils.RSRField{Id: utils.REQTYPE}, &utils.RSRField{Id: utils.DIRECTION}, &utils.RSRField{Id: utils.TENANT},
|
||||
@@ -363,7 +363,7 @@ func TestStoredCdrForkCdr(t *testing.T) {
|
||||
}
|
||||
expctSplRatedCdr := &StoredCdr{CgrId: storCdr.CgrId, TOR: utils.VOICE, AccId: "dsafdsaf", CdrHost: "192.168.1.1", CdrSource: utils.UNIT_TEST, ReqType: utils.META_RATED,
|
||||
Direction: "*out", Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1002",
|
||||
SetupTime: time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC), AnswerTime: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
|
||||
SetupTime: time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC), Pdd: time.Duration(200) * time.Millisecond, AnswerTime: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
|
||||
Usage: time.Duration(10) * time.Second, Supplier: "suppl1", ExtraFields: map[string]string{"field_extr1": "val_extr1", "field_extr2": "valextr2"},
|
||||
MediationRunId: "sample_run1", Cost: -1}
|
||||
if !reflect.DeepEqual(expctSplRatedCdr, rtSampleCdrOut) {
|
||||
|
||||
Reference in New Issue
Block a user