附件调整

dev_forum
cxt 5 years ago
parent 23baa07b3d
commit 008518e47f

@ -1593,10 +1593,11 @@ class HomeworkCommonsController < ApplicationController
homework_bank.max_num = homework.homework_detail_group.max_num homework_bank.max_num = homework.homework_detail_group.max_num
homework_bank.base_on_project = homework.homework_detail_group.base_on_project homework_bank.base_on_project = homework.homework_detail_group.base_on_project
end end
homework.attachments.where("attachtype != 2 and attachtype is null").each do |attachment| homework.attachments.each do |attachment|
att = attachment.copy att = attachment.copy
att.author_id = homework_bank.user_id att.author_id = homework_bank.user_id
att.copy_from = attachment.id att.copy_from = attachment.id
att.attachtype = attachment.attachtype
homework_bank.attachments << att homework_bank.attachments << att
end end
homework_bank homework_bank

@ -154,7 +154,8 @@ class QuestionBanksController < ApplicationController
att.container_id = nil att.container_id = nil
att.container_type = nil att.container_type = nil
att.author_id = homework.user_id att.author_id = homework.user_id
att.attachtype = 1 att.attachtype = attachment.attachtype
# att.attachtype = 1
att.copy_from = attachment.id att.copy_from = attachment.id
att.save! att.save!
new_homework.attachments << att new_homework.attachments << att

Loading…
Cancel
Save