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.
28 lines
994 B
28 lines
994 B
class Ecs::GraduationCourseSupportsController < Ecs::BaseController
|
|
before_action :check_major_manager_permission!, only: [:create]
|
|
|
|
def show
|
|
@graduation_subitems = current_year.ec_graduation_subitems
|
|
.includes(:ec_graduation_requirement, ec_course_supports: :ec_course)
|
|
@course_count = current_year.ec_courses.count
|
|
|
|
respond_to do |format|
|
|
format.json
|
|
format.xlsx do
|
|
filename = "#{current_year.year}届课程体系对毕业要求的支撑_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx"
|
|
render xlsx: 'show', filename: filename
|
|
end
|
|
end
|
|
end
|
|
|
|
def create
|
|
graduation_subitem = current_year.ec_graduation_subitems.find(params[:graduation_subitem_id])
|
|
@graduation_subitem = Ecs::SaveGraduationCourseSupportsService.call(graduation_subitem, create_params)
|
|
end
|
|
|
|
private
|
|
|
|
def create_params
|
|
params.permit(course_supports: %i[id ec_course_id weights top_relation])
|
|
end
|
|
end |