diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 90d809c06..ada29ed95 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -8,6 +8,7 @@ class MyshixunsController < ApplicationController # params [:stauts] 0 表示成功,其它则失败 # msg 错误信息 # output 为测试用户编译输出结果 + # myshixun:status 1为完成实训 def training_task_status status = params[:status].to_i task_id = params[:taskId] diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 97e906bd7..e18fbae05 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -36,12 +36,14 @@ class ShixunsController < ApplicationController s.sync_user(User.current) end gshixun = g.fork(@shixun.gpid, User.current.gid) - myshixun = copy_myshixun(@shixun, gshixun) - challenges = @shixun.challenges - render_404 if challenges.blank? - challenges.each_with_index do |challenge, index| - publish_games(challenge, myshixun.id, index) + if gshixun.id + myshixun = copy_myshixun(@shixun, gshixun) + challenges = @shixun.challenges + challenges.each_with_index do |challenge, index| + publish_games(challenge, myshixun.id, index) + end end + respond_to do |format| format.html{redirect_to myshixun_path(myshixun)} end @@ -196,11 +198,11 @@ class ShixunsController < ApplicationController myshixun.user_id = User.current.id myshixun.gpid = gshixun.id myshixun.forked_from = tpm_shixun.id - + jenkins_shixuns = Redmine::Configuration['jenkins_shixuns'] if myshixun.save m = MyshixunMember.new(:user_id => User.current.id, :role => 1) myshixun.myshixun_members << m - uri = URI("http://123.59.135.74:9999/jenkins-exec/api/createJob") + uri = URI("#{jenkins_shixuns}/jenkins-exec/api/createJob") pipeLine = "#{Base64.encode64(tpm_shixun.script)}" params = {jobName: "myshixun_#{myshixun.id}", pipeLine: pipeLine} res = uri_exec uri, params diff --git a/app/views/shixuns/_monitor_tip.html.erb b/app/views/shixuns/_monitor_tip.html.erb index d2a4566f8..d5fce4bc9 100644 --- a/app/views/shixuns/_monitor_tip.html.erb +++ b/app/views/shixuns/_monitor_tip.html.erb @@ -14,7 +14,7 @@ <% if @had_exec == true %> <%= link_to "确 定", myshixun_path(@tpm), :class => "task-btn task-btn-green fr", :onclick => "hideModal();", :target => "_blank" %> <% else %> - 确定 + 确定 <% end %>