限制参考答案大小:

dev_video
daiao 5 years ago
parent 074470638b
commit a287dba412

@ -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
# 异常提醒

@ -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],

@ -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

Loading…
Cancel
Save