Skip to content

fix(today): order rows by reference date, then todayIndex, as the app does - #385

Merged
ryanlewis merged 2 commits into
mainfrom
fix/today-order
Oct 7, 2026
Merged

ryanlewis merged 2 commits into
mainfrom
fix/today-order

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

things today now orders rows within each group by todayIndexReferenceDate (newest first), then todayIndex. #237 dropped the reference date, so rows carried over from earlier days sat out of place among the day's own, for open rows as well as closed ones.

The reference date is the day a row's todayIndex was last written. Each earlier day is its own tier: rows from yesterday come above rows from three days ago, not mixed in by todayIndex.

Checked against the app

  • Today on 7 Oct 2026, 26 rows across three reference days: the CLI matches name of to dos of list "Today" in every position. The previous ordering differed at 6 positions.
  • A variant that treats all carried-over rows as one set ("today or not") put a row in the wrong place, so the per-day key is the one the app uses.
  • A probe to-do in the Inbox with a deadline of today: Things gave it today's reference date, and it sat where the CLI put it (27 rows, identical). The probe was trashed afterwards.

Changes

  • internal/db/tasks.go: the Today orderBy, and the comments that describe it.
  • internal/db/tasks_test.go: a new test with rows from three days, where todayIndex runs against the reference date; two older test comments no longer say "todayIndex alone".
  • internal/db/testdata/list_query_golden.txt: regenerated, with only the Today ORDER BY lines changed.
  • docs/content/commands.md: the Today ordering paragraph.

make test and make lint pass.

@ryanlewis
ryanlewis merged commit 2423ac6 into main Oct 7, 2026
10 checks passed
@ryanlewis
ryanlewis deleted the fix/today-order branch October 7, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant