Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fe9fe0c3e | |||
| 1da72360c2 | |||
| dd49c5f9a0 |
@@ -37,6 +37,7 @@ type CrmInterpreter struct {
|
|||||||
PinViaSMS *bool `gorm:"column:pin_via_sms" json:"pin_via_sms"`
|
PinViaSMS *bool `gorm:"column:pin_via_sms" json:"pin_via_sms"`
|
||||||
VaxFluCheck *bool `gorm:"column:vax_flu_check" json:"vax_flu_check"`
|
VaxFluCheck *bool `gorm:"column:vax_flu_check" json:"vax_flu_check"`
|
||||||
WorkingWithChildren *bool `gorm:"column:working_with_children" json:"working_with_children"`
|
WorkingWithChildren *bool `gorm:"column:working_with_children" json:"working_with_children"`
|
||||||
|
InternalInterpreter *bool `gorm:"column:internal_interpreter" json:"internal_interpreter"`
|
||||||
LastContactAttempt *time.Time `gorm:"column:last_contact_attempt" json:"last_contact_attempt"`
|
LastContactAttempt *time.Time `gorm:"column:last_contact_attempt" json:"last_contact_attempt"`
|
||||||
MigrationYear *time.Time `gorm:"column:migration_year" json:"migration_year"`
|
MigrationYear *time.Time `gorm:"column:migration_year" json:"migration_year"`
|
||||||
FirstName *string `gorm:"column:first_name" json:"first_name"`
|
FirstName *string `gorm:"column:first_name" json:"first_name"`
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -80,6 +109,7 @@ type DBInterpreterProcessed struct {
|
|||||||
BookingReference *int
|
BookingReference *int
|
||||||
BillableInterpreter bool
|
BillableInterpreter bool
|
||||||
BillableTpa bool
|
BillableTpa bool
|
||||||
|
BillableInternal bool
|
||||||
|
|
||||||
// FLAGS / METADATA:
|
// FLAGS / METADATA:
|
||||||
// ---
|
// ---
|
||||||
|
|||||||
Reference in New Issue
Block a user