dev_newshixunModel
p31729568 5 years ago
parent 51e3325fee
commit 2434161fbd

@ -4,7 +4,7 @@ class Ecs::SubitemSupportStandardsController < Ecs::BaseController
def show
@graduation_standards = EcGraduationStandard.all
@graduation_subitems = current_year.ec_graduation_subitems
@graduation_subitems = current_year.ec_graduation_subitems.includes(:ec_graduation_requirement)
ids = @graduation_subitems.map(&:id)
@subitem_support_standards = EcRequireSubVsStandard.where(ec_graduation_subitem_id: ids, status: true)
@ -36,18 +36,18 @@ class Ecs::SubitemSupportStandardsController < Ecs::BaseController
private
def check_record_exists!
unless current_year.ec_graduation_subitems.exists?(id: params[:graduation_subitem_id])
unless current_year.ec_graduation_subitems.exists?(id: params[:ec_graduation_subitem_id])
render_not_found
return
end
unless EcGraduationStandard.exists?(id: params[:graduation_standard_id])
unless EcGraduationStandard.exists?(id: params[:ec_graduation_standard_id])
render_not_found
return
end
end
def permit_params
params.require(%i[graduation_subitem_id graduation_standard_id])
params.permit(%i[ec_graduation_subitem_id ec_graduation_standard_id])
end
end

@ -1,4 +1,9 @@
json.graduation_standards @graduation_standards, partial: 'ecs/shared/ec_graduation_standard', as: :ec_graduation_standard
json.graduation_subitems @graduation_subitems, partial: 'ecs/shared/ec_graduation_subitem', as: :ec_graduation_subitem
json.graduation_subitems do
json.array! @graduation_subitems do |graduation_subitem|
json.partial! 'ecs/shared/ec_graduation_subitem', ec_graduation_subitem: graduation_subitem
json.graduation_requirement_position graduation_subitem.ec_graduation_requirement.position
end
end
json.subitem_support_standards @subitem_support_standards, partial: 'ecs/subitem_support_standards/shared/subitem_support_standard', as: :subitem_support_standard

Loading…
Cancel
Save