Skip to content

Commit

Permalink
Merge pull request #877 from uktrade/develop
Browse files Browse the repository at this point in the history
Use ActiveJob#perform_later method
  • Loading branch information
rafa-garcia authored Feb 23, 2023
2 parents f9eb529 + 5f455d5 commit d0b93cd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/enquiries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def index
format.csv do
enquiries = policy_scope(Enquiry).includes(:enquiry_response).where('enquiries.created_at >= ?', @enquiry_form.from).where('enquiries.created_at < ?', @enquiry_form.to).order('enquiries.created_at DESC')
zip_file_enquiries_cutoff_env_var = Figaro.env.zip_file_enquiries_cutoff ? Figaro.env.zip_file_enquiries_cutoff!.to_i : 6000
SendEnquiriesReportToMatchingAdminUser.perform_async(current_editor.email, enquiries.pluck('enquiries.id'), @enquiry_form.from, @enquiry_form.to, zip_file_enquiries_cutoff_env_var) if @enquiry_form.dates?
SendEnquiriesReportToMatchingAdminUser.perform_later(current_editor.email, enquiries.pluck('enquiries.id'), @enquiry_form.from, @enquiry_form.to, zip_file_enquiries_cutoff_env_var) if @enquiry_form.dates?
redirect_to admin_enquiries_path, notice: 'The Enquiries report has been emailed. If you have requested a large amount of data, the report will be sent as sections in separate emails.'
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def index
authorize :reports

if params[:commit]
SendMonthlyReportToMatchingAdminUser.perform_async(current_editor.email, params)
SendMonthlyReportToMatchingAdminUser.perform_later(current_editor.email, params)
redirect_to admin_reports_path, notice: 'The requested Monthly Outcome against Targets by Country report has been emailed to you.'
end

Expand Down
2 changes: 1 addition & 1 deletion app/services/update_opportunity_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ def message

class SubscriberNotificationSender
def call(opportunity)
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_async(opportunity.id)
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_later(opportunity.id)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
create_list(:subscription, 2, search_term: 'matching')

expect do
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_async(opportunity.id)
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_later(opportunity.id)
end.to change { SubscriptionNotification.count }.by(2)
end

Expand All @@ -16,7 +16,7 @@
create_list(:subscription, 2, user: user, search_term: 'matching')

expect do
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_async(opportunity.id)
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_later(opportunity.id)
end.to change { SubscriptionNotification.count }.by(1)
end

Expand All @@ -27,7 +27,7 @@
create(:subscription, user: user, search_term: 'subscription')

expect do
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_async(opportunity.id)
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_later(opportunity.id)
end.to change { SubscriptionNotification.count }.by(1)
end

Expand All @@ -37,7 +37,7 @@
subscription = create(:subscription, search_term: 'matching')

expect do
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_async(opportunity.id)
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_later(opportunity.id)
end.to change { subscription.notifications.count }.by(1)

expect(subscription.notifications.last.opportunity).to eq opportunity
Expand All @@ -53,7 +53,7 @@
expect_any_instance_of(SubscriptionFinder).to receive(:call).and_return([first_subscription, second_subscription])

expect do
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_async(opportunity.id)
AddOpportunityToMatchingSubscriptionsQueueWorker.perform_later(opportunity.id)
end.to change { SubscriptionNotification.count }.by(1)
end
end
Expand Down

0 comments on commit d0b93cd

Please sign in to comment.