feat: retain pending publications (#97)
This commit is contained in:
@@ -115,6 +115,7 @@ class StatusComposition:
|
||||
# Sample counts for waiting explanations
|
||||
sample_count: int = 0
|
||||
day_count: int = 0
|
||||
pending_publication_count: int = 0
|
||||
|
||||
# Whether the status dot should blink (only Monitoring)
|
||||
should_blink: bool = False
|
||||
@@ -286,6 +287,7 @@ def compose_status(
|
||||
freshness_age_s = None
|
||||
sample_count = 0
|
||||
day_count = 0
|
||||
pending_publication_count = 0
|
||||
deliberately_paused = False
|
||||
|
||||
if conn is None and store_fault is None and newer_schema is None:
|
||||
@@ -315,6 +317,10 @@ def compose_status(
|
||||
sample_count = cursor.fetchone()[0]
|
||||
cursor = conn.execute("SELECT COUNT(*) FROM day_aggregates")
|
||||
day_count = cursor.fetchone()[0]
|
||||
schema_version = conn.execute("PRAGMA user_version").fetchone()[0]
|
||||
if schema_version >= 4:
|
||||
cursor = conn.execute("SELECT COUNT(*) FROM pending_publications")
|
||||
pending_publication_count = cursor.fetchone()[0]
|
||||
except sqlite3.Error as exc:
|
||||
store_fault = str(exc)
|
||||
|
||||
@@ -328,6 +334,7 @@ def compose_status(
|
||||
freshness = "unknown"
|
||||
freshness_age_s = None
|
||||
sample_count = day_count = 0
|
||||
pending_publication_count = 0
|
||||
deliberately_paused = False
|
||||
|
||||
# --- External stop detection ---
|
||||
@@ -417,6 +424,7 @@ def compose_status(
|
||||
overlay_base=overlay_base,
|
||||
sample_count=sample_count,
|
||||
day_count=day_count,
|
||||
pending_publication_count=pending_publication_count,
|
||||
continuity=continuity,
|
||||
paused_lines=paused_lines,
|
||||
)
|
||||
@@ -459,6 +467,8 @@ def render_status_cli(comp: StatusComposition) -> str:
|
||||
facts.append("timer: %s" % (
|
||||
"unknown" if comp.timer_active is None else "active" if comp.timer_active else "inactive"
|
||||
))
|
||||
if comp.pending_publication_count:
|
||||
facts.append(_pending_publication_text(comp.pending_publication_count))
|
||||
|
||||
if facts:
|
||||
lines.append(" · ".join(facts))
|
||||
@@ -524,6 +534,8 @@ def render_status_tui(comp: StatusComposition) -> str:
|
||||
facts.append("Timer: %s" % (
|
||||
"unknown" if comp.timer_active is None else "active" if comp.timer_active else "inactive"
|
||||
))
|
||||
if comp.pending_publication_count:
|
||||
facts.append(_pending_publication_text(comp.pending_publication_count).capitalize())
|
||||
|
||||
if facts:
|
||||
lines.append(" · ".join(facts))
|
||||
@@ -539,3 +551,8 @@ def render_status_tui(comp: StatusComposition) -> str:
|
||||
lines.append(pl[:1].upper() + pl[1:])
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def _pending_publication_text(count: int) -> str:
|
||||
noun = "observation" if count == 1 else "observations"
|
||||
return f"pending publication: {count} {noun} retained for retry"
|
||||
|
||||
Reference in New Issue
Block a user