修改当作业没有附件时老师能打包下载一个空包的问题

This commit is contained in:
sw 2014-11-24 15:56:23 +08:00
parent f1aca94a30
commit edd68baa85
1 changed files with 7 additions and 1 deletions

View File

@ -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