dont repeat entire job description for msg

This commit is contained in:
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 {
foo := func(client string) string {
return fmt.Sprintf(
"--- %s: %s => %s ---\nPickup: %s\nDropoff: %s\nNotes: %d lbs, %d miles, %s\n%s",
"--- %s: %s => %s ---",
client,
j.Pickup.State,
j.Dropoff.State,
j.Pickup.String(),
j.Dropoff.String(),
j.Weight,
j.Miles,
j.Meta,
j.URI,
)
}
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)
if strings.Contains(fmt.Sprint(clients[k].States), j.Pickup.State) {
if len(out) > 0 {
out += "\n\n"
out += "\n"
}
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
}