From c16d3d56c19479d9d61000b98ba64f46e7a16fdf Mon Sep 17 00:00:00 2001 From: Jeremy Croteau Date: Fri, 26 Apr 2024 14:37:37 -0400 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Fix=20deprecation=20warnin?= =?UTF-8?q?g=20for=20Rails=206.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactors affected queries to address the following deprecation warning in anticipation of Rails 6.1: DEPRECATION WARNING: NOT conditions will no longer behave as NOR in Rails 6.1. To continue using NOR conditions, NOT each condition individually (`.where.not(:task_type => ...).where.not(:task_status => ...)`). --- app/jobs/quarterly_notifications_job.rb | 5 ++--- app/models/vbms_uploaded_document.rb | 5 ++++- .../etl/unknown_status_with_completed_root_task_query.rb | 3 ++- app/queries/etl/unknown_status_with_open_root_task_query.rb | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/jobs/quarterly_notifications_job.rb b/app/jobs/quarterly_notifications_job.rb index 0c7a686f2bb..70444b312bf 100644 --- a/app/jobs/quarterly_notifications_job.rb +++ b/app/jobs/quarterly_notifications_job.rb @@ -16,9 +16,8 @@ class QuarterlyNotificationsJob < CaseflowJob def perform # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity ensure_current_user_is_set - AppealState.where.not( - decision_mailed: true, appeal_cancelled: true - ).find_in_batches(batch_size: QUERY_LIMIT.to_i) do |batched_appeal_states| + AppealState.where.not(decision_mailed: true).where.not(appeal_cancelled: true) + .find_in_batches(batch_size: QUERY_LIMIT.to_i) do |batched_appeal_states| batched_appeal_states.each do |appeal_state| # add_record_to_appeal_states_table(appeal_state.appeal) if appeal_state.appeal_type == "Appeal" diff --git a/app/models/vbms_uploaded_document.rb b/app/models/vbms_uploaded_document.rb index 4614cf6afff..a715d927cd5 100644 --- a/app/models/vbms_uploaded_document.rb +++ b/app/models/vbms_uploaded_document.rb @@ -10,7 +10,10 @@ class VbmsUploadedDocument < CaseflowRecord attribute :file, :string scope :successfully_uploaded, lambda { - where(error: nil).where.not(uploaded_to_vbms_at: nil, attempted_at: nil, processed_at: nil) + where(error: nil) + .where.not(uploaded_to_vbms_at: nil) + .where.not(attempted_at: nil) + .where.not(processed_at: nil) } def cache_file diff --git a/app/queries/etl/unknown_status_with_completed_root_task_query.rb b/app/queries/etl/unknown_status_with_completed_root_task_query.rb index d24ceb9eb22..1b827f647d0 100644 --- a/app/queries/etl/unknown_status_with_completed_root_task_query.rb +++ b/app/queries/etl/unknown_status_with_completed_root_task_query.rb @@ -21,6 +21,7 @@ def appeal_ids_for_completed_root_tasks def appeal_ids_for_open_child_tasks ETL::Task.select(:appeal_id).distinct .where(appeal_type: "Appeal") - .where.not(task_type: "RootTask", task_status: Task.closed_statuses) + .where.not(task_type: "RootTask") + .where.not(task_status: Task.closed_statuses) end end diff --git a/app/queries/etl/unknown_status_with_open_root_task_query.rb b/app/queries/etl/unknown_status_with_open_root_task_query.rb index 3159a1368e4..1d2979de146 100644 --- a/app/queries/etl/unknown_status_with_open_root_task_query.rb +++ b/app/queries/etl/unknown_status_with_open_root_task_query.rb @@ -21,6 +21,7 @@ def appeal_ids_for_open_root_tasks def appeal_ids_for_open_child_tasks ETL::Task.select(:appeal_id).distinct .where(appeal_type: "Appeal") - .where.not(task_type: "RootTask", task_status: Task.closed_statuses) + .where.not(task_type: "RootTask") + .where.not(task_status: Task.closed_statuses) end end