Merge branches 'dev_aliyun', 'dev_new_shixunsrepository' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_new_shixunsrepository
commit
96d2bdf953
@ -0,0 +1,20 @@
|
|||||||
|
class ModifyCourseGroupForCourses < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
groups = CourseGroup.where(course_id:3429).order("created_at desc").group(:name)
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
groups.each do |g|
|
||||||
|
CourseGroup.where(name: g.name).where.not(id: g.id).each do |cg|
|
||||||
|
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)
|
||||||
|
cg.homework_group_settings.update_all(course_group_id: g.id)
|
||||||
|
cg.teacher_course_groups.update_all(course_group_id: g.id)
|
||||||
|
cg.destroy!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 3.6 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 375 KiB After Width: | Height: | Size: 381 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue