修改代码测试出错时的日志打印

This commit is contained in:
yuanke 2016-09-26 09:44:47 +08:00
parent b917541290
commit 2ac827c66f
1 changed files with 3 additions and 3 deletions

View File

@ -106,13 +106,13 @@ class StudentWorkController < ApplicationController
rescue Timeout::Error
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
logger.debug "program_test_ex user wait time = #{tUsedtime} 毫秒"
logger.info "program_test_ex user wait time = #{tUsedtime} 毫秒"
#status 0:答案正确 -5program_test_ex 函数出错 -4judge代码出错 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时
resultObj[:status] = -3
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id)
rescue => e
#-4 judge代码 出错
logger.debug "program_test_error #{e}"
logger.info "program_test_error #{e}"
resultObj[:status] = -4
tmpstatus = -4
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id)
@ -217,7 +217,7 @@ class StudentWorkController < ApplicationController
end
rescue
#-5 program_test_ex 函数出错
logger.debug "program_test_error 2"
logger.info "program_test_error 2"
resultObj[:status] = -5
tmpstatus = -5
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id)