From c764c416948dda89d6901b415e737f7eb1b4fd1e Mon Sep 17 00:00:00 2001 From: Seth Bernstein Date: Thu, 25 Jun 2026 14:16:15 -0400 Subject: [PATCH 1/2] keep verbal partners in the same A/B condition even if a partner didnt vote --- bases/rsptx/assignment_server_api/routers/peer.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bases/rsptx/assignment_server_api/routers/peer.py b/bases/rsptx/assignment_server_api/routers/peer.py index 4b457747c..7188e5c94 100644 --- a/bases/rsptx/assignment_server_api/routers/peer.py +++ b/bases/rsptx/assignment_server_api/routers/peer.py @@ -716,11 +716,12 @@ def find_set_containing_string( for p in answerers: if p in clustered: continue - grp = { - s - for s in find_set_containing_string(in_person_groups, p) - if s in sid_ans - } + # Keep the full recorded verbal group, including partners who did + # not vote on this question. A student stays in the same condition + # as the people they talked to verbal partner at all become text chat + grp = set(find_set_containing_string(in_person_groups, p)) + grp.add(p) + grp -= clustered grp.add(p) clustered |= grp clusters.append(sorted(grp)) @@ -761,8 +762,10 @@ def find_set_containing_string( # Re-running the experiment will randomize it again so that it can clear any previous assignments to keep one unambiguous group per student. # Delete + insert now will happen in a single call so re-running stays fast for larger courses. experiment_id = f"{div_id}_ab" + # Record every clustered student in their group's condition, including + # students whos partner did not vote so partners always share a condition assignments = [(sid, 0) for sid in peeps_in_person] + [ - (sid, 1) for sid in peeps + (sid, 1) for sid in peeps_in_chat ] await replace_user_experiment_entries(experiment_id, assignments) From 1a71fafbc770f814b168d88c0dd4e7ed8bde8ed5 Mon Sep 17 00:00:00 2001 From: Seth Bernstein <70603981+sethbern@users.noreply.github.com> Date: Fri, 26 Jun 2026 08:49:34 -0400 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- bases/rsptx/assignment_server_api/routers/peer.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bases/rsptx/assignment_server_api/routers/peer.py b/bases/rsptx/assignment_server_api/routers/peer.py index 7188e5c94..121d92a48 100644 --- a/bases/rsptx/assignment_server_api/routers/peer.py +++ b/bases/rsptx/assignment_server_api/routers/peer.py @@ -717,10 +717,9 @@ def find_set_containing_string( if p in clustered: continue # Keep the full recorded verbal group, including partners who did - # not vote on this question. A student stays in the same condition - # as the people they talked to verbal partner at all become text chat + # not vote on this question. Students should stay in the same condition + # as their verbal partners so they aren't split into text chat. grp = set(find_set_containing_string(in_person_groups, p)) - grp.add(p) grp -= clustered grp.add(p) clustered |= grp @@ -763,7 +762,7 @@ def find_set_containing_string( # Delete + insert now will happen in a single call so re-running stays fast for larger courses. experiment_id = f"{div_id}_ab" # Record every clustered student in their group's condition, including - # students whos partner did not vote so partners always share a condition + # students whose partner did not vote, so partners always share a condition assignments = [(sid, 0) for sid in peeps_in_person] + [ (sid, 1) for sid in peeps_in_chat ]