commit cb42a1faf0f660c8c34c6c5f54ee635f316fc5fa
parent 2bafcae9645c763c94b58b2c0e90337323bec8c1
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 02:26:04 -0500
umtool: the measure slice keeps ranges and resolves a loss goal against a weight he gave
rev9-panel (6 Nov): early goals read "GOAL 165 · LOSE 75", "GOAL 140 · LOSE
100" with the bezel tick off the dial -- "lose 75" resolved against a stated
240 from a year before -- and a range he gave ("330-340", "260-270",
"230-240") collapsed to its middle.
- A loss goal's base: the run's start when the record names one; else the
latest weight he gave by the goal's date, stated OR remembered (by the day
it was his weight); else none. A target below the scale's foot is no
target: base null, value null -- his words alone ("LOSE 75"), no tick.
`base.from` says which ("runStart", "stated", "remembered").
- rangeOf: a display "330-340" / "230–240" is a range `[lo, hi]`, carried on
the event (`range`), on the state's `current` and `remembered`, and on a
goal; `value` stays the middle (where a single number is drawn).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 37 insertions(+), 8 deletions(-)
diff --git a/umtool/report-to-video/measure-slice.mjs b/umtool/report-to-video/measure-slice.mjs
@@ -201,12 +201,28 @@ const rowSource = (row) => (/(^|\/\/)(x|twitter)\.com\//.test(String(row?.citeUr
/** An entry's source kind: a clip, a post, or a card (anything else). */
const entrySource = (entry) => (entry?.type === "clip" ? "clip" : entry?.type === "post" ? "post" : "card");
+/**
+ * A RANGE he gave ("330-340 lb", "220–240"): `[lo, hi]` read off the row's
+ * display, or null. The row's `value` is the range's middle (what a single
+ * number is drawn at); the range is what he said, and the instruments draw it
+ * as a range -- a wedge, "330–340" -- never the middle alone.
+ */
+export function rangeOf(row) {
+ const m = /(\d+(?:\.\d+)?)\s*[-–]\s*(\d+(?:\.\d+)?)/.exec(String(row?.display ?? ""));
+ if (!m) return null;
+ const lo = Number(m[1]);
+ const hi = Number(m[2]);
+ return Number.isFinite(lo) && Number.isFinite(hi) && hi > lo ? [lo, hi] : null;
+}
+
function eventOf(row, schema, runOf) {
const s = measureSchema(schema);
const kind = kindOf(row, s);
const role = s.tracks.find((t) => t.key === row.scope)?.role ?? null;
const n = Number(row.value);
+ const range = role === "regime" ? null : rangeOf(row);
return {
+ ...(range ? { range } : {}),
row: row.id,
scope: row.scope,
date: row.date ?? null,
@@ -449,6 +465,11 @@ export function measureSlice(manifest, schedule, opts = {}) {
if (after && Math.round(daysBetween(d, after.date)) <= s.bandGapDays) return runById.get(after.run) ?? null;
return null;
};
+ // A loss goal's base (rev 9, 6 Nov): the run's start when the record names one;
+ // else the latest weight he gave by the goal's date -- stated or remembered,
+ // by the day it was his weight (a remembered one's asOf); else none. A target
+ // below the scale's foot is no target (a stale base: "lose 100" from 240 is
+ // not 140 lb): his words stay the goal -- "LOSE 100", no weight, no tick.
const goalBase = (row) => {
const d = row.date;
const run = runAt(d);
@@ -458,14 +479,22 @@ export function measureSlice(manifest, schedule, opts = {}) {
const last = starts[starts.length - 1];
if (last) return { value: Number(last.value), row: last.id, from: "runStart" };
}
- const stated = readings.filter((r) => r.population === "current" && dateKey(r.date) <= dateKey(d));
- const last = stated[stated.length - 1];
- return last ? { value: Number(last.value), row: last.id, from: "stated" } : null;
+ const known = readings
+ .filter((r) => dateKey(r.date) <= dateKey(d))
+ .sort((a, b) => dateKey(plotDate(a)).localeCompare(dateKey(plotDate(b))) || dateKey(a.date).localeCompare(dateKey(b.date)));
+ const last = known[known.length - 1];
+ return last ? { value: Number(last.value), row: last.id, from: last.population === "past" ? "remembered" : "stated" } : null;
};
+ const scaleMin = Number.isFinite(settings.scale?.min) ? settings.scale.min : -Infinity;
const goalOf = (row) => {
- const base = row.population === "goal_loss" ? goalBase(row) : null;
- const cell = goalCell(row, base, s);
- return { value: cell.value, loss: cell.loss, deadline: cell.deadline, due: isIso(row.due) ? row.due : null, row: row.id, display: cell.display, base };
+ let base = row.population === "goal_loss" ? goalBase(row) : null;
+ let cell = goalCell(row, base, s);
+ if (base && Number.isFinite(cell.value) && cell.value < scaleMin) {
+ base = null;
+ cell = goalCell(row, null, s);
+ }
+ const range = row.population === "goal" ? rangeOf(row) : null;
+ return { value: cell.value, loss: cell.loss, deadline: cell.deadline, due: isIso(row.due) ? row.due : null, row: row.id, display: cell.display, base, ...(range ? { range } : {}) };
};
/** A promise_claim as a promise carries it: who, when said, the day she says she paid, his-or-her words. */
@@ -506,8 +535,8 @@ export function measureSlice(manifest, schedule, opts = {}) {
const row = byId.get(ev.row);
// Another speaker's row feeds the promises and nothing else.
if (ev.speaker !== null && ev.kind !== "promiseClaim" && ev.kind !== "promiseOutcome") { state.push(snapshot(ev.t)); continue; }
- if (ev.kind === "stated" && ev.value !== null) current = { value: ev.value, qualifier: ev.qualifier, row: ev.row, date: ev.date, asOf: ev.asOf };
- else if (ev.kind === "remembered" && ev.value !== null) remembered.push({ value: ev.value, asOf: ev.asOf, row: ev.row, date: ev.date });
+ if (ev.kind === "stated" && ev.value !== null) current = { value: ev.value, qualifier: ev.qualifier, row: ev.row, date: ev.date, asOf: ev.asOf, ...(ev.range ? { range: [...ev.range] } : {}) };
+ else if (ev.kind === "remembered" && ev.value !== null) remembered.push({ value: ev.value, asOf: ev.asOf, row: ev.row, date: ev.date, ...(ev.qualifier ? { qualifier: ev.qualifier } : {}), ...(ev.range ? { range: [...ev.range] } : {}) });
else if (ev.kind === "goal" || ev.kind === "goalLoss") { goal = goalOf(row); goals.push(ev.row); }
else if (ev.kind === "lost" && ev.run !== null) {
const v = Math.abs(ev.value);