开启实训的时候数据一致性
This commit is contained in:
parent
37870ed0a6
commit
69d35b347d
|
@ -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]
|
||||
|
|
|
@ -36,12 +36,14 @@ class ShixunsController < ApplicationController
|
|||
s.sync_user(User.current)
|
||||
end
|
||||
gshixun = g.fork(@shixun.gpid, User.current.gid)
|
||||
if gshixun.id
|
||||
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)
|
||||
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
|
||||
|
|
|
@ -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 %>
|
||||
<a href="<%= shixun_exec_shixun_path(@shixun) %>" class="task-btn task-btn-green fr" onclick="hideModal();">确定</a>
|
||||
<a href="<%= shixun_exec_shixun_path(@shixun) %>" class="task-btn task-btn-green fr" onclick="hideModal();" target="_blank">确定</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue