dev_new_shixunsrepository
daiao 5 years ago
parent 4bb08755b6
commit b1ca2286a1

@ -4,7 +4,9 @@ class ModifyCourseGroupForCourses < ActiveRecord::Migration[5.2]
ActiveRecord::Base.transaction do
groups.each do |g|
CourseGroup.where(name: g.name).where.not(id: g.id).each do |cg|
cg.course_members.update_all(course_group_id: g.id)
cg.course_members.each do |cm|
cm.update_attributes!(course_group_id: g.id)
end
cg.exercise_group_settings.update_all(course_group_id: g.id)
cg.attachment_group_settings.update_all(course_group_id: g.id)
cg.homework_group_reviews.update_all(course_group_id: g.id)
Loading…
Cancel
Save