diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index d7f9fa0ac..6cbe0dd95 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -21,7 +21,13 @@ class ZipdownController < ApplicationController def assort if params[:obj_class] == "Bid" 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 logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!" end