View Real-Time Peer Mentor Status Reflecting Availability and Certification
The peer mentor profile service uses a Riverpod provider backed by real-time Supabase subscriptions to compute derived status by combining availability data from the peer_mentor_availability table and certification validity from the certifications table. When a pause is activated through the pause management feature, or when a certification expires, the status updates propagate to all open views automatically via the real-time subscription. This prevents a coordinator from seeing an 'active' status for a mentor who was just paused in another session. The computed status follows a priority order: if either certification is expired OR availability is paused, the displayed status reflects that degraded state.
User Story
Acceptance Criteria
- Given a coordinator has a peer mentor's profile open, when that mentor's availability is paused in another session, then the status badge updates to 'Paused' within seconds without a manual refresh
- Given a peer mentor's certification expiry date passes, when either role views the profile or card, then the status updates to 'Expired' automatically
- Given a mentor transitions from paused back to active, when I am viewing their card in a list, then the status badge updates to 'Active' in real time
- Given the Supabase real-time connection is interrupted, when connectivity is restored, then the displayed status reconciles with the latest database state
- Given both availability is paused AND certification is expired, when the status is displayed, then the most severe state (Expired) takes precedence or both are communicated
Business Value
Stale status information is a primary risk in volunteer management — coordinators may dispatch assignments to unavailable or uncertified mentors if the UI lags reality. Real-time status computation protects service quality and organisational compliance with certification requirements enforced by HLF and Blindeforbundet.