【OJ】调试输出和提交记录中执行结果输出内容没有换行 高

dev_aliyun
daiao 5 years ago
parent 28b030d4f7
commit ef4ddf753c

@ -33,6 +33,12 @@ module ApplicationHelper
Base64.urlsafe_encode64(content) Base64.urlsafe_encode64(content)
end end
# 替换换行和tab键
def regexp_msg content
return nil if content.blank?
content.gsub(/\n/, '<br/>').gsub(/\t/, "&nbsp\;&nbsp\;&nbsp\;&nbsp\;&nbsp\;&nbsp\;&nbsp\;&nbsp\;")
end
def graduation_navigation graduation def graduation_navigation graduation
graduation.class.to_s == "GraduationTopic" ? "毕设选题" : "毕设任务" graduation.class.to_s == "GraduationTopic" ? "毕设选题" : "毕设任务"
end end

@ -1,8 +1,9 @@
json.status 0 json.status 0
json.message "返回成功" json.message "返回成功"
json.data do json.data do
json.(@hack_user, :id, :status, :error_line, :error_msg, :expected_output, json.(@hack_user, :id, :status, :error_line, :expected_output,
:input, :output, :execute_time, :execute_memory, :created_at, :code) :input, :output, :execute_time, :execute_memory, :created_at, :code)
json.error_msg regexp_msg(@hack_user.error_msg)
json.language @hack_user.language json.language @hack_user.language
json.name @hack_user.hack.name json.name @hack_user.hack.name
json.myproblem_identifier @my_hack.identifier json.myproblem_identifier @my_hack.identifier

@ -3,6 +3,7 @@ json.message "评测完成"
json.data do json.data do
json.(@result, :id, :status, :error_line, :error_msg, json.(@result, :id, :status, :error_line, :error_msg,
:input, :output, :execute_time, :execute_memory) :input, :output, :execute_time, :execute_memory)
json.error_msg regexp_msg(@result.error_msg)
json.passed @my_hack.passed json.passed @my_hack.passed
# 提交模式多了一个预计输出 # 提交模式多了一个预计输出
if @mode == "submit" if @mode == "submit"

Loading…
Cancel
Save