Clarify incomplete history readouts (#103)

This commit is contained in:
xavierk
2026-09-28 17:54:56 +05:30
parent c4524cf654
commit d045e88043
3 changed files with 30 additions and 12 deletions
+19 -11
View File
@@ -72,6 +72,13 @@ _ACTION_LEGEND = (
"p Pause · " + _RESUME_HINT + "\n"
"c Collect now · t Today · [ ] Day · g Date · m Motion · d Disclosures · ? Help"
)
_LOCAL_ACTIVITY_STATE_LABELS = {
"so_far": "totals so far",
"incomplete": "incomplete",
"complete": "complete",
"zero": "measured zero",
"unavailable": "local activity unavailable",
}
def _format_remaining(seconds: float) -> str:
"""Format remaining lifespan as human-readable string."""
@@ -490,7 +497,9 @@ class HistoryGraph(Widget):
parts = [
"[bold]%s[/bold] · %s · %s"
% (day.get("day", ""), day.get("timezone_label", ""),
day.get("activity_state", "incomplete")),
_LOCAL_ACTIVITY_STATE_LABELS.get(
day.get("activity_state"), "local activity unavailable",
)),
"W %s · R %s" % (written_text, read_text),
]
shared_written = day.get("shared_bytes_written", 0)
@@ -601,7 +610,7 @@ class HistoryGraph(Widget):
if h.get("timezone_label"):
state = "future" if h.get("is_future") else (
"gap" if h.get("is_gap") else
"partial" if h.get("is_partial") else "measured"
"incomplete" if h.get("is_partial") else "measured"
)
note = ""
if self._drill_unallocated_bytes or self._drill_unallocated_read:
@@ -1231,7 +1240,11 @@ def _query_local_hourly_graph_data(
"unknown_seconds": unknown_seconds,
"is_zero": written == 0 and read == 0 and not is_gap,
"is_gap": is_gap,
"is_partial": hour_start <= current < hour_end,
"is_partial": (
hour_start <= current < hour_end
or coverage < 1.0
or unknown_seconds > 0
),
"is_future": is_future,
})
hour_start = hour_end
@@ -2193,14 +2206,9 @@ class FenrisTuiApp(App):
tz_display = "%s %s" % (local["tz_name"], local["tz_offset"])
state = local["activity_state"]
state_labels = {
"so_far": "totals so far",
"incomplete": "incomplete",
"complete": "complete",
"zero": "measured zero",
"unavailable": "local activity unavailable",
}
label = state_labels.get(state, "local activity unavailable")
label = _LOCAL_ACTIVITY_STATE_LABELS.get(
state, "local activity unavailable",
)
bw = local["bytes_written"]
br = local["bytes_read"]
if bw is None or br is None: