From fd158b9bf0f00a7d94c0cd38458c25210c4ec868 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 18:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index e2f5f7078..c21a493e0 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -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: 全完匹配