|
|
@ -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?
|
|
|
|
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
|
|
|
|
is_active = active_student_exist ? 0 : 1
|
|
|
|
user_id = User.find(user[:user_id]).id
|
|
|
|
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?
|
|
|
|
if existing_teacher.blank?
|
|
|
|
teacher_ids << user_id
|
|
|
|
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)
|
|
|
|
member = CourseMember.create(course_id: @course.id, graduation_group_id: @graduation_group_id, user_id: user_id, role: role, is_active: is_active)
|
|
|
|