分组作业选用题库附件找不到

dev_forum
daiao 5 years ago
parent 0d82cc7a2c
commit 86f872e627

@ -148,22 +148,21 @@ class QuestionBanksController < ApplicationController
end end
# 附件 # 附件
logger.info("######attachments: #{homework.attachments.count}") logger.info("######attachments: #{homework.attachments.count}")
homework.attachments.try(:each) do |attachment| if new_homework.save!
att = attachment.copy homework.attachments.try(:each) do |attachment|
att.container_id = nil att = attachment.copy
att.container_type = nil att.container_id = nil
att.author_id = homework.user_id att.container_type = nil
att.copy_from = attachment.id att.author_id = homework.user_id
att.save! att.copy_from = attachment.id
new_homework.attachments << att att.save!
end new_homework.attachments << att
logger.info("######new_homework.attachments: #{new_homework.attachments.count}") end
logger.info("######new_homework.attachments: #{new_homework.attachments.count}")
if new_homework.save
new_homework_detail_manual.save if new_homework_detail_manual new_homework_detail_manual.save if new_homework_detail_manual
new_homework.homework_detail_group.save if new_homework.homework_detail_group new_homework.homework_detail_group.save if new_homework.homework_detail_group
HomeworksService.new.create_works_list(new_homework, course) HomeworksService.new.create_works_list(new_homework, course)
homework.update_column(:quotes, homework.quotes+1) homework.update_column(:quotes, homework.quotes + 1)
end end
new_homework new_homework
end end

Loading…
Cancel
Save