tasks: count overdue by calendar day like the ranker does (V-581)
Stalls compared the due instant to now while Rank compares whole calendar days, so a task due at 09:00 was counted overdue from 09:01 while its own row on the same page still read the reason as today. Stalls now reads dayDelta. A row with no capture time also counted as sitting, because the zero time is January of year 1 and every span from it clears ten days. Rank already guarded that and Stalls did not. Folded the open-versus-candidate partition FormatRU and Spoken each carried into one split helper. The two have to agree on where that line falls.
This commit is contained in:
@@ -56,10 +56,16 @@ func Stalls(items []Item, now time.Time) []Stall {
|
||||
// meant to act on.
|
||||
continue
|
||||
}
|
||||
if it.Due != nil && it.Due.Before(now) {
|
||||
// Whole calendar days, the reading Rank already uses. An instant
|
||||
// comparison calls a task due at 18:00 overdue from 18:01, so the count
|
||||
// above the table would say "просрочено" beside a row whose own reason
|
||||
// still said "сегодня".
|
||||
if it.Due != nil && dayDelta(*it.Due, now) < 0 {
|
||||
overdue++
|
||||
}
|
||||
if now.Sub(it.Created) >= StallDays*24*time.Hour {
|
||||
// A row with no capture time has not sat for anything. Without the
|
||||
// guard its zero time is January of year 1 and it always counts.
|
||||
if !it.Created.IsZero() && now.Sub(it.Created) >= StallDays*24*time.Hour {
|
||||
sitting++
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user