diff --git a/controllers/myprofile/dialoga_plugin_myprofile_controller.rb b/controllers/myprofile/dialoga_plugin_myprofile_controller.rb index 5737321..7a3ca92 100644 --- a/controllers/myprofile/dialoga_plugin_myprofile_controller.rb +++ b/controllers/myprofile/dialoga_plugin_myprofile_controller.rb @@ -4,7 +4,8 @@ class DialogaPluginMyprofileController < MyProfileController before_filter :is_admin def send_report - report_path = Time.zone.now.strftime('%Y-%m-%d-%H-%m-%S') + report_path = Time.zone.now.strftime('%Y-%m-%d-%H-%M-%S') + DialogaPlugin::ReportJob.create_report_path(profile, report_path) Delayed::Job.enqueue(DialogaPlugin::ReportJob.new(profile.id, report_path)) Delayed::Job.enqueue(DialogaPlugin::RankingJob.new(profile.id, report_path)) Delayed::Job.enqueue(DialogaPlugin::EventJob.new(profile.id, report_path)) diff --git a/lib/dialoga_plugin/event_job.rb b/lib/dialoga_plugin/event_job.rb index 408c3e1..375d3e9 100644 --- a/lib/dialoga_plugin/event_job.rb +++ b/lib/dialoga_plugin/event_job.rb @@ -3,7 +3,7 @@ class DialogaPlugin::EventJob < DialogaPlugin::ReportJob def perform profile = Profile.find(profile_id) - report_folder = create_report_path(profile) + report_folder = DialogaPlugin::ReportJob.create_report_path(profile, report_path) create_event_report(profile, report_folder) end diff --git a/lib/dialoga_plugin/ranking_job.rb b/lib/dialoga_plugin/ranking_job.rb index fed89e9..8a6ebcb 100644 --- a/lib/dialoga_plugin/ranking_job.rb +++ b/lib/dialoga_plugin/ranking_job.rb @@ -4,7 +4,7 @@ class DialogaPlugin::RankingJob < DialogaPlugin::ReportJob def perform profile = Profile.find(profile_id) - report_folder = create_report_path(profile) + report_folder = DialogaPlugin::ReportJob.create_report_path(profile, report_path) create_ranking_report(profile, report_folder) end diff --git a/lib/dialoga_plugin/report_job.rb b/lib/dialoga_plugin/report_job.rb index b7a3e41..9f72aac 100644 --- a/lib/dialoga_plugin/report_job.rb +++ b/lib/dialoga_plugin/report_job.rb @@ -3,7 +3,7 @@ class DialogaPlugin::ReportJob < Struct.new(:profile_id, :report_path) include ActionDispatch::TestProcess - def create_report_path(profile) + def self.create_report_path(profile, report_path) root_report_folder = profile.folders.where(:slug => 'relatorios').first root_report_folder ||= Folder.create!(:profile => profile, :name => 'Relatorios') FileUtils.mkdir_p "/tmp/#{report_path}" @@ -23,7 +23,7 @@ class DialogaPlugin::ReportJob < Struct.new(:profile_id, :report_path) def perform profile = Profile.find(profile_id) - report_folder = create_report_path(profile) + report_folder = DialogaPlugin::ReportJob.create_report_path(profile, report_path) create_proposals_report(profile, report_folder) end -- libgit2 0.21.2