|
|
|
@ -191,12 +191,15 @@ class ChallengesController < ApplicationController
|
|
|
|
|
sets_input = test_set.map(&:input)
|
|
|
|
|
sets_open = test_set.map(&:is_public)
|
|
|
|
|
set_score = test_set.map(&:score)
|
|
|
|
|
set_match_rule = test_set.map(&:match_rule)
|
|
|
|
|
params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0}
|
|
|
|
|
params_output = params[:test_set].map{|set| set[:output] }
|
|
|
|
|
params_input = params[:test_set].map{|set| set[:input] }
|
|
|
|
|
params_score = params[:test_set].map{|set| set[:score]}
|
|
|
|
|
params_test_set = params[:test_set].map{|set| set[:match_rule]}
|
|
|
|
|
# 测试集变化则需要更新(输入、 输出、 是否隐藏)
|
|
|
|
|
if sets_output != params_output || sets_open != params_hidden || sets_input != params_input || set_score != params_score
|
|
|
|
|
if sets_output != params_output || sets_open != params_hidden || sets_input != params_input ||
|
|
|
|
|
set_score != params_score || params_test_set != set_match_rule
|
|
|
|
|
test_set.delete_all unless test_set.blank?
|
|
|
|
|
params[:test_set].each_with_index do |set, index|
|
|
|
|
|
# last: 末尾匹配, full: 全完匹配
|
|
|
|
|