Merge branch 'dev_aliyun' into dev_hjm_a

dev_cs_new
hjm 6 years ago
commit 42513e21e5

@ -38,7 +38,12 @@ class DuplicateCourseService < ApplicationService
def copy_course_modules!
origin_course.course_modules.each do |course_module|
attrs = course_module.as_json(only: %i[module_type position hidden module_name])
CourseModule.create!(attrs.merge(course_id: course.id))
new_course_module = CourseModule.create!(attrs.merge(course_id: course.id))
# 复制子目录
course_module.course_second_categories.each do |second_category|
category_attr = second_category.as_json(only: %i[category_type name position])
CourseSecondCategory.create!(category_attr.merge(course_id: course.id, course_module_id: new_course_module.id))
end
end
end

Loading…
Cancel
Save