From 409c51bd911b6593c7b8c148ea73353b2207de8e Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 18 Jul 2019 17:29:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index cb31f2464..821c0df52 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -105,9 +105,11 @@ class MyshixunsController < ApplicationController resubmit = jsonTestDetails['resubmit'] outPut = tran_base64_decode64(jsonTestDetails['outPut']) # 资源消耗 - uid_logger("##########!!!!!!#{jsonTestDetails['resUsage']}") - max_mem = tran_base64_decode64(jsonTestDetails['resUsage']) if jsonTestDetails['resUsage'].present? - uid_logger("##########!!!!!!#{max_mem}") + if jsonTestDetails['resUsage'].present? + max_mem = tran_base64_decode64(jsonTestDetails['resUsage']).to_f + max_mem = format("%.3f", max_mem/1024/1024).to_f + end + jenkins_testsets = jsonTestDetails['msg'] compile_success = jsonTestDetails['compileSuccess'] # message = Base64.decode64(params[:msg]) unless params[:msg].blank? @@ -132,10 +134,11 @@ class MyshixunsController < ApplicationController # is_public = test_sets.where(:position => j_test_set['caseId']).first.try(:is_public) logger.info "actual_output:################################################# #{actual_output}" - ts_time = format("%.3f", j_test_set['testSetTime'].to_i).to_f + ts_time = format("%.2f", j_test_set['testSetTime'].to_f/1000000000).to_f + 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 => max_query_index, - :compile_success => compile_success.to_i, :sec_key => sec_key, :ts_time => j_test_set['testSetTime']) + :compile_success => compile_success.to_i, :sec_key => sec_key, :ts_time => ts_time) # 如果设置了按测试集给分,则需要统计测试集的分值 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 @@ -203,7 +206,7 @@ class MyshixunsController < ApplicationController test_cases_time = format("%.3f", (Time.now.to_f - t1.to_f)).to_f if record.present? consume_time = format("%.3f", (Time.now - record.created_at)).to_f - uid_logger("11122233334444#{max_mem}, #{sec_key}") + record.update_attributes!(:consume_time => consume_time, :git_pull => timeCost['pull'] , :create_pod => timeCost['createPod'], :pod_execute => timeCost['execute'], :test_cases => test_cases_time, :max_mem => max_mem, :brige => timeCost['evaluateAllTime'], :return_back => return_back_time)