Merge branches 'dev_aliyun' and 'dev_new_shixunsrepository' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_new_shixunsrepository

dev_new_shixunsrepository
杨树明 5 years ago
commit 1beb8f7d37

@ -850,7 +850,7 @@ module ExportHelper
def make_zip_name(work, file_name="")
Rails.logger.info("######################file_name: #{file_name}")
# name = file_name === "" ? "" : (file_name[0, file_name.rindex('.')]+"_")
"#{work&.user&.student_id}_#{work&.user&.real_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
"#{work&.homework_common.course&.user_group_name(work.user_id)}_#{work&.user&.student_id}_#{work&.user&.real_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
end
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])

@ -46,6 +46,21 @@ namespace :zip_pack do
end
end
task :homework_attach_pack => :environment do
include ExportHelper
if ENV['args']
homework_id = ENV['args']
homework = HomeworkCommon.find homework_id
zip_works = homework.student_works.where("work_status > 0")
if zip_works.size > 0
zipfile = zip_homework_common homework, zip_works
else
zipfile = {:message => "no file"}
end
puts "out: #{zipfile}"
end
end
def filename_for_content_disposition(name)
request.env['HTTP_USER_AGENT'] =~ %r{MSIE|Trident|Edge} ? ERB::Util.url_encode(name) : name
end

Loading…
Cancel
Save