From d9b9b2152f9076ec66e41be04baa0b306d6a487b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 22 Jul 2014 09:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=99=E5=B8=88=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E7=94=A8=E6=88=B7=E6=89=93=E5=8C=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=89=80=E6=9C=89=E4=BD=9C=E4=B8=9A=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 4 +++- app/views/bids/_homework_list.html.erb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 777c0d8b7..653400cbe 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -75,7 +75,9 @@ class ZipdownController < ApplicationController # 得到每一个人所有文件打包的zip文件 # 并将每一个人的zip打包为一个并返回路径 user_zip_paths = homeattaches.map do |homeattach| - zip_homework_by_user homeattach + if homeattach.attachments.count > 0 + zip_homework_by_user homeattach + end end zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 81c960781..b58f918df 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -8,7 +8,7 @@
<%= l(:label_task_plural)%>(<%= @homework_list.count%>) - <%#= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(is_teacher) %> + <%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(is_teacher && @bid.homeworks.count > 0) %>