修复当作业打包下载时,某一文件不存在时,跳过该文件继续下载其他的文件

zh
sw 11 years ago
parent c329d9f29e
commit 82c2a659df

@ -78,7 +78,7 @@ class ZipdownController < ApplicationController
# 需要将所有homework.attachments遍历加入zip # 需要将所有homework.attachments遍历加入zip
# 并且返回zip路径 # 并且返回zip路径
homeattach.attachments.each do |attach| homeattach.attachments.each do |attach|
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1) homeworks_attach_path << attach.diskfile if File.exist?(attach.diskfile)
end end
zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true) zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
end end

Loading…
Cancel
Save