#1209 修复老师打包下载报错的BUg
This commit is contained in:
parent
00278d8571
commit
3dca123b0f
|
@ -17,6 +17,7 @@ class ZipdownController < ApplicationController
|
|||
@project = obj.courses[0]
|
||||
end
|
||||
end
|
||||
|
||||
def assort
|
||||
obj_class = params[:obj_class]
|
||||
obj_id = params[:obj_id]
|
||||
|
@ -76,18 +77,18 @@ class ZipdownController < ApplicationController
|
|||
|
||||
homeattaches = bid.homeworks
|
||||
#记录所有作业是不是有附件,有一个附件就改为true
|
||||
has_file = false
|
||||
#has_file = false
|
||||
# 得到每一个人所有文件打包的zip文件
|
||||
# 并将每一个人的zip打包为一个并返回路径
|
||||
user_zip_paths = homeattaches.map do |homeattach|
|
||||
if homeattach.attachments.count > 0
|
||||
zip_homework_by_user homeattach
|
||||
has_file = true unless has_file
|
||||
#has_file = true unless has_file
|
||||
end
|
||||
end
|
||||
unless has_file
|
||||
render file: 'public/no_file_fond.html' , :layout => 'course_base'
|
||||
end
|
||||
#unless has_file
|
||||
# render file: 'public/no_file_fond.html' , :layout => 'course_base'
|
||||
#end
|
||||
zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
|
||||
|
||||
#@paths = homeworks_attach_path
|
||||
|
|
Loading…
Reference in New Issue