课堂可以选用重复资源

dev_unstable^2
cxt 6 years ago
parent bdd5e39b0c
commit 87d1c055c9

@ -172,17 +172,17 @@ class FilesController < ApplicationController
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| @course.attachments.each do |att|
# @exist = false @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 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.created_on = Time.now
# att.save att.save
# @exist = true @exist = true
# break break
# end 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