#596 Measures: balances, durations at start or end, and totals that split the window (#595)
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#596
- pull request
- state:merged
Part 1 of #595: declarations, the editor's change index, totals that split the window, and balances in the editor's frames. - **Declarations** gain two fields. Both are validated in the editor, on the server and by the desktop store: - `durations`: `"start"` (the default) or `"end"`, where a duration's change applies. It governs totals and balance alike. - `balance`: `{ at: "start" | "end" | , value }`. - **Change index:** the editor's index keeps moments' changes, as before, plus durations' changes at their start or end, as each measure says. - The durations part is rebuilt when durations, or the moments they follow, change. - An ongoing duration counted at its end applies nothing yet. - **Totals split the window:** each summary covers from its first time up to the next one's; the first starts at the window's start and the last runs to its end. Every change in the window counts once, long durations' included, which before counted in no summary. - **Balances:** frames carry each anchored measure's `balances` (before the window's changes, and after them) and each summary's `balanceAfter`. Changes at one time apply together. **Not yet:** servers and desktop files still give their totals as before. Their change indexes are parts 2 and 3, and the editor's display of balances is part 4. **Tests:** - `test/measure-balance.test.mjs` checks declarations, totals that split the window, and balances before and after the window and after each summary, against hand sums. It covers all three kinds of anchor, durations counted at their end, ongoing durations, moments moving the ends that follow them, and other edits. - The #576 test now expects long durations' values in the window's totals. - The Rust validation test covers the new keys. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/circagraph/timeline-app/pull/596
Related
- #576 Measures 5: durations' measures counted where they start
- #595 Measures: running balances from changes, and one change index per timeline
- #597 Measures: the PostgreSQL change index, balances and split totals (#595)
- #598 Measures: the SQLite change index for desktop files (#595)
- #602 Measures: balances in the editor, a balance chart and api.balance (#595)
- Merge pull request #596 from openchronology/feat/595-balances