From a287dba412178e26719e26e30b3653ff6a25acc8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 31 Jan 2020 16:08:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=8F=82=E8=80=83=E7=AD=94?= =?UTF-8?q?=E6=A1=88=E5=A4=A7=E5=B0=8F=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/controllers/challenges_controller.rb | 4 ++-- app/models/test_set.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 49a344aaa..cb31067cb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -224,7 +224,7 @@ class ApplicationController < ActionController::Base # 未授权的捕捉407,弹试用申请弹框 def require_login #6.13 -hs - tip_exception(401, "..") unless User.current.logged? + tip_exception(401, "请登录后再操作") unless User.current.logged? end # 异常提醒 diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 29a5455ca..5f18a15a9 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -181,7 +181,7 @@ class ChallengesController < ApplicationController begin ActiveRecord::Base.transaction do tab = params[:tab].to_i - @challenge.update_attributes(challenge_params) + @challenge.update_attributes!(challenge_params) if tab == 0 && @challenge.st == 0 @challenge.challenge_tags.delete_all if params[:challenge_tag].present? @@ -211,7 +211,7 @@ class ChallengesController < ApplicationController # last: 末尾匹配, full: 全完匹配 logger.info("set: #{set}; match_rule : #{set[:match_rule]}") match_rule = set[:match_rule] == 'last' ? 'last' : 'full' - TestSet.create(:challenge_id => @challenge.id, + TestSet.create!(:challenge_id => @challenge.id, :input => "#{set[:input]}", :output => "#{set[:output]}", :is_public => params_hidden[index], diff --git a/app/models/test_set.rb b/app/models/test_set.rb index 01bc2b767..c0674cdf0 100644 --- a/app/models/test_set.rb +++ b/app/models/test_set.rb @@ -2,6 +2,6 @@ class TestSet < ApplicationRecord # match_rule: 匹配规则: full: 完全匹配, last: 末尾匹配 # validates :input, length: { maximum: 5000, too_long: "不能超过5000个字符" } - validates :output, length: { maximum: 5000, too_long: "不能超过5000个字符" } + validates :output, length: { maximum: 65000, too_long: "不能超过65000个字符" } end