Compare commits
1 Commits
959ccdca35
...
v1.0.60
| Author | SHA1 | Date | |
|---|---|---|---|
| dd49c5f9a0 |
@@ -1,9 +1,25 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (c DBClientProcessed) MarshalJSON() ([]byte, error) {
|
||||
type alias DBClientProcessed // avoid recursion
|
||||
sanitize := func(f float64) float64 {
|
||||
if math.IsNaN(f) || math.IsInf(f, 0) {
|
||||
return 0
|
||||
}
|
||||
return f
|
||||
}
|
||||
a := alias(c)
|
||||
a.ClientRate = sanitize(a.ClientRate)
|
||||
a.PartnerRate = sanitize(a.PartnerRate)
|
||||
return json.Marshal(a)
|
||||
}
|
||||
|
||||
type DBClientProcessed struct {
|
||||
|
||||
// CALL DETAILS
|
||||
@@ -69,6 +85,19 @@ func (DBClientProcessed) TableName() string {
|
||||
return "gc_client_processed"
|
||||
}
|
||||
|
||||
func (i DBInterpreterProcessed) MarshalJSON() ([]byte, error) {
|
||||
type alias DBInterpreterProcessed // avoid recursion
|
||||
sanitize := func(f float64) float64 {
|
||||
if math.IsNaN(f) || math.IsInf(f, 0) {
|
||||
return 0
|
||||
}
|
||||
return f
|
||||
}
|
||||
a := alias(i)
|
||||
a.InterpreterRate = sanitize(a.InterpreterRate)
|
||||
return json.Marshal(a)
|
||||
}
|
||||
|
||||
type DBInterpreterProcessed struct {
|
||||
|
||||
// CALL DETAILS
|
||||
|
||||
Reference in New Issue
Block a user