diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 8fab8dad3..8e489df1b 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1593,7 +1593,7 @@ 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.each do |attachment| + homework.attachments.where("attachtype != 2 and attachtype is null").each do |attachment| att = attachment.copy att.author_id = homework_bank.user_id att.copy_from = attachment.id diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index 76600c6a2..58fa7a8d4 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -154,6 +154,7 @@ class QuestionBanksController < ApplicationController att.container_id = nil att.container_type = nil att.author_id = homework.user_id + att.attachtype = 1 att.copy_from = attachment.id att.save! new_homework.attachments << att