Skip to content

panel: include today's bytes in the ALL-TIME display - #17

Open
salmun-nister wants to merge 1 commit into
nulluserid:mainfrom
salmun-nister:fix/alltime-includes-today
Open

salmun-nister wants to merge 1 commit into
nulluserid:mainfrom
salmun-nister:fix/alltime-includes-today

Conversation

@salmun-nister

Copy link
Copy Markdown

Fixes #16

Display-side fix for the static ALL-TIME row (option 2 in the issue): the daemon keeps allTime as completed days only, so the panel adds today's bytes before formatting.

Model.js - null-safe helper next to fmtGB:

// Lifetime usage for display. The daemon keeps `allTime` as completed days
// only (rolled at local midnight), so today's bytes are added here: otherwise
// ALL-TIME sits unchanged all day and can read below TODAY.
function lifetimeGB(allTimeGB, todayGB) {
  var a = num(allTimeGB)
  var t = num(todayGB)
  if (a === null && t === null) return null
  return (a === null ? 0 : a) + (t === null ? 0 : t)
}

Panel.qml - the usage row:

-                ? "ALL-TIME ↓ " + Model.fmtGB(s.usage.allTimeDownGB) + " ↑ " + Model.fmtGB(s.usage.allTimeUpGB)
+                ? "ALL-TIME ↓ " + Model.fmtGB(Model.lifetimeGB(s.usage.allTimeDownGB, s.usage.downGB))
+                  + " ↑ " + Model.fmtGB(Model.lifetimeGB(s.usage.allTimeUpGB, s.usage.upGB))

Testing

case expected
both counters present lifetime equals ledger + today (e.g. 10.8 + 3.2 -> 14.0 GB)
no ledger yet (fresh install) lifetime equals today, not 0.0 GB
today missing lifetime equals the ledger
both missing — (null, not 0.0 GB)
after the midnight roll ledger absorbs today and today resets to zero, so the displayed total is unchanged

Layout is unchanged - the string keeps the same shape and still formats through fmtGB.

Scope

Model.js and Panel.qml only. No Go changes, so backend/bin/starlinkd is untouched and the release gate's byte-identical check is unaffected. The rows this touches are separate from the ones in the power-block and 24 h-chart PRs, so it applies independently.

Known trade-off

status.json still reports the rolled figure (usage.allTime*), so the panel and the file disagree by one day's bytes. Moving the sum into the status builders is the follow-up described in the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ALL-TIME usage is static during the day and can read below TODAY

1 participant