From c08ee598e619c2ffb9b044962204f452ba96ee9c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 8 Mar 2020 20:16:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=88=87=E6=8D=A2=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hack_user_lastest_codes_controller.rb | 2 +- .../hack_user_lastest_codes/record_detail.json.jbuilder | 2 +- .../20200308121504_add_language_for_hack_user_codes.rb | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20200308121504_add_language_for_hack_user_codes.rb diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 748715d0e..3f5efb0ca 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -88,7 +88,7 @@ class HackUserLastestCodesController < ApplicationController # 只有编译出错时,才正则匹配错误行数 error_line= if ojEvaResult['status'] == "4" || ojEvaResult['status'] == "5" - regular_match_error_line ojEvaResult['outPut'], @my_hack.hack.language + regular_match_error_line ojEvaResult['outPut'], @hack.language end # debug 与submit 公用的参数 diff --git a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder index 18eb012a1..d05b6d799 100644 --- a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder +++ b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder @@ -3,7 +3,7 @@ json.message "返回成功" json.data do json.(@hack_user, :id, :status, :error_line, :error_msg, :expected_output, :input, :output, :execute_time, :execute_memory, :created_at, :code) - json.language @hack_user.hack.language + json.language @hack_user.language json.name @hack_user.hack.name json.myproblem_identifier @my_hack.identifier json.pass_sets_count @pass_set_count diff --git a/db/migrate/20200308121504_add_language_for_hack_user_codes.rb b/db/migrate/20200308121504_add_language_for_hack_user_codes.rb new file mode 100644 index 000000000..730191212 --- /dev/null +++ b/db/migrate/20200308121504_add_language_for_hack_user_codes.rb @@ -0,0 +1,5 @@ +class AddLanguageForHackUserCodes < ActiveRecord::Migration[5.2] + def change + add_column :hack_user_codes, :language, :string + end +end