socialforge/lib/tasks/zip.rake

19 lines
461 B
Ruby
Raw Normal View History

2017-01-06 10:27:41 +08:00
#coding=utf-8
namespace :zip do
desc "手工打包作品"
task :pack => :environment do
2017-01-06 10:47:25 +08:00
include ZipService
include Redmine::I18n
2017-01-06 11:30:54 +08:00
homework = Object.const_get(ENV['CLASS']).find ENV["ID"]
2017-01-06 10:27:41 +08:00
file_count = 0
homework.student_works.map { |work| file_count += work.attachments.count}
if file_count > 0
zipfile = zip_homework_common homework
else
zipfile = {:message => "no file"}
end
puts "out: #{zipfile}"
end
end