From 93233be5c9c7a537d19f4b7d143f4e90ea50e86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vantomme?= Date: Fri, 11 Mar 2022 16:12:55 +0100 Subject: [PATCH 1/2] fix(after_party): add the missing second argument to send_expiration_notices method ArgumentError: wrong number of arguments (given 1, expected 2) app/services/expired_dossiers_deletion_service.rb:72:in `send_expiration_notices' lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake:11:in `block (2 levels) in
' refs: 7028 --- ...20200401123317_process_expired_dossiers_en_construction.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake b/lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake index cf7113c98..da2485b9d 100644 --- a/lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake +++ b/lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake @@ -8,7 +8,7 @@ namespace :after_party do .en_construction_close_to_expiration .without_en_construction_expiration_notice_sent - ExpiredDossiersDeletionService.send_expiration_notices(dossiers_close_to_expiration) + ExpiredDossiersDeletionService.send_expiration_notices(dossiers_close_to_expiration, :en_construction_close_to_expiration_notice_sent_at) BATCH_SIZE = 1000 From b89541568c70eb746299bbc09a1e0de21a73b911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vantomme?= Date: Fri, 11 Mar 2022 16:16:43 +0100 Subject: [PATCH 2/2] fix(after_party): remove APP_ENV condition --- ...cess_expired_dossiers_en_construction.rake | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake b/lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake index da2485b9d..23c0692b9 100644 --- a/lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake +++ b/lib/tasks/deployment/20200401123317_process_expired_dossiers_en_construction.rake @@ -3,21 +3,19 @@ namespace :after_party do task process_expired_dossiers_en_construction: :environment do puts "Running deploy task 'process_expired_dossiers_en_construction'" - if ENV['APP_NAME'] == 'tps' - dossiers_close_to_expiration = Dossier - .en_construction_close_to_expiration - .without_en_construction_expiration_notice_sent + dossiers_close_to_expiration = Dossier + .en_construction_close_to_expiration + .without_en_construction_expiration_notice_sent - ExpiredDossiersDeletionService.send_expiration_notices(dossiers_close_to_expiration, :en_construction_close_to_expiration_notice_sent_at) + ExpiredDossiersDeletionService.send_expiration_notices(dossiers_close_to_expiration, :en_construction_close_to_expiration_notice_sent_at) - BATCH_SIZE = 1000 + BATCH_SIZE = 1000 - ((dossiers_close_to_expiration.count / BATCH_SIZE).ceil + 1).times do |n| - dossiers_close_to_expiration - .offset(n * BATCH_SIZE) - .limit(BATCH_SIZE) - .update_all(en_construction_close_to_expiration_notice_sent_at: Time.zone.now + n.days) - end + ((dossiers_close_to_expiration.count / BATCH_SIZE).ceil + 1).times do |n| + dossiers_close_to_expiration + .offset(n * BATCH_SIZE) + .limit(BATCH_SIZE) + .update_all(en_construction_close_to_expiration_notice_sent_at: Time.zone.now + n.days) end # Update task as completed. If you remove the line below, the task will