|
|
@ -36,7 +36,7 @@ class Admins::ImportCourseMemberService < ApplicationService
|
|
|
|
|
|
|
|
|
|
|
|
member = course.course_members.find_by(user_id: user.id, role: data.role.to_i)
|
|
|
|
member = course.course_members.find_by(user_id: user.id, role: data.role.to_i)
|
|
|
|
# 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班
|
|
|
|
# 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班
|
|
|
|
if member.present? && member.role == :STUDENT && course_group && member.course_group_id != course_group&.id
|
|
|
|
if member.present? && member.role == 'STUDENT' && course_group && member.course_group_id != course_group&.id
|
|
|
|
member.update!(course_group_id: course_group&.id)
|
|
|
|
member.update!(course_group_id: course_group&.id)
|
|
|
|
elsif member.blank?
|
|
|
|
elsif member.blank?
|
|
|
|
course.course_members.create!(user_id: user.id, role: data.role.to_i, course_group_id: course_group&.id)
|
|
|
|
course.course_members.create!(user_id: user.id, role: data.role.to_i, course_group_id: course_group&.id)
|
|
|
|