|
|
@ -387,6 +387,14 @@ class EcYearsController < ApplicationController
|
|
|
|
new_egs.save!
|
|
|
|
new_egs.save!
|
|
|
|
# 记录新旧对应关系,为之后的中间表做记录
|
|
|
|
# 记录新旧对应关系,为之后的中间表做记录
|
|
|
|
egs_record << [pre_egs.id, new_egs.id]
|
|
|
|
egs_record << [pre_egs.id, new_egs.id]
|
|
|
|
|
|
|
|
prev_ersvss = EcRequireSubVsStandard.where(:ec_graduation_subitem_id => pre_egs.id)
|
|
|
|
|
|
|
|
prev_ersvss.each do |prev_ersvs|
|
|
|
|
|
|
|
|
new_ersvss = EcRequireSubVsStandard.new
|
|
|
|
|
|
|
|
new_ersvss.attributes = prev_ersvs.attributes.dup.except("id", "ec_graduation_subitem_id")
|
|
|
|
|
|
|
|
new_ersvss.ec_graduation_subitem_id = new_egs.id
|
|
|
|
|
|
|
|
new_ersvss.save!
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -398,28 +406,29 @@ class EcYearsController < ApplicationController
|
|
|
|
new_eto.ec_year_id = ec_year.id
|
|
|
|
new_eto.ec_year_id = ec_year.id
|
|
|
|
new_eto.save!
|
|
|
|
new_eto.save!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 复制 "培养目标分项"
|
|
|
|
|
|
|
|
pre_eto.ec_training_subitems.try(:each) do |pre_ets|
|
|
|
|
|
|
|
|
new_ets = EcTrainingSubitem.new
|
|
|
|
|
|
|
|
new_ets.attributes = pre_ets.attributes.dup.except("id", "ec_training_objective_id")
|
|
|
|
|
|
|
|
new_ets.ec_training_objective_id = new_eto.id
|
|
|
|
|
|
|
|
new_ets.save!
|
|
|
|
|
|
|
|
|
|
|
|
# 复制 "毕业要去 vs 培养目标"
|
|
|
|
# 复制 "毕业要去 vs 培养目标"
|
|
|
|
pre_ervsos = EcRequirementVsObjective.where(:ec_training_objective_id => pre_eto.id)
|
|
|
|
pre_ervsos = EcRequirementVsObjective.where(:ec_training_objective_id => pre_ets.id)
|
|
|
|
pre_ervsos.each do |ervso|
|
|
|
|
pre_ervsos.each do |ervso|
|
|
|
|
new_ervso = EcRequirementVsObjective.new
|
|
|
|
new_ervso = EcRequirementVsObjective.new
|
|
|
|
new_ervso.attributes = ervso.attributes.dup.except("id", "ec_training_objective_id", "ec_graduation_requirement_id")
|
|
|
|
new_ervso.attributes = ervso.attributes.dup.except("id", "ec_training_objective_id", "ec_graduation_requirement_id")
|
|
|
|
new_ervso.ec_training_objective_id = new_eto.id
|
|
|
|
new_ervso.ec_training_objective_id = new_ets.id
|
|
|
|
new_egr_id = -1
|
|
|
|
new_egr_id = -1
|
|
|
|
egr_record.each do |egr_id|
|
|
|
|
egr_record.each do |egr_id|
|
|
|
|
if egr_id[0] == ervso.id
|
|
|
|
if egr_id[0] == ervso.ec_graduation_requirement_id
|
|
|
|
new_egr_id = egr_id[1]
|
|
|
|
new_egr_id = egr_id[1]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
raise("找不对应的毕业要求") if new_egr_id == -1
|
|
|
|
raise("找不对应的毕业要求") if new_egr_id == -1
|
|
|
|
new_ervso.ec_graduation_requirement_id = new_egr_id
|
|
|
|
new_ervso.ec_graduation_requirement_id = new_egr_id
|
|
|
|
|
|
|
|
new_ervso.save!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 复制 "培养目标分项"
|
|
|
|
|
|
|
|
pre_eto.ec_training_subitems.try(:each) do |pre_ets|
|
|
|
|
|
|
|
|
new_ets = EcTrainingSubitem.new
|
|
|
|
|
|
|
|
new_ets.attributes = pre_ets.attributes.dup.except("id", "ec_training_objective_id")
|
|
|
|
|
|
|
|
new_ets.ec_training_objective_id = new_eto.id
|
|
|
|
|
|
|
|
new_ets.save!
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|