Compare commits

...

2 Commits

2 changed files with 31 additions and 2 deletions

View File

@@ -17,8 +17,8 @@ import "time"
// Indexes: Id, ConversationId, RequestedAt // Indexes: Id, ConversationId, RequestedAt
type DBAmendment struct { type DBAmendment struct {
Id int `gorm:"primaryKey;autoIncrement"` Id int `gorm:"primaryKey;autoIncrement"`
ConversationId string `gorm:"index"` ConversationId string `gorm:"uniqueIndex:idx_amendment_conv_column"`
AmendmentColumn string AmendmentColumn string `gorm:"uniqueIndex:idx_amendment_conv_column"`
AmendmentValue string AmendmentValue string
Requestor string Requestor string
RequestedAt time.Time `gorm:"index"` RequestedAt time.Time `gorm:"index"`

View File

@@ -1,9 +1,25 @@
package models package models
import ( import (
"encoding/json"
"math"
"time" "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 { type DBClientProcessed struct {
// CALL DETAILS // CALL DETAILS
@@ -69,6 +85,19 @@ func (DBClientProcessed) TableName() string {
return "gc_client_processed" 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 { type DBInterpreterProcessed struct {
// CALL DETAILS // CALL DETAILS