diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 7e2a53742..d197b6f9d 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -291,13 +291,13 @@ class ShixunsController < ApplicationController new_challenge.attributes = challenge.attributes.dup.except("id","shixun_id","user_id", "challenge_tags_count") new_challenge.user_id = User.current.id new_challenge.shixun_id = @new_shixun.id - new_challenge.save! + new_challenge.save!(validate: false) # 同步参考答案 challenge.challenge_answers.each do |answer| new_answer = ChallengeAnswer.new new_answer.attributes = answer.attributes.dup.except("id","challenge_id") new_answer.challenge_id = new_challenge.id - new_answer.save! + new_answer.save!(validate: false) end if challenge.st == 0 # 评测题 # 同步测试集 @@ -306,7 +306,7 @@ class ShixunsController < ApplicationController new_test_set = TestSet.new new_test_set.attributes = test_set.attributes.dup.except("id","challenge_id") new_test_set.challenge_id = new_challenge.id - new_test_set.save! + new_test_set.save!(validate: false) end end # 同步关卡标签