rake任务调整

ecloud_sso
cxt 5 years ago
parent b42cbbd09b
commit 658f862a32

@ -208,7 +208,7 @@ namespace :migrate_course_resource do
end
new_user_ids = []
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?
new_member.update_column("course_group_id", new_group.id)
else
@ -227,6 +227,18 @@ namespace :migrate_course_resource do
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
Loading…
Cancel
Save