From ca93a672c7472c3869019384fa312675340f8679 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 27 Aug 2019 17:04:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E4=B8=80=E4=B8=AA=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=A4=9A=E6=AC=A1=E5=8F=91=E9=80=81=E5=88=B0?= =?UTF-8?q?=E8=AF=BE=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index a916f5351..791d145c2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -171,17 +171,18 @@ class FilesController < ApplicationController begin attachment_ids.each do |attachment_id| ori = Attachment.find_by_id(attachment_id) - @course.attachments.each do |att| - @exist = false - if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from - att.created_on = Time.now - att.save - @exist = true - break - end - end - - next if @exist + # 同一个资源可以多次发送到课堂 + # @course.attachments.each do |att| + # @exist = false + # if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from + # att.created_on = Time.now + # att.save + # @exist = true + # break + # end + # end + # + # next if @exist attach_copied_obj = ori.copy attach_copied_obj.container = @course attach_copied_obj.created_on = Time.now