fix: conserve local-day activity evidence
This commit is contained in:
+43
-16
@@ -1709,7 +1709,9 @@ class FenrisTuiApp(App):
|
||||
)
|
||||
tz_name = detect_system_tz()
|
||||
if self._browse_date is not None:
|
||||
local = query_local_day_summary(conn, self._browse_date)
|
||||
local = query_local_day_summary(
|
||||
conn, self._browse_date, clock_now=self._clock_now
|
||||
)
|
||||
else:
|
||||
local = query_current_local_day(conn, self._clock_now, tz_name)
|
||||
except Exception:
|
||||
@@ -1720,7 +1722,10 @@ class FenrisTuiApp(App):
|
||||
|
||||
if local is None:
|
||||
date = self._browse_date or self._clock_now.astimezone().date().isoformat()
|
||||
widget.update("%s · local-day evidence unavailable\nW unavailable · R unavailable" % date)
|
||||
widget.update(
|
||||
"%s · local-day evidence unavailable\nW unavailable · R unavailable"
|
||||
% date
|
||||
)
|
||||
widget.display = True
|
||||
main_grid.remove_class("local-day")
|
||||
return
|
||||
@@ -1728,23 +1733,45 @@ class FenrisTuiApp(App):
|
||||
main_grid.add_class("local-day")
|
||||
widget.styles.display = "block"
|
||||
|
||||
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")
|
||||
bw = local["bytes_written"]
|
||||
br = local["bytes_read"]
|
||||
partial = "" if local["complete"] else " · totals so far"
|
||||
tz_display = "%s %s" % (local["tz_name"], local["tz_offset"])
|
||||
|
||||
text = (
|
||||
"[bold]%s[/bold] · %s%s\n"
|
||||
" W %.3f GB · R %.3f GB · %.0f%% coverage"
|
||||
% (
|
||||
local["local_date"],
|
||||
tz_display,
|
||||
partial,
|
||||
bw / 1e9,
|
||||
br / 1e9,
|
||||
local["coverage"] * 100,
|
||||
if bw is None or br is None:
|
||||
totals = "W unavailable · R unavailable"
|
||||
else:
|
||||
totals = "W %.3f GB known · R %.3f GB known" % (
|
||||
bw / 1e9, br / 1e9
|
||||
)
|
||||
)
|
||||
lines = [
|
||||
"[bold]%s[/bold] · %s · %s" % (
|
||||
local["local_date"], tz_display, label,
|
||||
),
|
||||
totals,
|
||||
]
|
||||
if local["shared_evidence_count"]:
|
||||
lines.append(
|
||||
"shared at midnight W %.3f GB · R %.3f GB" % (
|
||||
local["shared_bytes_written"] / 1e9,
|
||||
local["shared_bytes_read"] / 1e9,
|
||||
)
|
||||
)
|
||||
if local["unallocated_evidence_count"]:
|
||||
lines.append(
|
||||
"unallocated W %.3f GB · R %.3f GB" % (
|
||||
local["unallocated_bytes_written"] / 1e9,
|
||||
local["unallocated_bytes_read"] / 1e9,
|
||||
)
|
||||
)
|
||||
text = "\n".join(lines)
|
||||
widget.update(text)
|
||||
|
||||
def _on_graph_drill(self, day: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user