|
|
@ -14,28 +14,28 @@ class ExportExercisesService
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def ex_zip
|
|
|
|
def ex_zip
|
|
|
|
logger.info("##################_______________________file_name___________11111__________###########")
|
|
|
|
Rails.logger.info("##################_______________________file_name___________11111__________###########")
|
|
|
|
|
|
|
|
|
|
|
|
zip_file = Tempfile.new(filename)
|
|
|
|
zip_file = Tempfile.new(filename)
|
|
|
|
logger.info("##################_______________________file_name___________2222222__________###########")
|
|
|
|
Rails.logger.info("##################_______________________file_name___________2222222__________###########")
|
|
|
|
|
|
|
|
|
|
|
|
pdfs = []
|
|
|
|
pdfs = []
|
|
|
|
Zip::File.open(zip_file.path, Zip::File::CREATE) do |zip|
|
|
|
|
Zip::File.open(zip_file.path, Zip::File::CREATE) do |zip|
|
|
|
|
logger.info("##################_______________________file_name___________3333333__________###########")
|
|
|
|
Rails.logger.info("##################_______________________file_name___________3333333__________###########")
|
|
|
|
|
|
|
|
|
|
|
|
ex_users.each do |ex_user|
|
|
|
|
ex_users.each do |ex_user|
|
|
|
|
export = ExerciseUserPdfService.new(exercise, ex_user)
|
|
|
|
export = ExerciseUserPdfService.new(exercise, ex_user)
|
|
|
|
logger.info("##################_______________________file_name___________444444__________###########")
|
|
|
|
Rails.logger.info("##################_______________________file_name___________444444__________###########")
|
|
|
|
|
|
|
|
|
|
|
|
pdf = export.ex_pdf
|
|
|
|
pdf = export.ex_pdf
|
|
|
|
logger.info("##################_______________________file_name___________888888888__________###########")
|
|
|
|
Rails.logger.info("##################_______________________file_name___________888888888__________###########")
|
|
|
|
|
|
|
|
|
|
|
|
pdfs << pdf
|
|
|
|
pdfs << pdf
|
|
|
|
logger.info("##################_______________________file_name___________999999999__________###########")
|
|
|
|
Rails.logger.info("##################_______________________file_name___________999999999__________###########")
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
zip.add(export.filename, pdf.path)
|
|
|
|
zip.add(export.filename, pdf.path)
|
|
|
|
logger.info("##################_______________________file_name___________10000000000000__________###########")
|
|
|
|
Rails.logger.info("##################_______________________file_name___________10000000000000__________###########")
|
|
|
|
|
|
|
|
|
|
|
|
rescue => ex
|
|
|
|
rescue => ex
|
|
|
|
Rails.logger.error(ex.message)
|
|
|
|
Rails.logger.error(ex.message)
|
|
|
|