HIGH story-quick-activity-registration-peer-mentor-005 5 pts
5
Story Points
High
Priority
Quick Activity Registration
Feature

User Story

As a Peer Mentor (Likeperson)
I want to view a list of my recently submitted activity registrations and correct one if I made a mistake
So that I can fix errors immediately after registration without needing to contact my coordinator

Audience Summaries

Self-service edit capability for recent registrations directly reduces the administrative burden on coordinators, who currently must manually correct data entry errors on behalf of peer mentors. Since activity records feed directly into Bufdir statistical reporting, reimbursement calculations, and sertification tracking, data accuracy at source has measurable financial and compliance implications — errors that propagate into reports can result in incorrect funding allocations or failed audits. The configurable 7-day edit window with coordinator approval for older records strikes a governance balance: empowering peer mentors to self-correct quickly while protecting data integrity for closed reporting periods. This story builds trust in the platform among peer mentors by removing the frustration of being locked into incorrect records and strengthens coordinator confidence that the data they review reflects ground truth.

Together, these outcomes support user retention, operational efficiency, and the organisation's ability to deliver accurate accountability reporting to government funders.

This is a high-complexity story with multiple distinct delivery components: an activity history list view, an edit form with pre-populated fields, conditional edit-window enforcement, a coordinator approval workflow path, and a dual-value audit trail. The dependency on story-quick-activity-registration-peer-mentor-001 means the base registration data model must be stable before this story begins. Cross-functional coordination is needed with coordinators, who must understand and accept the approval request flow for edits outside the 7-day window — this requires UAT with coordinator personas, not just peer mentors. The configurable edit window (default 7 days) needs a configuration management decision: where is this value stored and who can change it?

That dependency should be resolved before development begins. Testing scope is broad: happy path edits, boundary conditions at day 7, approval request triggering, audit trail integrity, and field lock enforcement for organisation and peer mentor ID. Plan for at least two sprint cycles and include a migration consideration if existing records need audit trail backfilling.

This story requires several interconnected system changes. The activity history list must query Supabase for the authenticated peer mentor's own registrations, ordered by created_at descending, and render them as tappable entries. Tapping a record opens an edit form pre-populated via a Supabase select by record ID; the organisation and peer_mentor_id fields must be rendered as read-only display elements, not editable inputs, to enforce the constraint. On save, the update payload should write changed fields plus an edited_at timestamp.

For the audit trail, consider storing the original values as a JSONB `edit_history` column appended on each update, or a separate audit table — confirm the approach with data schema owners before implementing. The edit window check compares the record's created_at against the current time using the configurable threshold (read from app config or a settings table). If outside the window, the save action must instead create a pending approval record and notify the coordinator (via existing notification infrastructure if available, or a new approvals table). Coordinator view must conditionally render both original and edited values from the audit trail.

Ensure Supabase RLS policies allow peer mentors to update only their own records and block direct writes to immutable fields.

Acceptance Criteria

  • Given I have just submitted a registration, when the confirmation view is shown, then an 'Edit this registration' button is visible
  • Given I tap 'Edit this registration', when the edit view opens, then all fields (activity type, date, duration, notes) are pre-populated with the submitted values
  • Given I correct the duration from 30 to 45 minutes and save, when I return to my activity list, then the entry shows 45 minutes and an 'edited' timestamp
  • Given I attempt to edit a registration that is 8 days old, when the edit view opens, then a notice informs me that coordinator approval is required and the save action triggers an approval request rather than an immediate update
  • Given the edit is saved, when the coordinator views the same record, then both the original and the edited values are visible in the audit trail

Business Value

Immediate self-correction reduces coordinator workload and keeps the data accurate at source. Errors in activity records affect Bufdir statistics, reimbursement calculations, and sertification tracking. Empowering peer mentors to fix their own mistakes quickly builds trust in the system and reduces the administrative overhead on coordinators.