-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Follow the previous sprint
Now: On the facilitator side
FIle: app/facilitator/session-view/page.tsx
For unfinished participants
<div>
<h3>Unfinished Participants</h3>
{participants
.filter(p => p.user_id !== profile?.id && !p.is_finished)
.map(p => (
<div key={p.user_id}>
{p.profile?.first_name} {p.profile?.last_name}
</div>
))}
</div>Next to their name we want to put how many prompts they have finished: 3/5 or such
So how do we get the total number of prompts in that phase for that role and how many they have finished
Number of prompts in that phase by that role:
Make a new query called fetchCountPrompts(roleId, phaseId) in actions/supabase/queries/sessions.ts .
It shold be basically like
export async function fetchRolePhases(
roleId: UUID,
phaseId: UUID,
): Promise<RolePhase | null> {
const { data, error } = await supabase
.from("role_phase")
.select("*")
.eq("phase_id", phaseId)
.eq("role_id", roleId)
.single();
if (error) {
console.error("Error fetching role phases:", error);
}
return data;
}except with
.select("*", { count: "exact", head: true })to get the actual count.
Use this query to get the number of prompts a given participant will need to complete
To get how many they have done, we will see how many prompt_responses have been made for that user using the session_id and phase_id
Make a new query fetchCountResponses(userId, sessionId, phaseId) in actions/supabase/queries/sessions.ts
- Which should return the count of rows that have the given userId, sessionId, and phaseId
- as seen before in the count of Prompts