Merge remote-tracking branch 'origin/dev_local' into dev_local

dev_local
杨树明 6 years ago
commit 0ec3538d54

@ -509,6 +509,7 @@ class MyshixunsController < ApplicationController
game.update_column(:picture_path, pics)
end
logger.info("training_task_status start#2**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
test_set_score = 0
unless jenkins_testsets.blank?
jenkins_testsets.each_with_index do |j_test_set, i|
logger.info("j_test_set: ############## #{j_test_set}")
@ -518,6 +519,10 @@ class MyshixunsController < ApplicationController
Output.create!(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index,
:compile_success => compile_success.to_i)
# 如果设置了按测试集给分,则需要统计测试集的分值
if challenge.test_set_score && j_test_set['passed'].to_i == 1
test_set_score += challenge.test_sets.where(:position => j_test_set['caseId']).pluck(:score).first
end
end
end
logger.info("#############status: #{status}")
@ -557,7 +562,8 @@ class MyshixunsController < ApplicationController
if !resubmit.blank?
game.update_attributes!(:retry_status => 1, :resubmit_identifier => resubmit)
else
game.update_attributes!(:status => 0)
score = ((challenge.score * test_set_score) / 100.to_f).to_i
game.update_attributes!(:status => 0, :final_score => score)
end
end
test_cases_time = format("%.3f", (Time.now.to_f - t1.to_f)).to_f

@ -1,7 +1,7 @@
class AddTestSetScoreForChallenges < ActiveRecord::Migration
def up
add_column :test_sets, :score, :integer
add_column :challenges, :test_set_score, :boolean, :default => false
#add_column :test_sets, :score, :integer
#add_column :challenges, :test_set_score, :boolean, :default => false
end
def down

Loading…
Cancel
Save