educoder/app/views/challenges/edit.json.jbuilder

23 lines
807 B

6 years ago
json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier
json.chooses do
json.array! @chooses do |choose|
json.choose_id choose.id
json.type choose.category
end
end
if @tab == 0
# 本关任务tab的编辑模式
json.(@challenge, :id, :subject, :task_pass, :difficulty, :score)
json.tags @challenge.challenge_tags.map(&:name)
elsif @tab == 1
# 评测设置的编辑模式
json.(@challenge, :id, :path, :exec_path, :show_type, :original_picture_path, :expect_picture_path, :picture_path,
:web_route, :test_set_score, :test_set_average)
json.test_sets @challenge.test_sets do |set|
json.hidden (set.is_public ? 0 : 1)
json.(set, :input, :output, :score)
end
elsif @tab == 2
# 参考答案
json.(@challenge, :answer)
end