MCPcopy Create free account
hub / github.com/Facets-cloud/flow / temporalSummary

Function temporalSummary

internal/app/show.go:710–741  ·  view source on GitHub ↗

temporalSummary builds the "in-progress for 5 days, due in 2 days" line for `flow show task`.

(t *flowdb.Task, now time.Time)

Source from the content-addressed store, hash-verified

708// temporalSummary builds the "in-progress for 5 days, due in 2 days"
709// line for `flow show task`.
710func temporalSummary(t *flowdb.Task, now time.Time) string {
711 var parts []string
712
713 age := daysInStatus(t, now)
714 if age > 0 {
715 dayWord := "days"
716 if age == 1 {
717 dayWord = "day"
718 }
719 parts = append(parts, fmt.Sprintf("%s for %d %s", t.Status, age, dayWord))
720 }
721
722 if diff, ok := daysUntilDue(t, now); ok {
723 switch {
724 case diff < 0:
725 abs := -diff
726 dayWord := "days"
727 if abs == 1 {
728 dayWord = "day"
729 }
730 parts = append(parts, fmt.Sprintf("overdue by %d %s", abs, dayWord))
731 case diff == 0:
732 parts = append(parts, "due today")
733 case diff == 1:
734 parts = append(parts, "due tomorrow")
735 default:
736 parts = append(parts, fmt.Sprintf("due in %d days", diff))
737 }
738 }
739
740 return strings.Join(parts, ", ")
741}

Callers 1

printTaskMetadataFunction · 0.85

Calls 2

daysInStatusFunction · 0.85
daysUntilDueFunction · 0.85

Tested by

no test coverage detected