From ddad27c9144835258baa9cd623c3e38d98317a8b Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 17 Jun 2026 19:01:00 +0800 Subject: [PATCH] fix: fixed the supervisor_enrolment in update projects where it only finds by lecturer_enrolment_ids NO COORDINATOR ENROLMENT IDS PLEASE --- app/controllers/projects_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index fb41f563..a27874b4 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -316,13 +316,15 @@ def update if topic raise StandardError, 'Topic has no valid owner' unless topic.owner.is_a?(User) - supervisor_enrolment = Enrolment.find_by(user_id: topic.owner.id, course_id: @course.id, role: %i[lecturer coordinator]) + # DO NOT FIND BY COORDINATOR_ENROLMENT_IDS + supervisor_enrolment = Enrolment.find_by(user_id: topic.owner.id, course_id: @course.id, role: :lecturer) raise StandardError, 'Could not find supervisor enrolment' unless supervisor_enrolment @instance.update!(source_topic: topic, supervisor_enrolment: supervisor_enrolment) else - supervisor_enrolment = Enrolment.find_by(id: lecturer_id, course_id: @course.id, role: %i[lecturer coordinator]) + # DO NOT FIND BY COORDINATOR_ENROLMENT_IDS + supervisor_enrolment = Enrolment.find_by(id: lecturer_id, course_id: @course.id, role: :lecturer) raise StandardError, 'Could not find supervisor enrolment' unless supervisor_enrolment