|
|
|
@ -6,7 +6,7 @@ class MigrateCoureGroupPosition < ActiveRecord::Migration[5.2]
|
|
|
|
|
courses = Course.where(id: course_ids)
|
|
|
|
|
|
|
|
|
|
courses.each do |course|
|
|
|
|
|
CourseGroup.where(coures_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index|
|
|
|
|
|
CourseGroup.where(course_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index|
|
|
|
|
|
group.update!(position: index+1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|