Updated apps

This commit is contained in:
2026-07-20 22:52:35 -04:00
parent 28a8cb98f6
commit a0c3271743
1164 changed files with 94781 additions and 6892 deletions
@@ -298,8 +298,15 @@ class MaintenanceTask:
completed_by: str | None = None,
photo_doc_id: str | None = None,
reading_value: float | None = None,
used_parts: list[dict[str, Any]] | None = None,
auto: bool = False,
) -> None:
"""Mark this task as completed."""
"""Mark this task as completed.
``auto`` marks a completion nobody performed in the UI (a trigger
recovering on its own): the history entry is flagged so surfaces can
label it, and the rotation pointer stays put — advancing it would
credit/skip a pool member for work nobody attributed."""
# Save current next_due as anchor for planned mode before resetting
if self.interval_anchor == "planned" and self.next_due is not None:
self.last_planned_due = self.next_due.isoformat()
@@ -322,12 +329,15 @@ class MaintenanceTask:
completed_by=completed_by,
photo_doc_id=photo_doc_id,
reading_value=reading_value,
used_parts=used_parts,
auto=auto,
)
# Shared tasks: rotate the "currently responsible" pointer to the next
# assignee for the coming cycle (after this completion is recorded, so
# least_completed sees it).
self.advance_rotation()
# least_completed sees it). Auto-completions don't rotate — see above.
if not auto:
self.advance_rotation()
def advance_rotation(self) -> None:
"""Advance ``responsible_user_id`` to the next pool member.
@@ -408,12 +418,16 @@ class MaintenanceTask:
completed_by: str | None = None,
photo_doc_id: str | None = None,
reading_value: float | None = None,
used_parts: list[dict[str, Any]] | None = None,
auto: bool = False,
) -> None:
"""Add an entry to the maintenance history."""
entry: dict[str, Any] = {
"timestamp": dt_util.now().isoformat(),
"type": entry_type,
}
if auto:
entry["auto"] = True
if notes is not None:
entry["notes"] = notes
if cost is not None:
@@ -434,6 +448,10 @@ class MaintenanceTask:
# completion entry — the delta view derives from consecutive entries.
if reading_value is not None:
entry["reading_value"] = reading_value
if used_parts:
# #99: the parts actually used on THIS completion ([{part_id,
# name, quantity}]) — explicit per-completion consumption record.
entry["used_parts"] = used_parts
self.history.append(entry)