Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_video
cxt 5 years ago
commit 07c9b5be7b

@ -23,6 +23,8 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名 # 所有请求必须合法签名
def check_sign def check_sign
uid_logger("educoder_session is #{cookies[:_educoder_session]}")
uid_logger("autologin trustie is #{cookies[:autologin_trustie]}")
uid_logger("check sign start: session[:user_id] is #{session[:user_id]}") uid_logger("check sign start: session[:user_id] is #{session[:user_id]}")
uid_logger("check sign start: default_yun_session is #{default_yun_session}, session[:current_user_id] is #{session[:"#{default_yun_session}"]}") uid_logger("check sign start: default_yun_session is #{default_yun_session}, session[:current_user_id] is #{session[:"#{default_yun_session}"]}")
if !Rails.env.development? if !Rails.env.development?
@ -222,7 +224,7 @@ class ApplicationController < ActionController::Base
# 未授权的捕捉407弹试用申请弹框 # 未授权的捕捉407弹试用申请弹框
def require_login def require_login
#6.13 -hs #6.13 -hs
tip_exception(401, "..") unless User.current.logged? tip_exception(401, "请登录后再操作") unless User.current.logged?
end end
# 异常提醒 # 异常提醒

@ -181,7 +181,7 @@ class ChallengesController < ApplicationController
begin begin
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
tab = params[:tab].to_i tab = params[:tab].to_i
@challenge.update_attributes(challenge_params) @challenge.update_attributes!(challenge_params)
if tab == 0 && @challenge.st == 0 if tab == 0 && @challenge.st == 0
@challenge.challenge_tags.delete_all @challenge.challenge_tags.delete_all
if params[:challenge_tag].present? if params[:challenge_tag].present?
@ -211,7 +211,7 @@ class ChallengesController < ApplicationController
# last 末尾匹配, full: 全完匹配 # last 末尾匹配, full: 全完匹配
logger.info("set: #{set}; match_rule : #{set[:match_rule]}") logger.info("set: #{set}; match_rule : #{set[:match_rule]}")
match_rule = set[:match_rule] == 'last' ? 'last' : 'full' match_rule = set[:match_rule] == 'last' ? 'last' : 'full'
TestSet.create(:challenge_id => @challenge.id, TestSet.create!(:challenge_id => @challenge.id,
:input => "#{set[:input]}", :input => "#{set[:input]}",
:output => "#{set[:output]}", :output => "#{set[:output]}",
:is_public => params_hidden[index], :is_public => params_hidden[index],
@ -237,9 +237,9 @@ class ChallengesController < ApplicationController
end end
end end
rescue => e rescue Exception => e
logger_error("##update_challenges: ##{e.message}") logger.error("##update_challenges: ##{e.message}")
tip_exception("更新失败!") tip_exception("#{e.message}")
end end
end end
@ -262,7 +262,7 @@ class ChallengesController < ApplicationController
params[:challenge_answer].each_with_index do |answer, index| params[:challenge_answer].each_with_index do |answer, index|
# 内容为空不保存 # 内容为空不保存
next if answer[:contents].blank? next if answer[:contents].blank?
ChallengeAnswer.create(name: answer[:name], contents: answer[:contents], ChallengeAnswer.create!(name: answer[:name], contents: answer[:contents],
level: index+1, score: answer[:score], challenge_id: @challenge.id) level: index+1, score: answer[:score], challenge_id: @challenge.id)
end end
end end

@ -3,7 +3,7 @@ class ChallengeAnswer < ApplicationRecord
belongs_to :challenge belongs_to :challenge
has_many :game_answers, :dependent => :destroy has_many :game_answers, :dependent => :destroy
validates :contents, length: { maximum: 5000 , too_long: "不能超过5000个字符"} validates :contents, length: { maximum: 25000 , too_long: "不能超过25000个字符"}
def view_answer_time(user_id) def view_answer_time(user_id)
game_answers.where(user_id: user_id).last&.view_time game_answers.where(user_id: user_id).last&.view_time

@ -1,7 +1,7 @@
class TestSet < ApplicationRecord class TestSet < ApplicationRecord
# match_rule: 匹配规则: full 完全匹配, last 末尾匹配 # match_rule: 匹配规则: full 完全匹配, last 末尾匹配
# #
validates :input, length: { maximum: 5000, too_long: "不能超过5000个字符" } validates :input, length: { maximum: 65000, too_long: "不能超过65000个字符" }
validates :output, length: { maximum: 5000, too_long: "不能超过5000个字符" } validates :output, length: { maximum: 65000, too_long: "不能超过65000个字符" }
end end

@ -1,2 +1,2 @@
$('.admin-modal-container').html("<%= j( render partial: 'admins/repertoires/shared/edit_repertoire_modal', locals: { repertoire: @repertoire } ) %>"); $('.admin-modal-container').html("<%= j( render partial: 'admins/repertoires/shared/edit_repertoire_modal', locals: { repertoire: @repertoire } ) %>");
$('.modal.admin-edit-repertoires-modal').modal('show'); $('.modal.admin-edit-repertoire-modal').modal('show');
Loading…
Cancel
Save