|
|
|
@ -14,28 +14,28 @@ class ExportExercisesService
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def ex_zip
|
|
|
|
|
logger.info("##################_______________________file_name___________11111__________###########")
|
|
|
|
|
Rails.logger.info("##################_______________________file_name___________11111__________###########")
|
|
|
|
|
|
|
|
|
|
zip_file = Tempfile.new(filename)
|
|
|
|
|
logger.info("##################_______________________file_name___________2222222__________###########")
|
|
|
|
|
Rails.logger.info("##################_______________________file_name___________2222222__________###########")
|
|
|
|
|
|
|
|
|
|
pdfs = []
|
|
|
|
|
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|
|
|
|
|
|
export = ExerciseUserPdfService.new(exercise, ex_user)
|
|
|
|
|
logger.info("##################_______________________file_name___________444444__________###########")
|
|
|
|
|
Rails.logger.info("##################_______________________file_name___________444444__________###########")
|
|
|
|
|
|
|
|
|
|
pdf = export.ex_pdf
|
|
|
|
|
logger.info("##################_______________________file_name___________888888888__________###########")
|
|
|
|
|
Rails.logger.info("##################_______________________file_name___________888888888__________###########")
|
|
|
|
|
|
|
|
|
|
pdfs << pdf
|
|
|
|
|
logger.info("##################_______________________file_name___________999999999__________###########")
|
|
|
|
|
Rails.logger.info("##################_______________________file_name___________999999999__________###########")
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
zip.add(export.filename, pdf.path)
|
|
|
|
|
logger.info("##################_______________________file_name___________10000000000000__________###########")
|
|
|
|
|
Rails.logger.info("##################_______________________file_name___________10000000000000__________###########")
|
|
|
|
|
|
|
|
|
|
rescue => ex
|
|
|
|
|
Rails.logger.error(ex.message)
|
|
|
|
|