diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a180130f4..0dc8829da 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -426,7 +426,7 @@ class CoursesController < ApplicationController active_student_exist = CourseMember.where(user_id: user[:user_id], role: 4, course_id: @course.id, is_active: 1).any? is_active = active_student_exist ? 0 : 1 user_id = User.find(user[:user_id]).id - existing_teacher = CourseMember.find_by(course_id: @course.id, user_id: user_id, role: role) + existing_teacher = CourseMember.find_by(course_id: @course.id, user_id: user_id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR]) if existing_teacher.blank? teacher_ids << user_id member = CourseMember.create(course_id: @course.id, graduation_group_id: @graduation_group_id, user_id: user_id, role: role, is_active: is_active)