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/bgs_power_of_attorney.rb b/app/models/bgs_power_of_attorney.rb index 95b88cd238a..91750270316 100644 --- a/app/models/bgs_power_of_attorney.rb +++ b/app/models/bgs_power_of_attorney.rb @@ -49,7 +49,7 @@ def find_or_create_by_file_number(file_number) end def find_or_create_by_claimant_participant_id(claimant_participant_id) - poa = find_or_create_by!(claimant_participant_id: claimant_participant_id) + poa = default_scoped.find_or_create_by!(claimant_participant_id: claimant_participant_id) if FeatureToggle.enabled?(:poa_auto_refresh, user: RequestStore.store[:current_user]) poa.save_with_updated_bgs_record! if poa&.expired? end diff --git a/app/models/dispatch/task.rb b/app/models/dispatch/task.rb index b4aa97079a4..bbe2b877072 100644 --- a/app/models/dispatch/task.rb +++ b/app/models/dispatch/task.rb @@ -273,7 +273,7 @@ def should_invalidate? end def no_open_tasks_for_appeal - if self.class.to_complete_task_for_appeal(appeal).any? + if self.class.default_scoped.to_complete_task_for_appeal(appeal).any? errors.add(:appeal, "Uncompleted task already exists for this appeal") end end diff --git a/app/models/team_quota.rb b/app/models/team_quota.rb index e084ecc28d7..5b5f012e990 100644 --- a/app/models/team_quota.rb +++ b/app/models/team_quota.rb @@ -94,6 +94,6 @@ def most_recent_user_count # Cap the search to the last month to avoid an infinite loop def most_recent_user_counts - self.class.where(task_type: task_type).order(:date).limit(31).lazy.map(&:user_count) + self.class.default_scoped.where(task_type: task_type).order(:date).limit(31).lazy.map(&:user_count) end end 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 diff --git a/app/services/deprecation_warnings/disallowed_deprecations.rb b/app/services/deprecation_warnings/disallowed_deprecations.rb index c8abde11879..df4f14a24b1 100644 --- a/app/services/deprecation_warnings/disallowed_deprecations.rb +++ b/app/services/deprecation_warnings/disallowed_deprecations.rb @@ -18,7 +18,8 @@ class ::DisallowedDeprecationError < StandardError; end /ActionView::Base instances should be constructed with a lookup context, assignments, and a controller./, /ActionView::Base instances must implement `compiled_method_container`/, /render file: should be given the absolute path to a file/, - /`ActiveRecord::Result#to_hash` has been renamed to `to_a`/ + /`ActiveRecord::Result#to_hash` has been renamed to `to_a`/, + /Class level methods will no longer inherit scoping/ ].freeze # Regular expressions for deprecation warnings that should raise an exception on detection