on job no longer in results, delete from matrix;; no backwards compatible

This commit is contained in:
bel
2022-01-17 21:29:56 -07:00
parent 6a2b2f38d0
commit 92b6019052
5 changed files with 74 additions and 53 deletions

View File

@@ -16,7 +16,8 @@ type Job struct {
Weight int
Miles int
Meta string
secrets func() interface{} `json:"-"`
Pays string
secrets func(j *Job) `json:"-"`
}
type JobLocation struct {
@@ -29,12 +30,7 @@ func (j *Job) Secrets() {
if j.secrets == nil {
return
}
v := j.secrets()
j.secrets = nil
if v == nil {
return
}
j.Meta = fmt.Sprintf("%s %+v", j.Meta, v)
j.secrets(j)
}
func (j Job) String() string {
@@ -53,6 +49,19 @@ func (j JobLocation) String() string {
return fmt.Sprintf("%s, %s @ %s", j.City, j.State, j.Date.Format("Monday Jan 02"))
}
func (j Job) FormatMultilineTextDead() string {
return fmt.Sprintf(
"no longer available: %s,%s => %s,%s for $%v @%s",
j.Pickup.City,
j.Pickup.State,
j.Dropoff.City,
j.Dropoff.State,
j.Pays,
j.URI,
)
}
func (j Job) FormatMultilineText() string {
foo := func(client string) string {
return fmt.Sprintf(

View File

@@ -143,13 +143,14 @@ func (ntgJob *ntgVisionJob) Job() Job {
Miles: ntgJob.Miles,
Weight: ntgJob.Weight,
Meta: fmt.Sprintf("equipment:%s", ntgJob.Equipment),
secrets: func() interface{} {
secrets: func(j *Job) {
jobInfo, err := ntgJob.JobInfo()
if err != nil {
logtr.Errorf("failed to get jobinfo: %v", err)
return nil
return
}
return jobInfo.String()
j.Meta = jobInfo.String()
j.Pays = fmt.Sprint(jobInfo.PayUpTo)
},
}
}

View File

@@ -1,36 +1,2 @@
[
{
"id": 4650337,
"sDate": "01/12/22",
"sCity": "Advance",
"sState": "NC",
"sdh": null,
"cDate": "01/13/22",
"cCity": "Sacramento",
"cState": "CA",
"cdh": null,
"stopCnt": 2,
"miles": 578,
"weight": 5000,
"equip": "Str Truck W/ Lift Gate",
"temp": "",
"alertReasons": []
},
{
"id": 4650338,
"sDate": "01/12/22",
"sCity": "Advance",
"sState": "NC",
"sdh": null,
"cDate": "01/13/22",
"cCity": "Winston-Salem",
"cState": "NC",
"cdh": null,
"stopCnt": 2,
"miles": 378,
"weight": 2500,
"equip": "107 tall",
"temp": "",
"alertReasons": []
}
]