fork实训同步复制参考答案

dev_forum
daiao 5 years ago
parent 74e613e804
commit 09a2eca618

@ -203,6 +203,13 @@ class ShixunsController < ApplicationController
new_challenge.user_id = User.current.id new_challenge.user_id = User.current.id
new_challenge.shixun_id = @new_shixun.id new_challenge.shixun_id = @new_shixun.id
new_challenge.save! new_challenge.save!
# 同步参考答案
challenge.challenge_answers.each do |answer|
new_answer = Challenge.new
new_answer = answer.attributes.dup.except("id","challenge_id")
new_answer.challenge_id = new_challenge.id
new_answer.save!
end
if challenge.st == 0 # 评测题 if challenge.st == 0 # 评测题
# 同步测试集 # 同步测试集
if challenge.test_sets.present? if challenge.test_sets.present?

Loading…
Cancel
Save