timescale.info
Sign inSign up

How OpenChronology was built

Every merged pull request of openchronology/timeline-app, its first week of commits and its releases; and before them the 2020 PureScript editor, from snapshots of its deleted repositories in the Wayback Machine. Written to this server through the HTTP API.

327 moments · 2020-03-09T00:15:08Z CE – 2026-11-02T20:11:21Z CE · by @athan · @athan

#180 · Shift or scale times for good: everything, or what tags or relationships select

  • timeline-app
  • pull request

Closes #96. Applies the comparison tool's offset and scale permanently to a whole timeline, or to the moments and durations a separation query selects (tags or relationships). It says ahead of time what will change and shows a progress bar while it works. ## Using it - **Where:** - **Shift or scale times…** in the timeline menu (right-click or hold). - **Shift or scale these…** in a separation's bar, which applies to the upper track. - **The mapping:** each time becomes `(time − around) × scale + around + offset`, in exact rationals. With **Around** at 0 it is comparison's `time × scale + offset`. - Around is new compared with comparisons, so a timeline can be stretched around one of its own times rather than coordinate zero. It starts at the time where the menu was opened. - Offsets take time differences in the display's units, as comparisons do. - **Apply to:** - every moment and duration; - those tagged, or not tagged; - those related to the moment or duration the menu was opened on, directly or through any chain. The selection is exactly what separating by those tags or relationships shows (`filterMembership`, now shared with `filterDocument`). - **Durations:** fixed starts and ends are mapped. An end that follows a moment keeps following it. ## Before and while - **Before applying,** the dialog says what will change: - in the browser, exact counts ("This moves 5 moments and 1 duration. You can undo it."); - on the server, the timeline's size, that it saves at once as one version (history keeps the one before), and a warning past 100,000 moments that it can take minutes and others' saves wait. - **In the browser,** it is one undoable edit, applied in chunks with a progress bar. When everything moves, the view moves with it. - **On the server,** `POST /api/timelines/:id/map-times` is **one save, so one revision**, streaming progress as JSON lines: - a slice at a time ("Saving 5,000 of 10,000 changes…") when applied in place; - or each stage ("Rebuilding the timeline: writing moments…") when it changes over half of a timeline under 200,000 moments, where rebuilding is quicker (existing `incremental()` rule). - **Desktop app's server client:** it can't read streams, so it gets one JSON reply. - **If the tab closes:** the server finishes anyway. - **While it works,** the dialog can't be closed. Large desktop `.och` files (over 2,048 moments, kept in the native store) are left out, as range deletion is; filed as #179. ## Tests - `test/time-map.test.mjs` (unit): mapping arithmetic and validation, and that the selection matches separation. - `test/time-map-postgres.mjs`: - tags, everything around a point, related, decimals; - one revision each; nothing saved when nothing moves; - refusals: bad scale (400), stale revision (409), reader (403); - the streamed lines and the plain JSON reply; - slice progress with a small slice size. - `test/time-map-browser.mjs` (in `browser.mjs`): - tagged moves and one Undo restores; - everything doubles, with the view following; - from a separated track's bar. - `test/time-map-live-postgres.mjs` (live platform, 20,000 moments): - everything (rebuilt, stage progress); - then the tagged half (in place, slice progress); - each one revision, checked in the database. - Two existing menu checks now include the new item. Locally: 272 unit tests, typecheck, Prettier, all 44 DB tests and all 11 browser suites pass.

Sources

Open #180 · Shift or scale times for good: everything, or what tags or relationships select in the timeline