From 99b6b36024c04af4e422a3ed921b70c86d7baa2b Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Fri, 3 Jul 2026 06:50:23 +0200 Subject: [PATCH] fix: include invited coaches who never RSVPed in feedback dropdown Closes #2633 The feedback form was only showing coaches with attending=true or attended=true. This excluded new coaches who were invited but never RSVPed (attending=nil) and then showed up to coach. Since these coaches are invisible in the admin attendance UI (which only shows attending=true), organisers often could not mark them as attended, leaving students unable to submit feedback for them. Now the feedback dropdown also includes coaches with attending=nil, so students can always select a coach who was invited to the workshop. --- app/controllers/feedback_controller.rb | 3 ++- spec/features/member_feedback_spec.rb | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/controllers/feedback_controller.rb b/app/controllers/feedback_controller.rb index 416fe2034..b3d48d583 100644 --- a/app/controllers/feedback_controller.rb +++ b/app/controllers/feedback_controller.rb @@ -40,7 +40,8 @@ def feedback_params end def set_coaches(workshop) - @coaches = workshop.invitations.to_coaches.accepted_or_attended + @coaches = workshop.invitations.to_coaches + .where('attending IS NULL OR attending = ? OR attended = ?', true, true) .order(Arel.sql('attended DESC NULLS LAST')) .map(&:member) end diff --git a/spec/features/member_feedback_spec.rb b/spec/features/member_feedback_spec.rb index 396df814a..783eaf8ed 100644 --- a/spec/features/member_feedback_spec.rb +++ b/spec/features/member_feedback_spec.rb @@ -57,6 +57,25 @@ expect(page).to have_select('feedback_coach_id', with_options: [coach_not_yet_verified.full_name]) end + scenario 'I can see coaches who were invited but never RSVPed (Issue #2633)' do + # This reproduces the real-world scenario where: + # 1. Coach is invited to workshop but never responds (attending = nil) + # 2. Coach shows up anyway + # 3. Organizer hasn't yet marked attendance (attended = nil) + # 4. Student receives feedback form and should still be able to select the coach + walk_in_coach = Fabricate(:coach) + Fabricate(:coach_workshop_invitation, + workshop: feedback_request.workshop, + member: walk_in_coach, + attending: nil, + attended: nil) + + visit feedback_path(valid_token) + + # Coach should appear in the list even though they never RSVPed + expect(page).to have_select('feedback_coach_id', with_options: [walk_in_coach.full_name]) + end + scenario 'verified coaches appear before unverified coaches in the list' do # Create two coaches: one verified (attended=true), one not yet (attended=nil) verified_coach = Fabricate(:coach, name: 'Alice', surname: 'Verified')