Skip to content

fix(app): leave a gap in History where nothing was recorded - #117

Merged
yogeshprasad098 merged 1 commit into
mainfrom
fix/history-gaps
Nov 27, 2026
Merged

yogeshprasad098 merged 1 commit into
mainfrom
fix/history-gaps

Conversation

@yogeshprasad098

Copy link
Copy Markdown
Contributor

What changed

History charts joined the last sample before a stretch with no recording to the first one after. On this Mac the helper recorded nothing from 4:38 to 9:24 PM because Chargectl was quit (see #118 for why). So the Charge, Temperature and Power charts drew straight lines across five hours, and the hover marker snapped between the two ends instead of following the pointer.

  • [HistorySample].runs splits samples where two are more than 20 minutes apart. The helper records once a minute while the Mac is awake, and a sleeping Mac wakes to record about every 15 minutes, so sleep stays one line. Each chart draws each run as its own series.
  • sample(near:) finds the sample closest to the pointer, or nil inside a gap. value(at:_:) reads the line between the samples around the pointer, so the dot slides along the line.
  • The hover line and time follow the pointer exactly. Inside a gap the line is dashed and the readouts say "Not recorded" or "–".
  • The charger strip under the Charge chart stops at a gap instead of filling it.

Verified

  • New tests in SharedModelTests cover runs, the nearest sample and the gap, and the value between samples. ./scripts/check.sh passes.
  • A new design render, history-gap, shows the gap in all three charts.

Not verified: hovering in the running app, because that needs mouse input.

The charts joined the last sample before a stretch with no recording, such
as Chargectl being quit, to the first one after, so a straight line ran
across hours with no data, and hovering snapped between the two ends.
Draw each unbroken run of samples as its own line, let the hover line
follow the pointer with its dot on the line, and say "Not recorded" in a
gap. The charger strip stops at a gap too.
@github-actions github-actions Bot added area: helper The root helper: installing, updating, Login Items and its data area: dashboard The Chargectl window and the setup window area: ci CI, the check scripts and the build setup labels Nov 27, 2026
@yogeshprasad098
yogeshprasad098 merged commit b291851 into main Nov 27, 2026
9 checks passed
@yogeshprasad098
yogeshprasad098 deleted the fix/history-gaps branch November 27, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI, the check scripts and the build setup area: dashboard The Chargectl window and the setup window area: helper The root helper: installing, updating, Login Items and its data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant