diff options
Diffstat (limited to 'issues/006-reorder-tasks-by-urgency.md')
| -rw-r--r-- | issues/006-reorder-tasks-by-urgency.md | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/issues/006-reorder-tasks-by-urgency.md b/issues/006-reorder-tasks-by-urgency.md deleted file mode 100644 index 8a5f968..0000000 --- a/issues/006-reorder-tasks-by-urgency.md +++ /dev/null @@ -1,63 +0,0 @@ -# [FEATURE] Reorder task list by urgency - -## Description -List past due tasks, then tasks with a specific time today, then 12am (all-day) tasks today, then future tasks. - -## User Story -As a user, I want tasks sorted by urgency tiers so I see what needs attention first. - -## Technical Context -- Affects: `internal/handlers/handlers.go` — sorting logic before template render -- Requires distinguishing "has specific time" vs "all-day" (midnight/00:00) -- Todoist API may return all-day tasks with time set to 00:00:00 - -## Test Strategy - -### Unit Test (Red) -**File:** `internal/handlers/handlers_test.go` - -```go -func TestSortTasksByUrgency(t *testing.T) { - tasks := []Task{ - {Name: "future", DueDate: tomorrow}, - {Name: "overdue", DueDate: yesterday}, - {Name: "today-timed", DueDate: todayAt(14, 30)}, - {Name: "today-allday", DueDate: todayAt(0, 0)}, - } - - sorted := SortTasksByUrgency(tasks) - - // Expected order: overdue, today-timed, today-allday, future - assert.Equal(t, "overdue", sorted[0].Name) - assert.Equal(t, "today-timed", sorted[1].Name) - assert.Equal(t, "today-allday", sorted[2].Name) - assert.Equal(t, "future", sorted[3].Name) -} -``` - -## Proposed Approach - -1. Define sort buckets with priority: - - Priority 0: Overdue (due_date < today) - - Priority 1: Today with specific time (due_date == today && time != 00:00) - - Priority 2: Today all-day (due_date == today && time == 00:00) - - Priority 3: Future (due_date > today) -2. Within each bucket, sort by due_date ascending -3. Implement stable sort to preserve original order within equal items - -## Traps to Avoid -- **Timezone handling:** Ensure consistent timezone (user's local or UTC?) for date comparisons -- **Null due dates:** Decide where tasks with no due date should appear (suggest: after future tasks) -- **All-day detection:** Todoist may use different conventions; verify API response format - -## Affected Components -- `internal/handlers/handlers.go` -- `internal/handlers/handlers_test.go` - -## Definition of Done -- [ ] Tasks sorted in specified order -- [ ] Overdue tasks appear first -- [ ] Timed tasks today before all-day tasks today -- [ ] Future tasks appear last -- [ ] Null due date tasks handled gracefully -- [ ] Unit tests cover all buckets and edge cases |
