diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index dcef4c35c..6fe167d93 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -71,8 +71,8 @@ class GamesController < ApplicationController end logger.info("#################################{@public_test_sets}") - error_position = test_sets.where(:result => false).order("position desc").first - @error_position = error_position.blank? ? 0 : error_position.try(:position).to_i + error_position = Output.where(:game_id => @game.id, :result => false).first + @error_position = error_position.blank? ? 0 : error_position.try(:test_set_id).to_i @passed_teststest = test_sets.where(:result => true).count @test_sets_count = test_sets.count (@myshixun.games.count == @game_challenge.position && @game.status ==2) ? @had_done = 1 : @had_done = 0 @@ -163,7 +163,8 @@ class GamesController < ApplicationController @private_test_sets = test_set_static_data(private_test_sets).blank? ? [] : test_set_static_data(private_test_sets) end latest_output = @game.latest_output.try(:out_put) - error_position = test_sets.where(:result => false).order("position desc").first.blank? ? 0 : error_position.try(:position).to_i + error_position = Output.where(:game_id => @game.id, :result => false).first + error_position = error_position.blank? ? 0 : error_position.try(:test_set_id).to_i passed_teststest = test_sets.where(:result => true).count test_sets_count = test_sets.count test_sets_hidden_count = private_test_sets.count diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index b32071a26..ec3ed5486 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -22,14 +22,14 @@ class MyshixunsController < ApplicationController # test_sets = challenge.test_sets unless jenkins_testsets.blank? jenkins_testsets.each do |j_test_set| - game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_id => j_test_set['caseId'], :expect_output => j_test_set['expectedOutput']) + expect_output = Base64.decode64(j_test_set['output']) unless j_test_set['output'].blank? + game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_id => j_test_set['caseId'], :expect_output => expect_output, :result => j_test_set['passed'].to_i) end end if status == "0" game.update_attribute(:status, 2) game.update_attribute(:final_score, challenge.score) else - game.update_attribute(:status, 0) end render :json => {:data => "success"} diff --git a/app/views/games/_game_results.html.erb b/app/views/games/_game_results.html.erb index 69db227e3..b0a8a9109 100644 --- a/app/views/games/_game_results.html.erb +++ b/app/views/games/_game_results.html.erb @@ -89,7 +89,7 @@