Commit 824666dd846e84f4cbe5a17676bc5f763245b122
1 parent
ea7e701a
Exists in
master
Fix jobs
Showing
4 changed files
with
6 additions
and
5 deletions
Show diff stats
controllers/myprofile/dialoga_plugin_myprofile_controller.rb
... | ... | @@ -4,7 +4,8 @@ class DialogaPluginMyprofileController < MyProfileController |
4 | 4 | before_filter :is_admin |
5 | 5 | |
6 | 6 | def send_report |
7 | - report_path = Time.zone.now.strftime('%Y-%m-%d-%H-%m-%S') | |
7 | + report_path = Time.zone.now.strftime('%Y-%m-%d-%H-%M-%S') | |
8 | + DialogaPlugin::ReportJob.create_report_path(profile, report_path) | |
8 | 9 | Delayed::Job.enqueue(DialogaPlugin::ReportJob.new(profile.id, report_path)) |
9 | 10 | Delayed::Job.enqueue(DialogaPlugin::RankingJob.new(profile.id, report_path)) |
10 | 11 | Delayed::Job.enqueue(DialogaPlugin::EventJob.new(profile.id, report_path)) | ... | ... |
lib/dialoga_plugin/event_job.rb
... | ... | @@ -3,7 +3,7 @@ class DialogaPlugin::EventJob < DialogaPlugin::ReportJob |
3 | 3 | |
4 | 4 | def perform |
5 | 5 | profile = Profile.find(profile_id) |
6 | - report_folder = create_report_path(profile) | |
6 | + report_folder = DialogaPlugin::ReportJob.create_report_path(profile, report_path) | |
7 | 7 | create_event_report(profile, report_folder) |
8 | 8 | end |
9 | 9 | ... | ... |
lib/dialoga_plugin/ranking_job.rb
... | ... | @@ -4,7 +4,7 @@ class DialogaPlugin::RankingJob < DialogaPlugin::ReportJob |
4 | 4 | |
5 | 5 | def perform |
6 | 6 | profile = Profile.find(profile_id) |
7 | - report_folder = create_report_path(profile) | |
7 | + report_folder = DialogaPlugin::ReportJob.create_report_path(profile, report_path) | |
8 | 8 | create_ranking_report(profile, report_folder) |
9 | 9 | end |
10 | 10 | ... | ... |
lib/dialoga_plugin/report_job.rb
... | ... | @@ -3,7 +3,7 @@ class DialogaPlugin::ReportJob < Struct.new(:profile_id, :report_path) |
3 | 3 | |
4 | 4 | include ActionDispatch::TestProcess |
5 | 5 | |
6 | - def create_report_path(profile) | |
6 | + def self.create_report_path(profile, report_path) | |
7 | 7 | root_report_folder = profile.folders.where(:slug => 'relatorios').first |
8 | 8 | root_report_folder ||= Folder.create!(:profile => profile, :name => 'Relatorios') |
9 | 9 | FileUtils.mkdir_p "/tmp/#{report_path}" |
... | ... | @@ -23,7 +23,7 @@ class DialogaPlugin::ReportJob < Struct.new(:profile_id, :report_path) |
23 | 23 | |
24 | 24 | def perform |
25 | 25 | profile = Profile.find(profile_id) |
26 | - report_folder = create_report_path(profile) | |
26 | + report_folder = DialogaPlugin::ReportJob.create_report_path(profile, report_path) | |
27 | 27 | create_proposals_report(profile, report_folder) |
28 | 28 | end |
29 | 29 | ... | ... |