Drop the timing and walking hint lines
Both restated their own chart in prose. The timing hint gave the typical pee gap as a sentence directly under a row whose whole job is to show that gap on a track, and the walking one gave a target the walk trend already draws as a line with a chip naming the number. Removed with them: the pee-gap cache in renderTiming, which existed only so the hint and the pee row could share one computation, and the .timing-hint rule. median and walkTargetFor stay — the timing chart and the walk trend's goal line are still their callers. The changelog entry announcing walks keeps its mention of the rule of thumb. That one shipped and was true at the time, so a new entry retires it rather than an edit pretending it was never there.
This commit is contained in:
+1
-20
@@ -763,26 +763,14 @@
|
||||
];
|
||||
|
||||
function renderTiming(events) {
|
||||
const peeGaps = gapsBetween(events, "pee");
|
||||
|
||||
for (const row of TIMING_ROWS) {
|
||||
const svg = document.getElementById(`timing-chart-${row.type}`);
|
||||
const note = document.getElementById(`timing-note-${row.type}`);
|
||||
if (!svg || !note) continue;
|
||||
const gaps = row.type === "pee" ? peeGaps : gapsBetween(events, row.type);
|
||||
const gaps = gapsBetween(events, row.type);
|
||||
const last = lastEventOfType(events, row.type);
|
||||
drawTimingChart(svg, note, row, gaps, last ? Math.max(0, Date.now() - last.at) : null);
|
||||
}
|
||||
|
||||
const hint = document.getElementById("timing-hint");
|
||||
const typicalPee = median(peeGaps);
|
||||
if (typicalPee != null) {
|
||||
hint.textContent =
|
||||
`Based on ${peeGaps.length} pee gap${peeGaps.length === 1 ? "" : "s"}. ` +
|
||||
`Aim to take the puppy out a little before the typical ${formatDuration(typicalPee)} mark.`;
|
||||
} else {
|
||||
hint.textContent = "Log a few more pees, poos and meals to see typical timings.";
|
||||
}
|
||||
}
|
||||
|
||||
function drawTimingChart(svg, note, row, gaps, since) {
|
||||
@@ -1071,13 +1059,6 @@
|
||||
const totalMs = walkMsInRange(events, from, to);
|
||||
document.getElementById("walk-total").textContent =
|
||||
windows.length ? `(${formatDuration(totalMs)})` : "";
|
||||
|
||||
const goal = walkTargetFor(loadConfig().birthday);
|
||||
const goalEl = document.getElementById("walk-goal");
|
||||
goalEl.textContent = goal
|
||||
? `Rule of thumb at this age: about ${goal.perWalk} min per walk, ${goal.walks}× a day (~${goal.total} min).`
|
||||
: "";
|
||||
goalEl.hidden = !goal;
|
||||
}
|
||||
|
||||
// Which history rows sit inside a sleep or walk window, so the list can run a
|
||||
|
||||
Reference in New Issue
Block a user