|
|
|
@ -73,7 +73,7 @@ class WelcomeController < ApplicationController
|
|
|
|
|
if shixun.challenges.present?
|
|
|
|
|
shixun.challenges.each do |challenge|
|
|
|
|
|
new_challenge = LocalChallenge.new
|
|
|
|
|
new_challenge.attributes = challenge.attributes.dup.except("id","shixun_id","user_id")
|
|
|
|
|
new_challenge.attributes = challenge.attributes.dup.except("id","shixun_id","user_id", "test_set_score")
|
|
|
|
|
new_challenge.local_shixun_id = local_shixun.id
|
|
|
|
|
new_challenge.save!
|
|
|
|
|
# 评测题,选择题暂时不考虑
|
|
|
|
@ -109,6 +109,7 @@ class WelcomeController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def local_to_shixun
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
shixun_list = []
|
|
|
|
|
LocalShixun.find_each do |local_shixun|
|
|
|
|
|
identifier = generate_identifier
|
|
|
|
|
shixun = Shixun.create!(name: local_shixun.name, description: local_shixun.description, user_id: User.current.id,
|
|
|
|
@ -177,8 +178,9 @@ class WelcomeController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
render :json => {status: 0, message: "success", identifier: shixun.identifier}
|
|
|
|
|
shixun_list << shixun.identifier
|
|
|
|
|
end
|
|
|
|
|
render :json => {status: 0, message: "success", identifier: shixun_list}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|