同一个资源可以多次发送到课堂

dev_unstable^2
cxt 6 years ago
parent 6dd78b4ca9
commit ca93a672c7

@ -171,17 +171,18 @@ class FilesController < ApplicationController
begin begin
attachment_ids.each do |attachment_id| attachment_ids.each do |attachment_id|
ori = Attachment.find_by_id(attachment_id) ori = Attachment.find_by_id(attachment_id)
@course.attachments.each do |att| # 同一个资源可以多次发送到课堂
@exist = false # @course.attachments.each do |att|
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 # @exist = false
att.created_on = Time.now # 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.save # att.created_on = Time.now
@exist = true # att.save
break # @exist = true
end # break
end # end
# end
next if @exist #
# next if @exist
attach_copied_obj = ori.copy attach_copied_obj = ori.copy
attach_copied_obj.container = @course attach_copied_obj.container = @course
attach_copied_obj.created_on = Time.now attach_copied_obj.created_on = Time.now

Loading…
Cancel
Save