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

This commit is contained in:
sw 2015-01-09 15:33:30 +08:00
parent c329d9f29e
commit 82c2a659df
1 changed files with 1 additions and 1 deletions

View File

@ -78,7 +78,7 @@ class ZipdownController < ApplicationController
# 需要将所有homework.attachments遍历加入zip
# 并且返回zip路径
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
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