-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Make force advance optional - so participants can play games without waiting for other participants to finish
So rn, participants must wait for the facilitator to “Force advace” to move to the next phase
But, lets make it so that there is an option for games to not have this, and participants can just play through
If a session is asynchornou (is_asycn = TRUE), then lets make it so they can play through
File: app/facilitator/session-view/page.tsx
<Button onClick={advancePhase} disabled={isAdvancing}>
{isAdvancing ? "Advancing..." : "Force Advance"}
</Button>This is where we do that
so we only want advacePhase on the facilitator side if it is not async
and advance_phase is connected to an rpc
Resources on the rpc we made:
- advance_phase rpc testing page #40
- https://linear.app/ecovet-global/issue/ECO-48/advance-phase-rpc
- You can find it under Database>Functions>advance_rpc in Supabase
- See the code below for the rpc
Participant File: app/participants/components/ParticipantNextButton.tsx
app/participants/session-flow/page.tsx
- Here the participant waits to be moved to the next phase (if advance_rpc has been caled)
- It is moved to the next phase when in
participant_session, thephase_indexis moved - So, either make a new rpc or query that moved that individual to the next phase (for that specific
participant_sessionwheresession_idanduser_idmatch, increase the index and makeis_finishedfalse)
The RPC for refrence:
DECLARE
v_template_id uuid;
v_next_phase_number integer;
BEGIN
v_next_phase_number := p_current_phase_num + 1;
SELECT template_id
INTO v_template_id
FROM session
WHERE session_id = p_session_id;
IF NOT EXISTS (
SELECT 1
FROM phase
WHERE template_id = v_template_id
AND phase_number = v_next_phase_number
) THEN
RETURN NULL;
END IF;
UPDATE participant_session
SET phase_index = v_next_phase_number,
is_finished = FALSE
WHERE session_id = p_session_id;
RETURN v_next_phase_number;
END;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels