|
|
|
@ -165,7 +165,7 @@ class Course < ApplicationRecord
|
|
|
|
|
all_course_module_types.each do |type|
|
|
|
|
|
hidden_value = course_module_types.include?(type) ? 0 : 1
|
|
|
|
|
|
|
|
|
|
course_module = get_course_module_by_type(type, self.id)
|
|
|
|
|
course_module = course_modules.where(module_type: type).first
|
|
|
|
|
course_module.update_attribute(:hidden, hidden_value) if course_module.present?
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -174,8 +174,9 @@ class Course < ApplicationRecord
|
|
|
|
|
%w[activity shixun_homework common_homework group_homework graduation exercise poll attachment board course_group]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_course_module_by_type(type, course_id)
|
|
|
|
|
CourseModule.where(course_id: course_id, module_type: type).first
|
|
|
|
|
def get_course_module_by_type(type)
|
|
|
|
|
#CourseModule.where(course_id: course_id, module_type: type).first
|
|
|
|
|
self.course_modules.where(module_type: type).first
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 创建课程讨论区
|
|
|
|
|