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:
@@ -54,6 +54,27 @@ func TestStallsSaysNothingWhenThereIsNothing(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStallsCountsOverdueByCalendarDay(t *testing.T) {
|
||||
// Same reading as Rank, or the count above the table contradicts the reason
|
||||
// in the row: due at 09:00, asked at 12:00, and it is still due today.
|
||||
now := stallNow()
|
||||
earlier := now.Add(-3 * time.Hour)
|
||||
items := []Item{{ID: 1, Text: "оплатить интернет", Status: StatusOpen, Created: now.Add(-time.Hour), Due: &earlier}}
|
||||
if got := Stalls(items, now); len(got) != 0 {
|
||||
t.Fatalf("shapes = %+v, want none — a task due today is not overdue", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStallsIgnoresATaskWithNoCaptureTime(t *testing.T) {
|
||||
// The zero time is January of year 1, so an unstamped row would count as
|
||||
// sitting forever.
|
||||
now := stallNow()
|
||||
items := []Item{{ID: 1, Text: "купить молоко", Status: StatusOpen}}
|
||||
if got := Stalls(items, now); len(got) != 0 {
|
||||
t.Fatalf("shapes = %+v, want none", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStallsCountsNoJudgement(t *testing.T) {
|
||||
// The line this shape may not cross. Every sentence states a count; none of
|
||||
// them says whether the work matters or should be dropped.
|
||||
|
||||
Reference in New Issue
Block a user