daysInStatus returns the number of days the task has been in its current status. Uses status_changed_at if set, else falls back to created_at.
(t *flowdb.Task, now time.Time)
| 651 | // current status. Uses status_changed_at if set, else falls back to |
| 652 | // created_at. |
| 653 | func daysInStatus(t *flowdb.Task, now time.Time) int { |
| 654 | ref := t.CreatedAt |
| 655 | if t.StatusChangedAt.Valid && t.StatusChangedAt.String != "" { |
| 656 | ref = t.StatusChangedAt.String |
| 657 | } |
| 658 | parsed, err := time.Parse(time.RFC3339, ref) |
| 659 | if err != nil { |
| 660 | return 0 |
| 661 | } |
| 662 | return int(now.Sub(parsed) / (24 * time.Hour)) |
| 663 | } |
| 664 | |
| 665 | // daysUntilDue returns the number of days until the due date. Negative |
| 666 | // means overdue. Returns (0, false) if no due date is set. |
no outgoing calls
no test coverage detected