修改当作业没有附件时老师能打包下载一个空包的问题
This commit is contained in:
parent
f1aca94a30
commit
edd68baa85
|
@ -21,7 +21,13 @@ class ZipdownController < ApplicationController
|
||||||
def assort
|
def assort
|
||||||
if params[:obj_class] == "Bid"
|
if params[:obj_class] == "Bid"
|
||||||
bid = Bid.find params[:obj_id]
|
bid = Bid.find params[:obj_id]
|
||||||
zipfile = zip_bid bid
|
file_count = 0
|
||||||
|
bid.homeworks.map { |homework| file_count += homework.attachments.count}
|
||||||
|
if file_count > 0
|
||||||
|
zipfile = zip_bid bid
|
||||||
|
else
|
||||||
|
render file: 'public/no_file_found.html'
|
||||||
|
end
|
||||||
else
|
else
|
||||||
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
|
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue