Summary
Add a way to store an auditable report for chores when they are closed. The report should capture which user the chore was assigned to at close time, the final status of the chore (completed, skipped, failed, etc.), who closed it, timestamp, and any optional notes/metadata.
Motivation
- Audit/history: know who was responsible and what happened at close time.
- Analytics: compute completion rates, skipped chores, and identify patterns.
- Debugging: preserve final state for edge-case investigations instead of relying only on current chore records.
Suggested implementation
-
New model (e.g., ChoreCloseReport):
id (pk)
chore (FK -> Chore)
assigned_to (FK -> User, nullable)
final_status (string/enum: completed, skipped, failed, cancelled, etc.)
closed_by (FK -> User, nullable)
closed_at (datetime)
notes (text/json, optional)
metadata (jsonb, optional)
-
Create and save a ChoreCloseReport whenever a chore is transitioned to a terminal/closed state. Ensure this happens transactionally with the chore state change so reports are consistent.
-
Consider adding an index on closed_at and assigned_to for reporting queries.
-
API: expose read-only endpoints or admin views to fetch reports (filter by date range, assigned user, final_status).
-
Migration: add a migration to create the table and, optionally, a backfill script to generate reports for recent historical closes if desired.
Notes / Edge cases
- If chores can be re-assigned during close, record the
assigned_to value at close time (snapshot).
- Keep
assigned_to and closed_by nullable to safely handle deleted users or automated closures.
- Consider retention/archival policy for very large datasets.
Acceptance criteria
- New DB model/table exists and is migrated.
- A
ChoreCloseReport row is created whenever a chore is closed.
- Admin/API can query reports by date, assigned user, and final_status.
Labels: enhancement
Summary
Add a way to store an auditable report for chores when they are closed. The report should capture which user the chore was assigned to at close time, the final status of the chore (completed, skipped, failed, etc.), who closed it, timestamp, and any optional notes/metadata.
Motivation
Suggested implementation
New model (e.g.,
ChoreCloseReport):id(pk)chore(FK -> Chore)assigned_to(FK -> User, nullable)final_status(string/enum: completed, skipped, failed, cancelled, etc.)closed_by(FK -> User, nullable)closed_at(datetime)notes(text/json, optional)metadata(jsonb, optional)Create and save a
ChoreCloseReportwhenever a chore is transitioned to a terminal/closed state. Ensure this happens transactionally with the chore state change so reports are consistent.Consider adding an index on
closed_atandassigned_tofor reporting queries.API: expose read-only endpoints or admin views to fetch reports (filter by date range, assigned user, final_status).
Migration: add a migration to create the table and, optionally, a backfill script to generate reports for recent historical closes if desired.
Notes / Edge cases
assigned_tovalue at close time (snapshot).assigned_toandclosed_bynullable to safely handle deleted users or automated closures.Acceptance criteria
ChoreCloseReportrow is created whenever a chore is closed.Labels: enhancement