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) %> |
diff --git a/db/migrate/20140722024513_update_course_attachment.rb b/db/migrate/20140722024513_update_course_attachment.rb
new file mode 100644
index 000000000..6b0372b5b
--- /dev/null
+++ b/db/migrate/20140722024513_update_course_attachment.rb
@@ -0,0 +1,20 @@
+class UpdateCourseAttachment < ActiveRecord::Migration
+ # 更新课程资源类型
+ def up
+ Attachment.all.each do |attachment|
+ if attachment.container_type == 'Course'
+ if attachment.attachtype == 1
+ attachment.attachtype = 4
+ elsif attachment.attachtype == 2
+ attachment.attachtype = 5
+ elsif attachment.attachtype == 3
+ attachment.attachtype = 6
+ end
+ attachment.save
+ end
+ end
+ end
+
+ def down
+ end
+end
|