From 7d1f7150f6633bf6f4ea2e9b9db5e31c27776d60 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 23 Jul 2019 21:40:16 +0800 Subject: [PATCH 1/2] .. --- app/controllers/shixuns_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index be4448a92..9edb6bb9d 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -830,8 +830,6 @@ private def is_shixun_reset?(games, min_challenges, current_myshixun) # 用户在申请发布之前,是否玩过实训 TODO: 重置的字段应该迁移到myshixuns表比较合适 modify_shixun = ShixunModify.exists?(:myshixun_id => current_myshixun.id, :shixun_id => @shixun.id, :status => 1) - games.size != min_challenges.size || - games.map(&:challenge_id) != min_challenges.map{|challenge| challenge.first} || - modify_shixun + games.size != min_challenges.size || modify_shixun end end From 008518e47ff8009151120aa5979bb0a4fc17fd06 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 23 Jul 2019 22:18:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=99=84=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 3 ++- app/controllers/question_banks_controller.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 8e489df1b..84ee9daf2 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1593,10 +1593,11 @@ class HomeworkCommonsController < ApplicationController homework_bank.max_num = homework.homework_detail_group.max_num homework_bank.base_on_project = homework.homework_detail_group.base_on_project end - homework.attachments.where("attachtype != 2 and attachtype is null").each do |attachment| + homework.attachments.each do |attachment| att = attachment.copy att.author_id = homework_bank.user_id att.copy_from = attachment.id + att.attachtype = attachment.attachtype homework_bank.attachments << att end homework_bank diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index 58fa7a8d4..5ff247729 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -154,7 +154,8 @@ class QuestionBanksController < ApplicationController att.container_id = nil att.container_type = nil att.author_id = homework.user_id - att.attachtype = 1 + att.attachtype = attachment.attachtype + # att.attachtype = 1 att.copy_from = attachment.id att.save! new_homework.attachments << att