|
|
@ -208,7 +208,7 @@ namespace :migrate_course_resource do
|
|
|
|
end
|
|
|
|
end
|
|
|
|
new_user_ids = []
|
|
|
|
new_user_ids = []
|
|
|
|
group.course_members.where(role: 4).each do |member|
|
|
|
|
group.course_members.where(role: 4).each do |member|
|
|
|
|
new_member = target_course.course_members.find_by(user_id: member.user_id)
|
|
|
|
new_member = target_course.students.find_by(user_id: member.user_id)
|
|
|
|
if new_member.present?
|
|
|
|
if new_member.present?
|
|
|
|
new_member.update_column("course_group_id", new_group.id)
|
|
|
|
new_member.update_column("course_group_id", new_group.id)
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -227,6 +227,18 @@ namespace :migrate_course_resource do
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
user_ids = []
|
|
|
|
|
|
|
|
source_course.students.where(course_group_id: 0).each do |member|
|
|
|
|
|
|
|
|
new_member = target_course.students.find_by(user_id: member.user_id)
|
|
|
|
|
|
|
|
if new_member.present?
|
|
|
|
|
|
|
|
new_member.update_column("course_group_id", 0)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
CourseMember.create!(course_id: target_course.id, course_group_id: 0, user_id: member.user_id, role: member.role)
|
|
|
|
|
|
|
|
user_ids << member.user_id
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
CourseAddStudentCreateWorksJob.perform_later(target_course.id, user_ids) unless user_ids.blank?
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|