|
|
|
@ -41,16 +41,18 @@ class HackUserLastestCodesController < ApplicationController
|
|
|
|
|
def listen_result
|
|
|
|
|
logger.info("###########listen_result:#{params}")
|
|
|
|
|
begin
|
|
|
|
|
msg = JSON.parse(params[:msg])
|
|
|
|
|
ojEvaResult = JSON.parse(params[:ojEvaResult])
|
|
|
|
|
testCase = ojEvaResult['testCase']
|
|
|
|
|
# 只有编译出错时,才正则匹配错误行数
|
|
|
|
|
error_line=
|
|
|
|
|
if params[:status] == "-4"
|
|
|
|
|
regular_match_error_line params[:outPut], @my_hack.hack.language
|
|
|
|
|
regular_match_error_line ojEvaResult['outPut'], @my_hack.hack.language
|
|
|
|
|
end
|
|
|
|
|
# debug 与submit 公用的参数
|
|
|
|
|
ds_params = {input: msg['input'], output: msg['output'], hack_id: @hack.id, user_id: @my_hack.user_id,
|
|
|
|
|
error_line: error_line, status: params[:status], error_msg: params[:outPut],
|
|
|
|
|
execute_time: params[:executeTime], execute_memory: params[:executeMem]}
|
|
|
|
|
ds_params = {input: testCase['input'], output: testCase['output'], hack_id: @hack.id,
|
|
|
|
|
user_id: @my_hack.user_id, error_line: error_line, status: ojEvaResult['status'],
|
|
|
|
|
error_msg: ojEvaResult[:outPut], execute_time: ojEvaResult['executeTime'],
|
|
|
|
|
execute_memory: ojEvaResult['executeMem']}
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
# debug模式与submit模式
|
|
|
|
|
if params[:execMode] == "debug"
|
|
|
|
|