dev_auth
cxt 5 years ago
parent f163bce982
commit 41fe90c77a

@ -196,7 +196,7 @@ class Course < ApplicationRecord
end end
def all_course_module_types def all_course_module_types
%w[activity announcement online_learning shixun_homework common_homework group_homework exercise attachment course_group graduation poll board] %w[activity announcement online_learning shixun_homework common_homework group_homework exercise attachment course_group graduation poll board statistics]
end end
def get_course_module_by_type(type) def get_course_module_by_type(type)
@ -386,6 +386,7 @@ class Course < ApplicationRecord
when 'attachment' then '资源' when 'attachment' then '资源'
when 'board' then '讨论' when 'board' then '讨论'
when 'course_group' then '分班' when 'course_group' then '分班'
when 'statistics' then '统计'
else '' else ''
end end
end end
@ -404,6 +405,7 @@ class Course < ApplicationRecord
when 'attachment' then 10 when 'attachment' then 10
when 'board' then 11 when 'board' then 11
when 'course_group' then 12 when 'course_group' then 12
when 'statistics' then 13
else 100 else 100
end end
end end

@ -0,0 +1,7 @@
class AddStatisticsToCourseModule < ActiveRecord::Migration[5.2]
def change
Course.includes(:course_modules).all.each do |course|
CourseModule.create!(course_id: course.id, module_type: "statistics", hidden:0, module_name: "统计", position: course.course_modules.pluck(:position).max + 1)
end
end
end
Loading…
Cancel
Save