dont repeat entire job description for msg

master v0.1.5
Bel LaPointe 2022-01-14 00:30:17 -05:00
parent e2cd24a39f
commit 32d09dbac6
2 changed files with 16 additions and 10 deletions

View File

@ -43,16 +43,10 @@ func (j JobLocation) String() string {
func (j Job) FormatMultilineText() string { func (j Job) FormatMultilineText() string {
foo := func(client string) string { foo := func(client string) string {
return fmt.Sprintf( return fmt.Sprintf(
"--- %s: %s => %s ---\nPickup: %s\nDropoff: %s\nNotes: %d lbs, %d miles, %s\n%s", "--- %s: %s => %s ---",
client, client,
j.Pickup.State, j.Pickup.State,
j.Dropoff.State, j.Dropoff.State,
j.Pickup.String(),
j.Dropoff.String(),
j.Weight,
j.Miles,
j.Meta,
j.URI,
) )
} }
out := "" out := ""
@ -61,10 +55,22 @@ func (j Job) FormatMultilineText() string {
log.Printf("job multiline: %+v contains %s then use %v", clients[k].States, j.Pickup.State, k) log.Printf("job multiline: %+v contains %s then use %v", clients[k].States, j.Pickup.State, k)
if strings.Contains(fmt.Sprint(clients[k].States), j.Pickup.State) { if strings.Contains(fmt.Sprint(clients[k].States), j.Pickup.State) {
if len(out) > 0 { if len(out) > 0 {
out += "\n\n" out += "\n"
} }
out += foo(k) out += foo(k)
} }
} }
if len(out) > 0 {
out = fmt.Sprintf(
"%s\nPickup: %s\nDropoff: %s\nNotes: %d lbs, %d miles, %s\n%s",
out,
j.Pickup.String(),
j.Dropoff.String(),
j.Weight,
j.Miles,
j.Meta,
j.URI,
)
}
return out return out
} }

View File

@ -19,7 +19,7 @@
"DirectionsURIFormat": "https://maps.googleapis.com/maps/api/directions/json?origin=%s\u0026destination=%s\u0026mode=driving\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg", "DirectionsURIFormat": "https://maps.googleapis.com/maps/api/directions/json?origin=%s\u0026destination=%s\u0026mode=driving\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg",
"PathedURIFormat": "https://maps.googleapis.com/maps/api/staticmap?size=250x250\u0026path=%s\u0026format=jpeg\u0026maptype=roadmap\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg\u0026size=250x250\u0026markers=%s|%s\u0026zoom=5", "PathedURIFormat": "https://maps.googleapis.com/maps/api/staticmap?size=250x250\u0026path=%s\u0026format=jpeg\u0026maptype=roadmap\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg\u0026size=250x250\u0026markers=%s|%s\u0026zoom=5",
"URIFormat": "https://maps.googleapis.com/maps/api/staticmap?center=%s\u0026markers=label=A|%s\u0026zoom=5\u0026size=250x250\u0026scale=1\u0026format=jpeg\u0026maptype=roadmap\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg", "URIFormat": "https://maps.googleapis.com/maps/api/staticmap?center=%s\u0026markers=label=A|%s\u0026zoom=5\u0026size=250x250\u0026scale=1\u0026format=jpeg\u0026maptype=roadmap\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg",
"Pathed": true, "Pathed": false,
"Pickup": false, "Pickup": false,
"Dropoff": false "Dropoff": false
}, },
@ -61,7 +61,7 @@
"Matrix": { "Matrix": {
"ReceiveEnabled": true, "ReceiveEnabled": true,
"Mock": false, "Mock": false,
"Continuation": "1314", "Continuation": "1318",
"Homeserver": "https://m.bltrucks.top", "Homeserver": "https://m.bltrucks.top",
"Username": "@bot.m.bltrucks.top", "Username": "@bot.m.bltrucks.top",
"Token": "mvDWB96KXMF8XhOam8EC5XVdQvSEw0CDeClcSWocBcYkwZX3FPNWZ5uOnQk2EmT1cjpzfeuD7gDYPPjOuyZlI3bE9TE35UjNOlZgi0Tugm25s91iVsbIF6kMZsCIhVMSmEf6w3jxX6wQYOWvmDZ4mu6f5c8wr221EMDcOpEzQV09d1zuBSWgKLBgjqAkYHJZ5dTRIWpEDpPgujhOFZa2ld1HiAOxrJKlIrlfDBN0CUsTlGOGplujDAr4VtpFzNRS", "Token": "mvDWB96KXMF8XhOam8EC5XVdQvSEw0CDeClcSWocBcYkwZX3FPNWZ5uOnQk2EmT1cjpzfeuD7gDYPPjOuyZlI3bE9TE35UjNOlZgi0Tugm25s91iVsbIF6kMZsCIhVMSmEf6w3jxX6wQYOWvmDZ4mu6f5c8wr221EMDcOpEzQV09d1zuBSWgKLBgjqAkYHJZ5dTRIWpEDpPgujhOFZa2ld1HiAOxrJKlIrlfDBN0CUsTlGOGplujDAr4VtpFzNRS",