From c6e7562f7256672f4a7d278aea8cb6c3b74ce675 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sat, 30 Sep 2023 18:15:25 +0200 Subject: [PATCH] Disallow matched users to wait for a Programming Group Fixes CODEOCEAN-YE --- app/channels/pg_matching_channel.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/channels/pg_matching_channel.rb b/app/channels/pg_matching_channel.rb index 01ffa15f..a9d3189d 100644 --- a/app/channels/pg_matching_channel.rb +++ b/app/channels/pg_matching_channel.rb @@ -15,6 +15,12 @@ class PgMatchingChannel < ApplicationCable::Channel end def waiting_for_match + if (existing_programming_group = current_user.programming_groups.find_by(exercise: @exercise)) + message = {action: 'joined_pg', users: existing_programming_group.users.map(&:to_page_context)} + ActionCable.server.broadcast(specific_channel, message) + return + end + @current_waiting_user = PairProgrammingWaitingUser.find_or_initialize_by(user: current_user, exercise: @exercise) @current_waiting_user.status_waiting!