|
|
|
@ -61,6 +61,8 @@ class HacksController < ApplicationController
|
|
|
|
|
hack_codes = hack.hack_codes.new(hack_code_params)
|
|
|
|
|
hack_codes.modify_time = Time.now
|
|
|
|
|
hack_codes.save!
|
|
|
|
|
new_item_params = item_params.merge({container: hack_codes, item_type: 'PROGRAM'})
|
|
|
|
|
ItemBank.create!(new_item_params)
|
|
|
|
|
end
|
|
|
|
|
render_ok({identifier: hack.identifier})
|
|
|
|
|
rescue Exception => e
|
|
|
|
@ -189,6 +191,10 @@ class HacksController < ApplicationController
|
|
|
|
|
params.require(:hack).permit(:name, :description, :difficult, :category, :open_or_not, :time_limit, :score, :sub_discipline_id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def item_params
|
|
|
|
|
params.require(:hack).permit(:name, :difficult, :sub_discipline_id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def hack_sets_params
|
|
|
|
|
params.permit(hack_sets: [:input, :output, :position])[:hack_sets]
|
|
|
|
|
end
|
|
|
|
|