新增参数output input
This commit is contained in:
parent
4e6a534371
commit
51098f3482
|
@ -84,7 +84,7 @@ class ChallengesController < ApplicationController
|
|||
next_challenge = @challenge.next_challenge
|
||||
position = @challenge.position
|
||||
@challenge.update_attribute(:position, (position + 1))
|
||||
next_challenge.update_attribute(:position, position - 1)
|
||||
next_challenge.update_attribute(:position, next_challenge.position - 1)
|
||||
end
|
||||
|
||||
def index_up
|
||||
|
|
|
@ -51,15 +51,15 @@ class GamesController < ApplicationController
|
|||
output = {}
|
||||
test_sets = @game.test_sets
|
||||
unless test_sets.blank?
|
||||
test_sets.each do |test_set|
|
||||
input.store("input",test_set.try(:input))
|
||||
output.store("output",test_set.try(:input))
|
||||
test_sets.each_with_index do |test_set, index|
|
||||
input.store("input_#{index}",test_set.try(:input))
|
||||
output.store("output_#{index}",test_set.try(:output))
|
||||
end
|
||||
end
|
||||
|
||||
step = @game.stage
|
||||
if @game.status == 0
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}" }
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}", :input => input, :output => output }
|
||||
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
|
||||
res = uri_exec uri, params
|
||||
@game.update_attribute(:status, 1)
|
||||
|
|
|
@ -14,12 +14,10 @@ class MyshixunsController < ApplicationController
|
|||
outPut = params[:outPut]
|
||||
message = Base64.decode64(params[:msg]) unless params[:msg].blank?
|
||||
game = Game.find(task_id)
|
||||
return if game.status == 1
|
||||
if game.status == 0
|
||||
game.update_attribute(:status, 2)
|
||||
message = nil
|
||||
else
|
||||
# 失败的时候可以继续提交
|
||||
game.update_attribute(:status, 0)
|
||||
end
|
||||
game_outputs = GameOutputs.create(:code => status, :msg => message, :game_id => task_id, :out_put => outPut)
|
||||
|
|
Loading…
Reference in New Issue