You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/ecs/course_targets_controller.rb

30 lines
955 B

class Ecs::CourseTargetsController < Ecs::CourseBaseController
def index
@course_targets = current_course.ec_course_targets.includes(:ec_graduation_subitems)
respond_to do |format|
format.json
format.xlsx do
filename = "#{current_year.year}届_#{current_course.name}_课程目标_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx"
render xlsx: 'index', filename: filename
end
end
end
def create
Ecs::CreateCourseTargetsService.call(current_course, create_params)
@course_targets = current_course.ec_course_targets.includes(:ec_graduation_subitems)
render 'index'
end
def with_achievement_methods
@course_targets = current_course.ec_course_targets.includes(:ec_graduation_subitems, :ec_course_achievement_methods)
end
private
def create_params
params.permit(course_targets: %i[id content standard_grade weight graduation_subitem_id])
end
end