Skip to content

add timeline helpers and a row-facts cache for the journal views - #1112

Open
vyagh wants to merge 3 commits into
journal-fixesfrom
journal-timeline-infra
Open

add timeline helpers and a row-facts cache for the journal views#1112
vyagh wants to merge 3 commits into
journal-fixesfrom
journal-timeline-infra

Conversation

@vyagh

@vyagh vyagh commented Aug 16, 2026

Copy link
Copy Markdown
Member

Groundwork for the new Journal views that come later in this stack.

3 commits:

  • timeline.py, a new module with the date math and a rounded-rectangle drawing helper. It lives here because the list view, the grid view and the moment card later in the series all draw with it.
  • a "sitting" key, which groups the entries a child made in one stretch of work in the same activity. The new views group entries by it.
  • a small cache in the list model for the facts every row asks for while drawing (id, timestamps, sitting key), so drawing stops doing a result-set read per cell.

one visible change: an entry with a broken timestamp now shows "No date" instead of a date computed from timestamp 0.

Builds on #1111 , the list model changes here stack on the fixes there.
timeline.py is new, so it's registered in Makefile.am and POTFILES.in.

This PR also starts tests/journal: 76 tests pass here, plain unittest, no new dependency.
Also walked in the live shell on my dev VM.

vyagh added 3 commits August 17, 2026 04:03
Shared date math and drawing for the journal views.
One sitting groups the entries a child made in one stretch of
work in the same activity.
Views ask for uid, timestamps and sitting key on every draw;
answering from a cache avoids a result-set read per cell.
Dates now run through timeline.safe_timestamp: zero or invalid
timestamps render 'No date' instead of an 'Unknown' elapsed
string, and nan/inf no longer raise.
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