From 8b01651bcff5f6fa711c3b86d062ac068d45e2ed Mon Sep 17 00:00:00 2001 From: Jeremy Croteau Date: Fri, 22 Mar 2024 16:26:37 -0400 Subject: [PATCH 01/41] feature/APPEALS-38446-26725-36789 - Update to Rails 6.0 (release) (#21237) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔀 AlecK/APPEALS-38446 - Remove invalid argument from AR callback * 🔀 jcroteau/APPEALS-26725 - Update to Rails 6.0 * 🔀 AlecK/APPEALS-36789 - Update setup instructions after Rails 6.0 upgrade --- .reek.yml | 1 - .rubocop.yml | 1 + Gemfile | 4 +- Gemfile.lock | 129 ++++++++++-------- MAC_INTEL.md | 2 +- WINDOWS_10.md | 2 +- WINDOWS_11.md | 4 +- app/models/application_record.rb | 16 --- app/models/board_grant_effectuation.rb | 2 +- .../claim_history_event.rb | 63 +++------ .../claim_history_service.rb | 2 +- bin/rails | 8 +- bin/rake | 6 +- bin/setup | 30 ++-- bin/yarn | 15 +- config/application.rb | 89 +++++++++--- config/cable.yml | 4 +- config/environments/development.rb | 5 +- config/environments/production.rb | 33 ++++- config/environments/test.rb | 16 ++- .../initializers/content_security_policy.rb | 5 + config/initializers/oracle.rb | 12 ++ config/locales/en.yml | 2 +- config/puma.rb | 7 +- config/routes.rb | 2 +- spec/feature/queue/cavc_dashboard_spec.rb | 12 +- ...end_final_notification_letter_task_spec.rb | 4 +- ...d_initial_notification_letter_task_spec.rb | 2 +- ...l_notification_letter_holding_task_spec.rb | 2 +- spec/rails_helper.rb | 5 + .../claim_history_event_spec.rb | 81 ++++++----- spec/sql/basic_spec.rb | 13 +- spec/sql/timed_hold_task_sql_spec.rb | 2 +- 33 files changed, 329 insertions(+), 252 deletions(-) create mode 100644 config/initializers/oracle.rb diff --git a/.reek.yml b/.reek.yml index f9537913aff..b419f345ad1 100644 --- a/.reek.yml +++ b/.reek.yml @@ -74,7 +74,6 @@ detectors: - Api::ApplicationController#upstream_known_error - AppealAvailableHearingLocations#suggested_hearing_location - AppealTaskHistory#build_events - - ApplicationRecord#as_hash - AssignHearingDispositionTask#reschedule_or_schedule_later - AsyncableJobsReporter - CachedAppealService#cache_ama_appeals diff --git a/.rubocop.yml b/.rubocop.yml index ca51cec69b6..8773441a13f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,7 @@ require: AllCops: Exclude: + - 'bin/**/*' - 'db/**/*' - 'config/**/*' - 'script/**/*' diff --git a/Gemfile b/Gemfile index e590a759e95..16b4ccc9c99 100644 --- a/Gemfile +++ b/Gemfile @@ -56,7 +56,7 @@ gem "pg", platforms: :ruby # Discussion: https://github.com/18F/college-choice/issues/597#issuecomment-139034834 gem "puma", "5.6.4" gem "rack", "~> 2.2.6.2" -gem "rails", "5.2.8.1" +gem "rails", "6.0.6.1" # Used to colorize output for rake tasks gem "rainbow" # React @@ -86,7 +86,7 @@ gem "ziptz" group :production, :staging, :ssh_forwarding, :development, :test do # Oracle DB - gem "activerecord-oracle_enhanced-adapter", "~> 5.2.0" + gem "activerecord-oracle_enhanced-adapter", "~> 6.0.0" gem "ruby-oci8", "~> 2.2" end diff --git a/Gemfile.lock b/Gemfile.lock index 52d40d1af0c..05012fefecc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,52 +86,66 @@ GEM remote: https://rubygems.org/ specs: aasm (4.11.0) - actioncable (5.2.8.1) - actionpack (= 5.2.8.1) + actioncable (6.0.6.1) + actionpack (= 6.0.6.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) + actionmailbox (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + mail (>= 2.7.1) + actionmailer (6.0.6.1) + actionpack (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.8.1) - actionview (= 5.2.8.1) - activesupport (= 5.2.8.1) + actionpack (6.0.6.1) + actionview (= 6.0.6.1) + activesupport (= 6.0.6.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.8.1) - activesupport (= 5.2.8.1) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.6.1) + actionpack (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + nokogiri (>= 1.8.5) + actionview (6.0.6.1) + activesupport (= 6.0.6.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.8.1) - activesupport (= 5.2.8.1) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.6.1) + activesupport (= 6.0.6.1) globalid (>= 0.3.6) - activemodel (5.2.8.1) - activesupport (= 5.2.8.1) - activerecord (5.2.8.1) - activemodel (= 5.2.8.1) - activesupport (= 5.2.8.1) - arel (>= 9.0) + activemodel (6.0.6.1) + activesupport (= 6.0.6.1) + activerecord (6.0.6.1) + activemodel (= 6.0.6.1) + activesupport (= 6.0.6.1) activerecord-import (1.0.2) activerecord (>= 3.2) - activerecord-oracle_enhanced-adapter (5.2.8) - activerecord (~> 5.2.0) + activerecord-oracle_enhanced-adapter (6.0.6) + activerecord (~> 6.0.0) ruby-plsql (>= 0.6.0) - activestorage (5.2.8.1) - actionpack (= 5.2.8.1) - activerecord (= 5.2.8.1) - marcel (~> 1.0.0) - activesupport (5.2.8.1) + activestorage (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + marcel (~> 1.0) + activesupport (6.0.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) acts_as_tree (2.9.0) activerecord (>= 3.0.0) addressable (2.8.0) @@ -142,7 +156,6 @@ GEM amoeba (3.2.0) activerecord (>= 4.2.0) anbt-sql-formatter (0.1.0) - arel (9.0.0) ast (2.4.2) aws-sdk (2.10.112) aws-sdk-resources (= 2.10.112) @@ -298,8 +311,7 @@ GEM colorize (~> 0.7) ruby_parser (>= 3.13.0) ffi (1.16.3) - foreman (0.85.0) - thor (~> 0.19.1) + foreman (0.87.2) formatador (0.2.5) fuzzy_match (2.1.0) get_process_mem (0.2.4) @@ -480,18 +492,20 @@ GEM rack (~> 2.0) rack-test (2.1.0) rack (>= 1.3) - rails (5.2.8.1) - actioncable (= 5.2.8.1) - actionmailer (= 5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) - activemodel (= 5.2.8.1) - activerecord (= 5.2.8.1) - activestorage (= 5.2.8.1) - activesupport (= 5.2.8.1) + rails (6.0.6.1) + actioncable (= 6.0.6.1) + actionmailbox (= 6.0.6.1) + actionmailer (= 6.0.6.1) + actionpack (= 6.0.6.1) + actiontext (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) + activemodel (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) bundler (>= 1.3.0) - railties (= 5.2.8.1) + railties (= 6.0.6.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.1.1) activesupport (>= 5.0.0) @@ -505,12 +519,12 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (5.2.8.1) - actionpack (= 5.2.8.1) - activesupport (= 5.2.8.1) + railties (6.0.6.1) + actionpack (= 6.0.6.1) + activesupport (= 6.0.6.1) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.1.1) rake (12.3.3) rb-fsevent (0.11.2) @@ -525,12 +539,12 @@ GEM rails (>= 3.2) rainbow (~> 3.0) redis (4.0.1) - redis-actionpack (5.0.2) - actionpack (>= 4.0, < 6) + redis-actionpack (5.1.0) + actionpack (>= 4.0, < 7) redis-rack (>= 1, < 3) redis-store (>= 1.1.0, < 2) - redis-activesupport (5.0.4) - activesupport (>= 3, < 6) + redis-activesupport (5.3.0) + activesupport (>= 3, < 8) redis-store (>= 1.3, < 2) redis-classy (2.4.1) redis-namespace (~> 1.0) @@ -601,7 +615,7 @@ GEM rake (>= 0.8.1) ruby-graphviz (1.2.4) ruby-oci8 (2.2.7) - ruby-plsql (0.7.1) + ruby-plsql (0.8.0) ruby-prof (1.4.1) ruby-progressbar (1.13.0) ruby_dep (1.5.0) @@ -615,8 +629,8 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) + sass-rails (5.1.0) + railties (>= 5.2.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) @@ -681,7 +695,7 @@ GEM therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref - thor (0.19.4) + thor (0.20.3) thread_safe (0.3.6) tilt (2.0.8) timecop (0.9.1) @@ -727,6 +741,7 @@ GEM nokogiri (~> 1.8) yard (0.9.27) webrick (~> 1.7.0) + zeitwerk (2.6.12) ziptz (2.1.6) PLATFORMS @@ -735,7 +750,7 @@ PLATFORMS DEPENDENCIES aasm (= 4.11.0) activerecord-import - activerecord-oracle_enhanced-adapter (~> 5.2.0) + activerecord-oracle_enhanced-adapter (~> 6.0.0) acts_as_tree amoeba anbt-sql-formatter @@ -795,7 +810,7 @@ DEPENDENCIES pry-byebug (~> 3.9) puma (= 5.6.4) rack (~> 2.2.6.2) - rails (= 5.2.8.1) + rails (= 6.0.6.1) rails-erd rainbow rb-readline @@ -840,4 +855,4 @@ DEPENDENCIES ziptz BUNDLED WITH - 2.2.25 + 2.4.19 diff --git a/MAC_INTEL.md b/MAC_INTEL.md index 96e2951e042..fb2fd33c741 100644 --- a/MAC_INTEL.md +++ b/MAC_INTEL.md @@ -77,7 +77,7 @@ 19. Run `scripts/dev_env_setup_step2.sh` script (may take a while to run) -20. Run `gem install bundler` +20. Run `gem install bundler -v $(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)` 21. Navigate to `~/appeals/caseflow/local/vacols` in terminal (type: `cd ~/appeals/caseflow/local/vacols`) diff --git a/WINDOWS_10.md b/WINDOWS_10.md index 159d2aa02f3..c7ff39b7910 100644 --- a/WINDOWS_10.md +++ b/WINDOWS_10.md @@ -45,7 +45,7 @@ * `mkdir appeals && cd appeals` * `git clone https://@github.com/department-of-veterans-affairs/caseflow` * `cd caseflow` - * `git checkout kevin/setup-ubuntu` + * `git checkout dev-supporting/setup-ubuntu` * `cp -r ~/caseflow-setup/caseflow-facols/build_facols local/vacols/build_facols ` * `cp ~/caseflow-setup/*.zip local/vacols/build_facols/` * `rm -rf ~/__MACOSX && rm -rf ~/caseflow-setup && rm -f ~/caseflow-setup.zip` diff --git a/WINDOWS_11.md b/WINDOWS_11.md index b193bbf7ba8..2b8139175f4 100644 --- a/WINDOWS_11.md +++ b/WINDOWS_11.md @@ -58,7 +58,7 @@ Run each line is a separate command, run them one at a time 11. Enter your git token where is below: * ```git clone https://@github.com/department-of-veterans-affairs/caseflow``` * ```cd caseflow``` - * ```git checkout kevin/setup-ubuntu``` + * ```git checkout dev-supporting/setup-ubuntu``` * ```cp -r ~/caseflow-setup/caseflow-facols/build_facols local/vacols/build_facols``` * ```cp ~/caseflow-setup/*.zip local/vacols/build_facols/``` * ```rm -rf ~/__MACOSX && rm -rf ~/caseflow-setup && rm -f ~/caseflow-setup.zip``` @@ -78,7 +78,7 @@ Run each line is a separate command, run them one at a time 16. Open new terminal in VS Code. Trash old terminal. -17. In new terminal run: ```git checkout kevin/setup-ubuntu``` +17. In new terminal run: ```git checkout dev-supporting/setup-ubuntu``` 18. ```cd ~/appeals/caseflow``` diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 3bda74ef691..49f9cfb4911 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -2,22 +2,6 @@ class ApplicationRecord < ActiveRecord::Base self.abstract_class = true - - # this simple transform should match the basic ActiveRecord::Result format - # for db results. - def as_hash - as_json.with_indifferent_access.tap do |rec| - rec.transform_values! do |value| - if value.is_a?(Time) || value.is_a?(DateTime) - ymdhms = value.utc.strftime("%Y-%m-%d %H:%M:%S") - subseconds = value.utc.strftime(".%6N").to_f.to_s.sub(/^0\./, "") - "#{ymdhms}.#{subseconds}" - else - value.as_json - end - end - end - end end # :nocov: diff --git a/app/models/board_grant_effectuation.rb b/app/models/board_grant_effectuation.rb index dd581bd9fc5..5b920fa46db 100644 --- a/app/models/board_grant_effectuation.rb +++ b/app/models/board_grant_effectuation.rb @@ -14,7 +14,7 @@ class BoardGrantEffectuation < CaseflowRecord belongs_to :end_product_establishment validates :granted_decision_issue, presence: true - before_save :hydrate_from_granted_decision_issue, on: :create + before_save :hydrate_from_granted_decision_issue END_PRODUCT_CODES = { rating: "030BGR", diff --git a/app/services/claim_change_history/claim_history_event.rb b/app/services/claim_change_history/claim_history_event.rb index b9491391f22..0cae36dc208 100644 --- a/app/services/claim_change_history/claim_history_event.rb +++ b/app/services/claim_change_history/claim_history_event.rb @@ -86,11 +86,11 @@ def create_status_events(change_data) # Assume that if the dates are equal then it should be a assigned -> on_hold status event that is recorded # Due to the way intake is processed a task is always created as assigned first - time_difference = (first_version["updated_at"][0] - first_version["updated_at"][1]).to_f.abs - # If the time difference is > than 2 seconds then assume it is a valid status change instead of the # Normal intake assigned -> on_hold that will happen for no decision date HLR/SC intakes - if time_difference > STATUS_EVENT_TIME_WINDOW + if !timestamp_within_seconds?(first_version["updated_at"][0], + first_version["updated_at"][1], + STATUS_EVENT_TIME_WINDOW) status_events.push event_from_version(first_version, 0, change_data) end @@ -162,9 +162,9 @@ def process_issue_ids(request_issue_ids, event_type, change_data) request_issue_data = change_data.merge(issue_data) if event_type == :edited_issue # Compare the two dates to try to guess if it was adding a decision date or not - same_transaction = date_strings_within_seconds?(request_issue_data["decision_date_added_at"], - request_issue_data["request_issue_update_time"], - REQUEST_ISSUE_TIME_WINDOW) + same_transaction = timestamp_within_seconds?(request_issue_data["decision_date_added_at"], + request_issue_data["request_issue_update_time"], + REQUEST_ISSUE_TIME_WINDOW) if request_issue_data["decision_date_added_at"].present? && same_transaction created_events.push from_change_data(:added_decision_date, request_issue_data) end @@ -178,9 +178,9 @@ def process_issue_ids(request_issue_ids, event_type, change_data) def create_add_issue_event(change_data) # Try to guess if it was added during intake. If not, it was a probably added during an issue update - same_transaction = date_strings_within_seconds?(change_data["intake_completed_at"], - change_data["request_issue_created_at"], - REQUEST_ISSUE_TIME_WINDOW) + same_transaction = timestamp_within_seconds?(change_data["intake_completed_at"], + change_data["request_issue_created_at"], + REQUEST_ISSUE_TIME_WINDOW) # If it was during intake or if there's no request issue update time then use the intake event hash # This will also catch most request issues that were added to claims that don't have an intake event_hash = if same_transaction || !change_data["request_issue_update_time"] @@ -209,7 +209,7 @@ def retrieve_issue_data(request_issue_id, change_data) "nonrating_issue_description" => request_issue.nonrating_issue_description || request_issue.unidentified_issue_text, "decision_date" => request_issue.decision_date, - "decision_date_added_at" => request_issue.decision_date_added_at&.iso8601, + "decision_date_added_at" => request_issue.decision_date_added_at, "request_issue_closed_at" => request_issue.closed_at } end @@ -238,9 +238,9 @@ def determine_add_issue_event_type(change_data) # If there is no decision_date_added_at time, assume it is old data and that it had a decision date on creation had_decision_date = if change_data["decision_date"] && change_data["decision_date_added_at"] # Assume if the time window was within 15 seconds of creation that it had a decision date - date_strings_within_seconds?(change_data["request_issue_created_at"], - change_data["decision_date_added_at"], - REQUEST_ISSUE_TIME_WINDOW) + timestamp_within_seconds?(change_data["request_issue_created_at"], + change_data["decision_date_added_at"], + REQUEST_ISSUE_TIME_WINDOW) elsif change_data["decision_date"].blank? false else @@ -272,9 +272,9 @@ def update_event_hash(change_data) def add_issue_update_event_hash(change_data) # Check the current request issue updates time to see if the issue update is in the correct row # If it is, then do the normal update_event_hash information - if date_strings_within_seconds?(change_data["request_issue_created_at"], - change_data["request_issue_update_time"], - REQUEST_ISSUE_TIME_WINDOW) + if timestamp_within_seconds?(change_data["request_issue_created_at"], + change_data["request_issue_update_time"], + REQUEST_ISSUE_TIME_WINDOW) update_event_hash(change_data).merge("event_date" => change_data["request_issue_created_at"]) else # If it's not, then do some database fetches to grab the correct information @@ -301,19 +301,11 @@ def retrieve_issue_update_data(change_data) end end - def date_strings_within_seconds?(first_date, second_date, time_in_seconds) + def timestamp_within_seconds?(first_date, second_date, time_in_seconds) return false unless first_date && second_date # Less variables for less garbage collection since this method is used a lot - ((parse_date(first_date) - parse_date(second_date)).abs * 24 * 60 * 60).to_f < time_in_seconds - end - - def parse_date(date_string) - if date_string.include?("T") || date_string.include?("Z") - DateTime.iso8601(date_string) - else - DateTime.strptime(date_string, "%Y-%m-%d %H:%M:%S.%N") - end + (first_date - second_date).abs < time_in_seconds end def handle_hookless_cancelled_status_events(versions, change_data) @@ -494,28 +486,11 @@ def parse_disposition_attributes(change_data) end def parse_event_attributes(change_data) - standardize_event_date @user_facility = change_data["user_facility"] @event_user_name = change_data["event_user_name"] @event_user_css_id = change_data["event_user_css_id"] end - def standardize_event_date - # Try to keep all the dates consistent as a iso8601 string if possible - @event_date = - if event_date.is_a?(String) - if event_date.include?("T") || event_date.include?("Z") - # Assume it is in Iso8601 already so just return it - event_date - else - # Assume UTC string so convert it to iso8601 - DateTime.strptime(event_date, "%Y-%m-%d %H:%M:%S.%N").iso8601 - end - else - event_date&.iso8601 - end - end - ############ CSV and Serializer Helpers ############ def abbreviated_user_name(name_string) @@ -555,7 +530,7 @@ def status_description def format_date_string(date) if date.class == String - DateTime.iso8601(date.tr(" ", "T")).strftime("%-m/%-d/%Y") + DateTime.iso8601(date).strftime("%-m/%-d/%Y") elsif date.present? date.strftime("%-m/%-d/%Y") end diff --git a/app/services/claim_change_history/claim_history_service.rb b/app/services/claim_change_history/claim_history_service.rb index 193cb86b735..c778ae4f01b 100644 --- a/app/services/claim_change_history/claim_history_service.rb +++ b/app/services/claim_change_history/claim_history_service.rb @@ -127,7 +127,7 @@ def process_timing_filter(new_events) new_events.select do |event| next unless event.event_date - event_date = Date.parse(event.event_date) + event_date = event.event_date.to_date (start_date.nil? || event_date >= start_date) && (end_date.nil? || event_date <= end_date) end end diff --git a/bin/rails b/bin/rails index 22f2d8deee9..07396602377 100755 --- a/bin/rails +++ b/bin/rails @@ -1,6 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -APP_PATH = File.expand_path("../config/application", __dir__) -require_relative "../config/boot" -require "rails/commands" +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake index e436ea54a18..17240489f64 100755 --- a/bin/rake +++ b/bin/rake @@ -1,6 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -require_relative "../config/boot" -require "rake" +require_relative '../config/boot' +require 'rake' Rake.application.run diff --git a/bin/setup b/bin/setup index 8c5150054a6..5853b5ea875 100755 --- a/bin/setup +++ b/bin/setup @@ -1,38 +1,36 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -require "fileutils" -include FileUtils # rubocop:disable Style/MixinUsage +require 'fileutils' # path to your application root. -APP_ROOT = File.expand_path("..", __dir__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do - # This script is a starting point to setup your application. +FileUtils.chdir APP_ROOT do + # This script is a way to setup or update your development environment automatically. + # This script is idempotent, so that you can run it at anytime and get an expectable outcome. # Add necessary setup steps to this file. - puts "== Installing dependencies ==" - system! "gem install bundler -v $(grep -A 1 \"BUNDLED WITH\" Gemfile.lock | tail -n 1)" - system("bundle check") || system!("bundle install") + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn - system("bin/yarn") + # Install JavaScript dependencies + # system('bin/yarn') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system! "bin/rails db:setup" + system! 'bin/rails db:prepare' puts "\n== Removing old logs and tempfiles ==" - system! "bin/rails log:clear tmp:clear" + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system! "bin/rails restart" + system! 'bin/rails restart' end diff --git a/bin/yarn b/bin/yarn index 49affd28ae3..460dd565b4a 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,10 +1,11 @@ #!/usr/bin/env ruby -# frozen_string_literal: true -APP_ROOT = File.expand_path("..", __dir__) # rubocop:disable Layout/EmptyLineAfterMagicComment +APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - exec "yarnpkg", *ARGV -rescue Errno::ENOENT - $stderr.puts "Yarn executable was not detected in the system." # rubocop:disable Style/StderrPuts - $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" # rubocop:disable Style/StderrPuts - exit 1 + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end end diff --git a/config/application.rb b/config/application.rb index 9a4329f9fc5..37e00da3554 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,40 +13,58 @@ module CaseflowCertification class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 + config.autoloader = :classic # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. + # ================================================================================================================== + # Rails default overrides + # These settings override the defaults set by `config.load_defaults`. + # If and as appropriate, we can transition these overrides one-by-one to migrate to their respective defaults. + # See the Rails Guides: Configuring Rails Applications for more info on each option. + # https://guides.rubyonrails.org/configuring.html + # # ================================================================================================================== # Rails 5.0 default overrides # ------------------------------------------------------------------------------------------------------------------ + # Enable per-form CSRF tokens. - # Default (starting v5.0): true + # Default as of 5.0: true config.action_controller.per_form_csrf_tokens = false # Enable origin-checking CSRF mitigation. - # Default (starting v5.0): true + # Default as of 5.0: true config.action_controller.forgery_protection_origin_check = false # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. - # Default (starting v5.0): true + # Default as of 5.0: true ActiveSupport.to_time_preserves_timezone = false # Require `belongs_to` associations by default. - # Default (starting v5.0): true + # Default as of 5.0: true config.active_record.belongs_to_required_by_default = false - # ================================================================================================================== + + # ------------------------------------------------------------------------------------------------------------------ # Rails 5.1 default overrides # ------------------------------------------------------------------------------------------------------------------ + # Make `form_with` generate non-remote forms. - # Default (starting v5.1): true - # Default (starting v6.1): false - Rails.application.config.action_view.form_with_generates_remote_forms = false - # ================================================================================================================== + # Default as of 5.1: true + # Default as of 6.1: false + config.action_view.form_with_generates_remote_forms = false + + # ------------------------------------------------------------------------------------------------------------------ # Rails 5.2 default overrides # ------------------------------------------------------------------------------------------------------------------ + + # Make Active Record use stable #cache_key alongside new #cache_version method. + # This is needed for recyclable cache keys. + # Default as of 5.2: true + config.active_record.cache_versioning = false + # Use AES-256-GCM authenticated encryption for encrypted cookies. # Also, embed cookie expiry in signed or encrypted cookies for increased security. # @@ -54,21 +72,58 @@ class Application < Rails::Application # It's best enabled when your entire app is migrated and stable on 5.2. # # Existing cookies will be converted on read then written with the new scheme. - # Default (starting v5.2): true - Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = false + # Default as of 5.2: true + config.action_dispatch.use_authenticated_cookie_encryption = false # # Use AES-256-GCM authenticated encryption as default cipher for encrypting messages # instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. - # Default (starting v5.2): true - Rails.application.config.active_support.use_authenticated_message_encryption = false + # Default as of 5.2: true + config.active_support.use_authenticated_message_encryption = false # Add default protection from forgery to ActionController::Base instead of in ApplicationController. - # Default (starting v5.2): true - Rails.application.config.action_controller.default_protect_from_forgery = false + # Default as of 5.2: true + config.action_controller.default_protect_from_forgery = false # Store boolean values in sqlite3 databases as 1 and 0 instead of 't' and 'f' after migrating old data. - # Default (starting v5.2): true - Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = false + # Default as of 5.2: true + config.active_record.sqlite3.represent_boolean_as_integer = false + + # ------------------------------------------------------------------------------------------------------------------ + # Rails 6.0 default overrides + # ------------------------------------------------------------------------------------------------------------------ + + # Don't force requests from old versions of IE to be UTF-8 encoded. + # Default as of 6.0: false + config.action_view.default_enforce_utf8 = true + + # Embed purpose and expiry metadata inside signed and encrypted + # cookies for increased security. + # + # This option is not backwards compatible with earlier Rails versions. + # It's best enabled when your entire app is migrated and stable on 6.0. + # Default as of 6.0: true + config.action_dispatch.use_cookies_with_metadata = false + + # Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification. + # Default as of 6.0: false + config.action_dispatch.return_only_media_type_on_content_type = true + + # Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail. + # + # The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob), + # will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions. + # If you send mail in the background, job workers need to have a copy of + # MailDeliveryJob to ensure all delivery jobs are processed properly. + # Make sure your entire app is migrated and stable on 6.0 before using this setting. + # Default as of 6.0: "ActionMailer::MailDeliveryJob" + config.action_mailer.delivery_job = nil + + # Enable the same cache key to be reused when the object being cached of type + # `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count) + # of the relation's cache key into the cache version to support recycling cache key. + # Default as of 6.0: true + config.active_record.collection_cache_versioning = false + # ================================================================================================================== # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. diff --git a/config/cable.yml b/config/cable.yml index 4209375187c..7e2f5c63184 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -2,9 +2,9 @@ development: adapter: async test: - adapter: async + adapter: test production: adapter: redis - url: redis://localhost:6379/1 + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> channel_prefix: caseflow_certification_production diff --git a/config/environments/development.rb b/config/environments/development.rb index 9db1f12dbce..1a33636ee4c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,6 +16,7 @@ # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = true config.cache_store = :redis_store, Rails.application.secrets.redis_url_cache, { expires_in: 24.hours } config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" @@ -26,7 +27,7 @@ # config.cache_store = :null_store end - # Store uploaded files on the local file system (see config/storage.yml for options) + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local if ENV["WITH_TEST_EMAIL_SERVER"] @@ -62,7 +63,7 @@ # Suppress logger output for asset requests. config.assets.quiet = true - # Raises error for missing translations + # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, diff --git a/config/environments/production.rb b/config/environments/production.rb index 609b1d89857..c1b6847d036 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,14 +22,12 @@ # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? - # Compress JavaScripts and CSS. + # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' @@ -37,10 +35,10 @@ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options) + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local - # Mount Action Cable outside main process or domain + # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] @@ -58,9 +56,9 @@ # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Use a real queuing backend for Active Job (and separate queues per environment) + # Use a real queuing backend for Active Job (and separate queues per environment). # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "caseflow_certification_#{Rails.env}" + # config.active_job.queue_name_prefix = "caseflow_certification_production" config.action_mailer.perform_caching = false @@ -103,6 +101,27 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + # Inserts middleware to perform automatic connection switching. + # The `database_selector` hash is used to pass options to the DatabaseSelector + # middleware. The `delay` is used to determine how long to wait after a write + # to send a subsequent read to the primary. + # + # The `database_resolver` class is used by the middleware to determine which + # database is appropriate to use based on the time delay. + # + # The `database_resolver_context` class is used by the middleware to set + # timestamps for the last write to the primary. The resolver uses the context + # class timestamps to determine how long to wait before reading from the + # replica. + # + # By default Rails will store a last write timestamp in the session. The + # DatabaseSelector middleware is designed as such you can define your own + # strategy for connection switching and pass that into the middleware through + # these configuration options. + # config.active_record.database_selector = { delay: 2.seconds } + # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver + # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session + #===================================================================================================================== # Please keep custom config settings below this comment. # This will ensure cleaner diffs when generating config file changes during Rails upgrades. diff --git a/config/environments/test.rb b/config/environments/test.rb index 430df34ef54..f0176ee6098 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,11 +1,13 @@ require "fileutils" + +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! config.cache_classes = true cache_dir = Rails.root.join("tmp", "cache", "test_#{ENV['TEST_SUBCATEGORY']}", $$.to_s) @@ -33,7 +35,7 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Store uploaded files on the local file system in a temporary directory + # Store uploaded files on the local file system in a temporary directory. config.active_storage.service = :test config.action_mailer.perform_caching = false @@ -55,7 +57,7 @@ config.action_mailer.delivery_method = :test - # Raises error for missing translations + # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true #===================================================================================================================== @@ -116,7 +118,7 @@ config.factory_bot.definition_file_paths = [] end - # VA Notify evnironment variables + # VA Notify environment variables ENV["VA_NOTIFY_API_URL"] ||= "https://staging-api.va.gov/vanotify" ENV["VA_NOTIFY_API_KEY"] ||= "secret-key" ENV["VA_NOTIFY_SERVICE_ID"] ||= "fake-service-id" diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index d3bcaa5ec84..35d0f26fcdc 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -11,6 +11,8 @@ # policy.object_src :none # policy.script_src :self, :https # policy.style_src :self, :https +# # If you are using webpack-dev-server then specify webpack-dev-server host +# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" @@ -19,6 +21,9 @@ # If you are using UJS then enable automatic nonce generation # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } +# Set the nonce only to specific directives +# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) + # Report CSP violations to a specified URI # For further information see the following documentation: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only diff --git a/config/initializers/oracle.rb b/config/initializers/oracle.rb new file mode 100644 index 00000000000..e9c117a86a6 --- /dev/null +++ b/config/initializers/oracle.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +ActiveSupport.on_load(:active_record) do + ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do + # oracle-enhanced v6.00 changes the default sequence start value from 10,000 to 1: + # Release Notes: https://github.com/rsim/oracle-enhanced/blob/v6.0.6/History.md#600--2019-08-17 + # Related PR: https://github.com/rsim/oracle-enhanced/pull/1636 + # + # Preserve the previous default value of 10,000 + self.default_sequence_start_value = 10_000 + end +end diff --git a/config/locales/en.yml b/config/locales/en.yml index ecdcf545077..394a3e0d037 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -27,7 +27,7 @@ # 'true': 'foo' # # To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. +# available at https://guides.rubyonrails.org/i18n.html. en: activerecord: diff --git a/config/puma.rb b/config/puma.rb index 989b288d298..b2c644daa93 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -4,8 +4,9 @@ # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -threads threads_count, threads_count +max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +threads min_threads_count, max_threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. # @@ -19,7 +20,7 @@ pidfile ENV.fetch("PIDFILE") { "tmp/pids/puma.pid" } # Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver processes. If using threads and workers together +# Workers are forked web server processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. # Workers do not work on JRuby or Windows (both of which do not support # processes). diff --git a/config/routes.rb b/config/routes.rb index 993bd7ba009..5a492aea30b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/spec/feature/queue/cavc_dashboard_spec.rb b/spec/feature/queue/cavc_dashboard_spec.rb index 24702c1e328..7805e0ce412 100644 --- a/spec/feature/queue/cavc_dashboard_spec.rb +++ b/spec/feature/queue/cavc_dashboard_spec.rb @@ -29,7 +29,7 @@ it "dashboard loads as read-only if the appeal has an associated cavcRemand" do go_to_dashboard(cavc_remand.remand_appeal.uuid) - expect(page).to have_text `CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}` + expect(page).to have_text "CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}" expect(page).to_not have_content(COPY::ADD_CAVC_DASHBOARD_ISSUE_BUTTON_TEXT) expect(page).to_not have_content("Edit") end @@ -44,7 +44,7 @@ it "dashboard cancel button returns to case details if no changes have been made" do go_to_dashboard(cavc_remand.remand_appeal.uuid) - expect(page).to have_text `CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}` + expect(page).to have_text "CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}" expect(page).to have_content(COPY::ADD_CAVC_DASHBOARD_ISSUE_BUTTON_TEXT) expect(page).to have_content("Edit") @@ -57,7 +57,7 @@ it "dashboard save button is disabled until changes made, cancel button shows warning if clicked without saving" do go_to_dashboard(cavc_remand.remand_appeal.uuid) - expect(page).to have_text `CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}` + expect(page).to have_text "CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}" expect(page).to have_content(COPY::ADD_CAVC_DASHBOARD_ISSUE_BUTTON_TEXT) expect(page).to have_content("Edit") @@ -78,7 +78,7 @@ it "cancel modal functions properly when changes have not been saved" do go_to_dashboard(cavc_remand.remand_appeal.uuid) - expect(page).to have_text `CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}` + expect(page).to have_text "CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}" expect(page).to have_content("Edit") page.all("div.cf-select__placeholder", exact_text: "Select option").first.click @@ -92,7 +92,7 @@ page.find("button", id: "Your-changes-are-not-saved-button-id-0").click - expect(page).to have_text `CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}` + expect(page).to have_text "CAVC appeals for #{cavc_remand.remand_appeal.veteran.name}" click_button "Cancel" expect(page).to have_button("Continue") @@ -116,7 +116,7 @@ click_button "Save" - expect(page).to have_content `CAVC appeal 21-1234` + expect(page).to have_content "CAVC appeal 21-1234" # date format for input is MM/DD/YYYY but for display is MM/DD/YY expect(page).to have_content "01/01/21" expect(page).to have_content "210101-1000" diff --git a/spec/feature/queue/send_final_notification_letter_task_spec.rb b/spec/feature/queue/send_final_notification_letter_task_spec.rb index f5b36164fe7..66fda08ba14 100644 --- a/spec/feature/queue/send_final_notification_letter_task_spec.rb +++ b/spec/feature/queue/send_final_notification_letter_task_spec.rb @@ -113,7 +113,7 @@ # check the screen output and model status appeal_final_letter_task = root_task.appeal.tasks.find_by(type: "SendFinalNotificationLetterTask") - expect(page).to have_content(`#{appeal_final_letter_task.type} completed`) + expect(page).to have_content("#{appeal_final_letter_task.type} completed") expect(appeal_final_letter_task.status).to eq("completed") end @@ -144,7 +144,7 @@ # check the screen output and model status appeal_initial_letter_task = root_task.appeal.tasks.find_by(type: "SendFinalNotificationLetterTask") - expect(page).to have_content(`#{appeal_initial_letter_task.type} cancelled`) + expect(page).to have_content("#{appeal_initial_letter_task.type} cancelled") expect(appeal_initial_letter_task.status).to eq("cancelled") end end diff --git a/spec/feature/queue/send_initial_notification_letter_task_spec.rb b/spec/feature/queue/send_initial_notification_letter_task_spec.rb index c684ef1662a..a95731912dc 100644 --- a/spec/feature/queue/send_initial_notification_letter_task_spec.rb +++ b/spec/feature/queue/send_initial_notification_letter_task_spec.rb @@ -102,7 +102,7 @@ # check the screen output and model status appeal_initial_letter_task = root_task.appeal.tasks.find_by(type: "SendInitialNotificationLetterTask") - expect(page).to have_content(`#{appeal_initial_letter_task.type} cancelled`) + expect(page).to have_content("#{appeal_initial_letter_task.type} cancelled") expect(appeal_initial_letter_task.status).to eq("cancelled") end end diff --git a/spec/feature/queue/send_post_initial_notification_letter_holding_task_spec.rb b/spec/feature/queue/send_post_initial_notification_letter_holding_task_spec.rb index 655eef45474..c9ea4d8500b 100644 --- a/spec/feature/queue/send_post_initial_notification_letter_holding_task_spec.rb +++ b/spec/feature/queue/send_post_initial_notification_letter_holding_task_spec.rb @@ -107,7 +107,7 @@ # check the screen output and model status appeal_initial_letter_task = root_task.appeal.tasks.find_by(type: "PostSendInitialNotificationLetterHoldingTask") - expect(page).to have_content(`#{appeal_initial_letter_task.type} cancelled`) + expect(page).to have_content("#{appeal_initial_letter_task.type} cancelled") expect(appeal_initial_letter_task.status).to eq("cancelled") end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index d99306d1782..29cf67e0010 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -72,6 +72,11 @@ end end + config.before(:all) do + # This needs to be run in order for tests involving external tables to pass. + system("bundle exec rails r -e test db/scripts/external/create_vbms_ext_claim_table.rb") + end + config.before(:each) do @spec_time_zone = Time.zone Seeds::CaseDistributionLevers.new.seed! diff --git a/spec/services/claim_change_history/claim_history_event_spec.rb b/spec/services/claim_change_history/claim_history_event_spec.rb index 2fcfa6b6df8..1ee915d9c08 100644 --- a/spec/services/claim_change_history/claim_history_event_spec.rb +++ b/spec/services/claim_change_history/claim_history_event_spec.rb @@ -8,7 +8,7 @@ "id" => nil, "appeal_id" => 155, "appeal_type" => change_data_claim_type, - "assigned_at" => "2023-10-19 22:47:16.222148", + "assigned_at" => Time.zone.parse("2023-10-19 22:47:16.222148"), "assigned_to_id" => 200_000_022_2, "assigned_to_type" => "Organization", "decision_date" => change_data_decision_date, @@ -32,18 +32,18 @@ "request_issue_update_id" => 7, "request_issue_id" => request_issue_id, "request_issue_created_at" => request_issue_created_at, - "intake_completed_at" => "2023-10-19 22:39:14.270897", + "intake_completed_at" => Time.zone.parse("2023-10-19 22:39:14.270897"), "update_user_name" => "Tyler User", "intake_user_name" => "Monte Mann", "update_user_station_id" => "101", "intake_user_station_id" => "741", "decision_user_name" => nil, "decision_user_station_id" => nil, - "decision_created_at" => "2023-10-19 22:48:25.281657", + "decision_created_at" => Time.zone.parse("2023-10-19 22:48:25.281657"), "intake_user_css_id" => 200_000_601_2, "decision_user_css_id" => nil, "update_user_css_id" => 3992, - "request_issue_closed_at" => "2023-10-16 22:47:16.233187", + "request_issue_closed_at" => Time.zone.parse("2023-10-16 22:47:16.233187"), "event_user_name" => change_data_event_user_name, "event_date" => change_data_event_date, "task_versions" => version_changes, @@ -60,13 +60,13 @@ let(:change_data_event_user_name) { nil } let(:change_data_event_date) { nil } let(:change_data_decision_date) { "2023-05-31" } - let(:change_data_decision_date_added_at) { "2023-10-19 22:48:25.281657" } + let(:change_data_decision_date_added_at) { Time.zone.parse("2023-10-19 22:48:25.281657") } let(:version_changes) { nil } - let(:request_issue_update_time) { "2023-10-19 22:47:16.233187" } - let(:request_issue_created_at) { "2023-10-19 22:45:43.108934" } + let(:request_issue_update_time) { Time.zone.parse("2023-10-19 22:47:16.233187") } + let(:request_issue_created_at) { Time.zone.parse("2023-10-19 22:45:43.108934") } let(:event_attribute_data) do { - assigned_at: "2023-10-19 22:47:16.222148", + assigned_at: Time.zone.parse("2023-10-19 22:47:16.222148"), benefit_type: "vha", claim_type: "HigherLevelReview", claimant_name: "Bob Smithboehm", @@ -79,20 +79,20 @@ event_type: event_type, event_user_css_id: nil, event_user_name: nil, - intake_completed_date: "2023-10-19 22:39:14.270897", + intake_completed_date: Time.zone.parse("2023-10-19 22:39:14.270897"), issue_description: "Clothing allowance no decision date", issue_type: "Clothing Allowance", task_id: 124_28, task_status: "completed", user_facility: nil, veteran_file_number: "000100022", - withdrawal_request_date: "2023-10-16 22:47:16.233187" + withdrawal_request_date: Time.zone.parse("2023-10-16 22:47:16.233187") } end let(:status_event_attribute_data) do { - assigned_at: "2023-10-19 22:47:16.222148", + assigned_at: Time.zone.parse("2023-10-19 22:47:16.222148"), benefit_type: "vha", claim_type: "HigherLevelReview", claimant_name: "Bob Smithboehm", @@ -105,7 +105,7 @@ event_type: event_type, event_user_css_id: nil, event_user_name: nil, - intake_completed_date: "2023-10-19 22:39:14.270897", + intake_completed_date: Time.zone.parse("2023-10-19 22:39:14.270897"), issue_description: nil, issue_type: nil, task_id: 124_28, @@ -118,7 +118,7 @@ let(:intake_event_data) do { - event_date: date_string_to_iso8601(change_data["intake_completed_at"]), + event_date: change_data["intake_completed_at"], event_user_name: change_data["intake_user_name"], user_facility: change_data["intake_user_station_id"], event_user_css_id: change_data["intake_user_css_id"] @@ -127,7 +127,7 @@ let(:update_event_data) do { - event_date: date_string_to_iso8601(change_data["request_issue_created_at"]), + event_date: change_data["request_issue_created_at"], event_user_name: change_data["update_user_name"], user_facility: change_data["update_user_station_id"], event_user_css_id: change_data["update_user_css_id"] @@ -174,7 +174,7 @@ context "with dispostion" do let(:new_event_data) do { - event_date: date_string_to_iso8601(change_data["decision_created_at"]), + event_date: change_data["decision_created_at"], event_user_name: change_data["decision_user_name"], user_facility: change_data["decision_user_station_id"], event_user_css_id: change_data["decision_user_css_id"] @@ -230,10 +230,10 @@ expect(events.count).to eq(2) expect(events[0].event_type).to eq(:in_progress) expect(events[0].event_user_name).to eq("System") - expect(events[0].event_date).to eq("2023-11-08T19:22:47Z") + expect(events[0].event_date).to eq(Time.zone.parse("2023-11-08 19:22:47.227634704 UTC")) expect(events[1].event_type).to eq(:completed) expect(events[1].event_user_name).to eq("System") - expect(events[1].event_date).to eq("2023-11-09T19:22:47Z") + expect(events[1].event_date).to eq(Time.zone.parse("2023-11-09 19:22:47.244304624 Z")) end end @@ -257,10 +257,10 @@ expect(events.count).to eq(2) expect(events[0].event_type).to eq(:in_progress) expect(events[0].event_user_name).to eq("System") - expect(events[0].event_date).to eq("2023-11-09T23:16:15Z") + expect(events[0].event_date).to eq(Time.zone.parse("2023-11-09 23:16:15.724150103 Z")) expect(events[1].event_type).to eq(:cancelled) expect(events[1].event_user_name).to eq("System") - expect(events[1].event_date).to eq("2023-11-11T23:16:28Z") + expect(events[1].event_date).to eq(Time.zone.parse("2023-11-11 23:16:28.446399290 Z")) end end @@ -314,10 +314,10 @@ events.each do |event| expect(event.event_user_name).to eq("System") end - expect(assigned_event.event_date).to eq("2023-10-19T22:39:14Z") - expect(on_hold_event.event_date).to eq("2023-10-19T22:45:43Z") - expect(second_assigned_event.event_date).to eq("2023-10-19T22:47:16Z") - expect(completed_event.event_date).to eq("2023-10-19T22:48:25Z") + expect(assigned_event.event_date).to eq(Time.zone.parse("2023-10-19 22:39:14.207143000 Z")) + expect(on_hold_event.event_date).to eq(Time.zone.parse("2023-10-19 22:45:43.148742110 Z")) + expect(second_assigned_event.event_date).to eq(Time.zone.parse("2023-10-19 22:47:16.222311778 Z")) + expect(completed_event.event_date).to eq(Time.zone.parse("2023-10-19 22:48:25.324023984 Z")) end end @@ -369,9 +369,9 @@ events.each do |event| expect(event.event_user_name).to eq("System") end - expect(on_hold_event.event_date).to eq("2023-10-19T22:39:14Z") - expect(assigned_event.event_date).to eq("2023-10-19T22:47:16Z") - expect(completed_event.event_date).to eq("2023-10-19T22:48:25Z") + expect(on_hold_event.event_date).to eq(Time.zone.parse("2023-10-19 22:39:14.207143000 Z")) + expect(assigned_event.event_date).to eq(Time.zone.parse("2023-10-19 22:47:16.222311778 Z")) + expect(completed_event.event_date).to eq(Time.zone.parse("2023-10-19 22:48:25.324023984 Z")) end end @@ -382,7 +382,7 @@ event = subject[0] expect(event.event_type).to eq(:in_progress) expect(event.event_user_name).to eq("System") - expect(event.event_date).to eq(date_string_to_iso8601(change_data["intake_completed_at"])) + expect(event.event_date).to eq(change_data["intake_completed_at"]) end end @@ -396,10 +396,10 @@ expect(events.count).to eq(2) expect(events[0].event_type).to eq(:in_progress) expect(events[0].event_user_name).to eq("System") - expect(events[0].event_date).to eq(date_string_to_iso8601(change_data["intake_completed_at"])) + expect(events[0].event_date).to eq(change_data["intake_completed_at"]) expect(events[1].event_type).to eq(:cancelled) expect(events[1].event_user_name).to eq("System") - expect(events[1].event_date).to eq(date_string_to_iso8601(change_data["task_closed_at"])) + expect(events[1].event_date).to eq(change_data["task_closed_at"]) end end end @@ -419,7 +419,7 @@ before do # This attribute has to match within 15 seconds of the request issues update to guess the event type - request_issue.decision_date_added_at = DateTime.parse(change_data["request_issue_update_time"]) + request_issue.decision_date_added_at = change_data["request_issue_update_time"] request_issue.save! end @@ -429,7 +429,7 @@ it "should create an added_decision_date event" do event = subject[0] expect(event.event_type).to eq(:added_decision_date) - expect(event.event_date).to eq(date_string_to_iso8601(change_data["request_issue_update_time"])) + expect(event.event_date).to eq(change_data["request_issue_update_time"]) expect(event.event_user_name).to eq(change_data["update_user_name"]) expect(event.event_user_css_id).to eq(change_data["update_user_css_id"]) expect(event.decision_date).to eq(request_issue.decision_date) @@ -446,7 +446,7 @@ it "should create an added_decision_date event without a database fetch" do event = subject[0] expect(event.event_type).to eq(:added_decision_date) - expect(event.event_date).to eq(date_string_to_iso8601(change_data["request_issue_update_time"])) + expect(event.event_date).to eq(change_data["request_issue_update_time"]) expect(event.event_user_name).to eq(change_data["update_user_name"]) expect(event.event_user_css_id).to eq(change_data["update_user_css_id"]) expect(event.decision_date).to eq(change_data["decision_date"]) @@ -462,7 +462,7 @@ it "should create a :withdrew_issue event" do event = subject[0] expect(event.event_type).to eq(:withdrew_issue) - expect(event.event_date).to eq(date_string_to_iso8601(change_data["request_issue_update_time"])) + expect(event.event_date).to eq(change_data["request_issue_update_time"]) expect(event.event_user_name).to eq(change_data["update_user_name"]) expect(event.event_user_css_id).to eq(change_data["update_user_css_id"]) expect(event.decision_date).to eq(request_issue.decision_date) @@ -480,7 +480,7 @@ it "should create a :removed_issue event" do event = subject[0] expect(event.event_type).to eq(:removed_issue) - expect(event.event_date).to eq(date_string_to_iso8601(change_data["request_issue_update_time"])) + expect(event.event_date).to eq(change_data["request_issue_update_time"]) expect(event.event_user_name).to eq(change_data["update_user_name"]) expect(event.event_user_css_id).to eq(change_data["update_user_css_id"]) expect(event.decision_date).to eq(request_issue.decision_date) @@ -497,7 +497,7 @@ nonrating_issue_description: "Updated issue description", decision_date: Time.zone.today, # This attribute has to match within 15 seconds of the request issues update to guess the event type - decision_date_added_at: DateTime.parse(change_data["request_issue_update_time"])) + decision_date_added_at: change_data["request_issue_update_time"]) end before do @@ -626,7 +626,7 @@ expect(subject.event_user_css_id).to eq("NEWUSER") expect(subject.event_user_name).to eq("Update Fetch") expect(subject.user_facility).to eq("103") - expect(subject.event_date).to eq(date_string_to_iso8601(request_issue_created_at)) + expect(subject.event_date).to eq(request_issue_created_at) end end end @@ -652,11 +652,14 @@ let(:request_issue_id) { request_issue.id } let(:request_issue_hash) do + # You have to reload here because the full precision in Time.zone.now remains in the created object, + # but is not saved in the database + request_issue.reload { "nonrating_issue_category" => request_issue.nonrating_issue_category, "nonrating_issue_description" => request_issue.nonrating_issue_description, "decision_date" => request_issue.decision_date, - "decision_date_added_at" => request_issue.decision_date_added_at.iso8601, + "decision_date_added_at" => request_issue.decision_date_added_at, "request_issue_closed_at" => request_issue.closed_at } end @@ -1128,8 +1131,4 @@ def expect_attributes(object_instance, attribute_value_pairs) expect(object_instance.send(attribute)).to eq(expected_value) end end - - def date_string_to_iso8601(date_string) - DateTime.parse(date_string).iso8601 - end end diff --git a/spec/sql/basic_spec.rb b/spec/sql/basic_spec.rb index dc62e436ec0..913449ecd1a 100644 --- a/spec/sql/basic_spec.rb +++ b/spec/sql/basic_spec.rb @@ -7,7 +7,16 @@ let!(:appeal) { create(:appeal) } it "runs SQL" do - expect_sql("basic_appeal").to eq([appeal.as_hash]) + result = execute_sql("basic_appeal") + timestamp_fields = %w[created_at updated_at established_at receipt_date] + + aggregate_failures do + expect(result).to match_array(hash_including(**appeal.attributes.except(*timestamp_fields))) + + result.first.slice(*timestamp_fields).each do |timestamp_field, timestamp_value| + expect(timestamp_value.to_datetime.to_i).to eq(appeal[timestamp_field].to_datetime.to_i) + end + end end end @@ -15,7 +24,7 @@ let!(:appeal) { create(:appeal, established_at: Time.utc(2010, 3, 30, 5, 43, "25.12".to_r)) } it "rounds correctly" do - expect_sql("basic_appeal").to eq([appeal.as_hash]) + expect_sql("basic_appeal").to match_array(hash_including("established_at" => appeal.established_at)) end end end diff --git a/spec/sql/timed_hold_task_sql_spec.rb b/spec/sql/timed_hold_task_sql_spec.rb index 98ef454c541..8a51311ee59 100644 --- a/spec/sql/timed_hold_task_sql_spec.rb +++ b/spec/sql/timed_hold_task_sql_spec.rb @@ -18,7 +18,7 @@ it "generates correct report" do expect_sql("timed-hold-task").to include( hash_including( - "timer_will_trigger" => timed_hold_task.task_timers.first.as_hash[:last_submitted_at] + "timer_will_trigger" => timed_hold_task.task_timers.first.last_submitted_at ) ) end From f0c163c5a57474ca5e0c67e9f943aa7cef233b8a Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Mon, 25 Mar 2024 22:55:06 -0400 Subject: [PATCH 02/41] Minor improvements to VANotify jobs - Adds a new NotificationInitializationError class to handle SendNotificationJob failures when requisite information is absent. - Ensures the current_user is always set in the RequestStore for each SendNotificationJob execution. - Limits the maximum number of retries to 5 for SendNotificationJobs since anything past then causes an exception to be thrown due to excess delay time (>15 minutes). The exponential backoff algorithm Shoryuken uses surpasses 15 minutes at the 6th retry. --- app/jobs/quarterly_notifications_job.rb | 15 +-- app/jobs/send_notification_job.rb | 128 +++++++++++++----------- lib/caseflow/error.rb | 7 ++ 3 files changed, 84 insertions(+), 66 deletions(-) diff --git a/app/jobs/quarterly_notifications_job.rb b/app/jobs/quarterly_notifications_job.rb index bd71d881398..0c7a686f2bb 100644 --- a/app/jobs/quarterly_notifications_job.rb +++ b/app/jobs/quarterly_notifications_job.rb @@ -1,8 +1,11 @@ # frozen_string_literal: true class QuarterlyNotificationsJob < CaseflowJob + include Hearings::EnsureCurrentUserIsSet + queue_with_priority :low_priority application_attr :hearing_schedule + QUERY_LIMIT = ENV["QUARTERLY_NOTIFICATIONS_JOB_BATCH_SIZE"] # Purpose: Loop through all open appeals quarterly and sends statuses for VA Notify @@ -11,7 +14,8 @@ class QuarterlyNotificationsJob < CaseflowJob # # Response: None def perform # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity - RequestStore.store[:current_user] = User.system_user + 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| @@ -47,15 +51,6 @@ def perform # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/Per private - # Purpose: Method to be called with an error need to be logged to the rails logger - # - # Params: error_message (Expecting a string) - Message to be logged to the logger - # - # Response: None - def log_error(error_message) - Rails.logger.error(error_message) - end - # Purpose: Method to check appeal state for statuses and send out a notification based on # which statuses are turned on in the appeal state # diff --git a/app/jobs/send_notification_job.rb b/app/jobs/send_notification_job.rb index 771133f38ce..d0356f188cd 100644 --- a/app/jobs/send_notification_job.rb +++ b/app/jobs/send_notification_job.rb @@ -4,18 +4,20 @@ # This job saves the data to an audit table and If the corresponding feature flag is enabled will send # an email or SMS request to VA Notify API class SendNotificationJob < CaseflowJob + include Hearings::EnsureCurrentUserIsSet + queue_as ApplicationController.dependencies_faked? ? :send_notifications : :"send_notifications.fifo" application_attr :hearing_schedule - retry_on(Caseflow::Error::VANotifyNotFoundError, attempts: 10, wait: :exponentially_longer) do |job, exception| + retry_on(Caseflow::Error::VANotifyNotFoundError, attempts: 5, wait: :exponentially_longer) do |job, exception| Rails.logger.error("Retrying #{job.class.name} (#{job.job_id}) because failed with error: #{exception}") end - retry_on(Caseflow::Error::VANotifyInternalServerError, attempts: 10, wait: :exponentially_longer) do |job, exception| + retry_on(Caseflow::Error::VANotifyInternalServerError, attempts: 5, wait: :exponentially_longer) do |job, exception| Rails.logger.error("Retrying #{job.class.name} (#{job.job_id}) because failed with error: #{exception}") end - retry_on(Caseflow::Error::VANotifyRateLimitError, attempts: 10, wait: :exponentially_longer) do |job, exception| + retry_on(Caseflow::Error::VANotifyRateLimitError, attempts: 5, wait: :exponentially_longer) do |job, exception| Rails.logger.error("Retrying #{job.class.name} (#{job.job_id}) because failed with error: #{exception}") end @@ -28,63 +30,86 @@ class SendNotificationJob < CaseflowJob end # Must receive JSON string as argument + def perform(message_json) + ensure_current_user_is_set + + begin + unless message_json + fail NotificationInitializationError( + message: "There was no message passed into the " \ + "SendNotificationListener.perform_later function. Exiting job." + ) + end + + handle_message_json(message_json) + rescue StandardError => error + log_error(error) + end + end + private + + # Purpose: Conditionally handles a JSON outline of a notification and maybe sends it to + # to a veteran via VANotify. + # + # Params: A JSON object containing notification data + # + # Response: nil # rubocop:disable Layout/LineLength, Metrics/BlockNesting - def perform(message_json) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity - if message_json - @va_notify_email = FeatureToggle.enabled?(:va_notify_email) - @va_notify_sms = FeatureToggle.enabled?(:va_notify_sms) - @va_notify_quarterly_sms = FeatureToggle.enabled?(:va_notify_quarterly_sms) - message = JSON.parse(message_json, object_class: OpenStruct) - if message.appeal_id && message.appeal_type && message.template_name - notification_audit_record = create_notification_audit_record( - message.appeal_id, - message.appeal_type, - message.template_name, - message.participant_id - ) - if notification_audit_record - if message.status != "No participant_id" && message.status != "No claimant" - to_update = {} - if @va_notify_email - to_update[:email_notification_status] = message.status - end - if @va_notify_sms && message.template_name != "Quarterly Notification" || - @va_notify_quarterly_sms && message.template_name == "Quarterly Notification" - to_update[:sms_notification_status] = message.status - end - update_notification_audit_record(notification_audit_record, to_update) - if message.template_name == "Appeal docketed" && message.appeal_type == "LegacyAppeal" && !FeatureToggle.enabled?(:appeal_docketed_notification) - notification_audit_record.update!(email_enabled: false) - else send_to_va_notify(message, notification_audit_record) - end + def handle_message_json(message_json) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity + @va_notify_email = FeatureToggle.enabled?(:va_notify_email) + @va_notify_sms = FeatureToggle.enabled?(:va_notify_sms) + @va_notify_quarterly_sms = FeatureToggle.enabled?(:va_notify_quarterly_sms) + message = JSON.parse(message_json, object_class: OpenStruct) + if message.appeal_id && message.appeal_type && message.template_name + notification_audit_record = create_notification_audit_record( + message.appeal_id, + message.appeal_type, + message.template_name, + message.participant_id + ) + if notification_audit_record + if message.status != "No participant_id" && message.status != "No claimant" + to_update = {} + if @va_notify_email + to_update[:email_notification_status] = message.status + end + if @va_notify_sms && message.template_name != "Quarterly Notification" || + @va_notify_quarterly_sms && message.template_name == "Quarterly Notification" + to_update[:sms_notification_status] = message.status + end + update_notification_audit_record(notification_audit_record, to_update) + if message.template_name == "Appeal docketed" && message.appeal_type == "LegacyAppeal" && !FeatureToggle.enabled?(:appeal_docketed_notification) + notification_audit_record.update!(email_enabled: false) else - status = (message.status == "No participant_id") ? "No Participant Id Found" : "No Claimant Found" - to_update = {} - if @va_notify_email - to_update[:email_notification_status] = status - end - if @va_notify_sms && message.template_name != "Quarterly Notification" || - @va_notify_quarterly_sms && message.template_name == "Quarterly Notification" - to_update[:sms_notification_status] = status - end - update_notification_audit_record(notification_audit_record, to_update) + send_to_va_notify(message, notification_audit_record) end - notification_audit_record.save! else - log_error("Audit record was unable to be found or created in SendNotificationListnerJob. Exiting Job.") + status = (message.status == "No participant_id") ? "No Participant Id Found" : "No Claimant Found" + to_update = {} + if @va_notify_email + to_update[:email_notification_status] = status + end + if @va_notify_sms && message.template_name != "Quarterly Notification" || + @va_notify_quarterly_sms && message.template_name == "Quarterly Notification" + to_update[:sms_notification_status] = status + end + update_notification_audit_record(notification_audit_record, to_update) end + notification_audit_record.save! else - log_error("appeals_id or appeal_type or event_type was nil in the SendNotificationListnerJob. Exiting job.") + fail NotificationInitializationError( + message: "Audit record was unable to be found or created in SendNotificationListnerJob. Exiting Job." + ) end else - log_error("There was no message passed into the SendNotificationListener.perform_later function. Exiting job.") + fail NotificationInitializationError( + message: "appeals_id or appeal_type or event_type was nil in the SendNotificationListnerJob. Exiting job." + ) end end # rubocop:enable Layout/LineLength, Metrics/BlockNesting - private - # Purpose: Updates and saves notification status for notification_audit_record # # Params: notification_audit_record: object, @@ -149,15 +174,6 @@ def send_to_va_notify(message, notification_audit_record) # rubocop:disable Metr end end - # Purpose: Method to be called with an error need to be logged to the rails logger - # - # Params: error_message (Expecting a string) - Message to be logged to the logger - # - # Response: None - def log_error(error_message) - Rails.logger.error(error_message) - end - # Purpose: Method to create a new notification table row for the appeal # # Params: diff --git a/lib/caseflow/error.rb b/lib/caseflow/error.rb index 6aef270435d..b0e23c065bb 100644 --- a/lib/caseflow/error.rb +++ b/lib/caseflow/error.rb @@ -463,6 +463,13 @@ class VANotifyInternalServerError < VANotifyApiError; end class VANotifyRateLimitError < VANotifyApiError; end class EmptyQueueError < StandardError; end class InvalidNotificationStatusFormat < StandardError; end + class NotificationInitializationError < SerializableError + attr_accessor :message + + def initialize(args = {}) + @message = args[:message] + end + end # Pacman errors class PacmanApiError < StandardError From 83b3f0f1283a2f21e472db8be8eb12c6c14006ab Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Mon, 25 Mar 2024 23:39:17 -0400 Subject: [PATCH 03/41] Update some specs to reflect new error classes --- app/jobs/send_notification_job.rb | 17 +++++++---------- spec/jobs/send_notification_job_spec.rb | 20 +++++++++++++++++--- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/jobs/send_notification_job.rb b/app/jobs/send_notification_job.rb index d0356f188cd..4f8cfddfe21 100644 --- a/app/jobs/send_notification_job.rb +++ b/app/jobs/send_notification_job.rb @@ -35,10 +35,9 @@ def perform(message_json) begin unless message_json - fail NotificationInitializationError( - message: "There was no message passed into the " \ - "SendNotificationListener.perform_later function. Exiting job." - ) + fail Caseflow::Error::NotificationInitializationError, + message: "There was no message passed into the " \ + "SendNotificationListener.perform_later function. Exiting job." end handle_message_json(message_json) @@ -98,14 +97,12 @@ def handle_message_json(message_json) # rubocop:disable Metrics/AbcSize, Metrics end notification_audit_record.save! else - fail NotificationInitializationError( - message: "Audit record was unable to be found or created in SendNotificationListnerJob. Exiting Job." - ) + fail Caseflow::Error::NotificationInitializationError, + message: "Audit record was unable to be found or created in SendNotificationListnerJob. Exiting Job." end else - fail NotificationInitializationError( - message: "appeals_id or appeal_type or event_type was nil in the SendNotificationListnerJob. Exiting job." - ) + fail Caseflow::Error::NotificationInitializationError, + message: "appeals_id or appeal_type or event_type was nil in the SendNotificationListnerJob. Exiting job." end end # rubocop:enable Layout/LineLength, Metrics/BlockNesting diff --git a/spec/jobs/send_notification_job_spec.rb b/spec/jobs/send_notification_job_spec.rb index 7f1de170542..5448aecb1d6 100644 --- a/spec/jobs/send_notification_job_spec.rb +++ b/spec/jobs/send_notification_job_spec.rb @@ -146,6 +146,7 @@ context ".perform" do subject(:job) { SendNotificationJob.perform_later(good_message.to_json) } + describe "send message to queue" do it "has one message in queue" do expect { job }.to change(ActiveJob::Base.queue_adapter.enqueued_jobs, :size).by(1) @@ -160,23 +161,36 @@ end it "logs error when message is nil" do - expect(Rails.logger).to receive(:error).with(/There was no message passed/) perform_enqueued_jobs do + expect_any_instance_of(SendNotificationJob).to receive(:log_error) do |_recipient, error_received| + expect(error_received.message).to eq "There was no message passed into the " \ + "SendNotificationListener.perform_later function. Exiting job." + end + SendNotificationJob.perform_later(nil) end end it "logs error when appeals_id, appeals_type, or event_type is nil" do - expect(Rails.logger).to receive(:error).with(/appeals_id or appeal_type or event_type/) perform_enqueued_jobs do + expect_any_instance_of(SendNotificationJob).to receive(:log_error) do |_recipient, error_received| + expect(error_received.message).to eq "appeals_id or appeal_type or event_type was nil " \ + "in the SendNotificationListnerJob. Exiting job." + end + SendNotificationJob.perform_later(fail_create_message.to_json) end end it "logs error when audit record is nil" do allow_any_instance_of(SendNotificationJob).to receive(:create_notification_audit_record).and_return(nil) - expect(Rails.logger).to receive(:error).with(/Audit record was unable to be found or created/) + perform_enqueued_jobs do + expect_any_instance_of(SendNotificationJob).to receive(:log_error) do |_recipient, error_received| + expect(error_received.message).to eq "Audit record was unable to be found or created " \ + "in SendNotificationListnerJob. Exiting Job." + end + SendNotificationJob.perform_later(good_message.to_json) end end From d6090053d929905aec579205211284fd4f3f6190 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Tue, 26 Mar 2024 08:09:56 -0400 Subject: [PATCH 04/41] Fix linting issue --- spec/jobs/send_notification_job_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/jobs/send_notification_job_spec.rb b/spec/jobs/send_notification_job_spec.rb index 5448aecb1d6..99b391fa1e8 100644 --- a/spec/jobs/send_notification_job_spec.rb +++ b/spec/jobs/send_notification_job_spec.rb @@ -163,7 +163,7 @@ it "logs error when message is nil" do perform_enqueued_jobs do expect_any_instance_of(SendNotificationJob).to receive(:log_error) do |_recipient, error_received| - expect(error_received.message).to eq "There was no message passed into the " \ + expect(error_received.message).to eq "There was no message passed into the " \ "SendNotificationListener.perform_later function. Exiting job." end From ba9ab1fb0f5b23cd757f9d5bf50cdc21e86c8e16 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Tue, 26 Mar 2024 08:45:15 -0400 Subject: [PATCH 05/41] Fix a spelling error --- app/jobs/send_notification_job.rb | 6 +++--- spec/jobs/send_notification_job_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/jobs/send_notification_job.rb b/app/jobs/send_notification_job.rb index 4f8cfddfe21..1a145882481 100644 --- a/app/jobs/send_notification_job.rb +++ b/app/jobs/send_notification_job.rb @@ -37,7 +37,7 @@ def perform(message_json) unless message_json fail Caseflow::Error::NotificationInitializationError, message: "There was no message passed into the " \ - "SendNotificationListener.perform_later function. Exiting job." + "SendNotificationJob.perform_later function. Exiting job." end handle_message_json(message_json) @@ -98,11 +98,11 @@ def handle_message_json(message_json) # rubocop:disable Metrics/AbcSize, Metrics notification_audit_record.save! else fail Caseflow::Error::NotificationInitializationError, - message: "Audit record was unable to be found or created in SendNotificationListnerJob. Exiting Job." + message: "Audit record was unable to be found or created in SendNotificationJob. Exiting Job." end else fail Caseflow::Error::NotificationInitializationError, - message: "appeals_id or appeal_type or event_type was nil in the SendNotificationListnerJob. Exiting job." + message: "appeals_id or appeal_type or event_type was nil in the SendNotificationJob. Exiting job." end end # rubocop:enable Layout/LineLength, Metrics/BlockNesting diff --git a/spec/jobs/send_notification_job_spec.rb b/spec/jobs/send_notification_job_spec.rb index 99b391fa1e8..9ad5ffb21de 100644 --- a/spec/jobs/send_notification_job_spec.rb +++ b/spec/jobs/send_notification_job_spec.rb @@ -164,7 +164,7 @@ perform_enqueued_jobs do expect_any_instance_of(SendNotificationJob).to receive(:log_error) do |_recipient, error_received| expect(error_received.message).to eq "There was no message passed into the " \ - "SendNotificationListener.perform_later function. Exiting job." + "SendNotificationJob.perform_later function. Exiting job." end SendNotificationJob.perform_later(nil) @@ -175,7 +175,7 @@ perform_enqueued_jobs do expect_any_instance_of(SendNotificationJob).to receive(:log_error) do |_recipient, error_received| expect(error_received.message).to eq "appeals_id or appeal_type or event_type was nil " \ - "in the SendNotificationListnerJob. Exiting job." + "in the SendNotificationJob. Exiting job." end SendNotificationJob.perform_later(fail_create_message.to_json) @@ -188,7 +188,7 @@ perform_enqueued_jobs do expect_any_instance_of(SendNotificationJob).to receive(:log_error) do |_recipient, error_received| expect(error_received.message).to eq "Audit record was unable to be found or created " \ - "in SendNotificationListnerJob. Exiting Job." + "in SendNotificationJob. Exiting Job." end SendNotificationJob.perform_later(good_message.to_json) From e412e6d2ff74404ea87e8c0b0bff0ebcf9b03f34 Mon Sep 17 00:00:00 2001 From: Andrew Hadley Date: Mon, 25 Mar 2024 13:40:30 -0400 Subject: [PATCH 06/41] added logic for deciding aod on attorney claimant --- app/models/attorney_claimant.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/attorney_claimant.rb b/app/models/attorney_claimant.rb index 663649f16eb..4a258cdb8f1 100644 --- a/app/models/attorney_claimant.rb +++ b/app/models/attorney_claimant.rb @@ -9,16 +9,16 @@ class AttorneyClaimant < Claimant delegate :name, to: :bgs_attorney - def advanced_on_docket?(_appeal) - false + def advanced_on_docket?(appeal) + advanced_on_docket_motion_granted?(appeal) end def advanced_on_docket_based_on_age? false end - def advanced_on_docket_motion_granted?(_appeal) - false + def advanced_on_docket_motion_granted?(appeal) + AdvanceOnDocketMotion.granted.for_appeal(appeal).any? end def relationship From 3bd445cc5e965c110bec741b9b41797987bbb170 Mon Sep 17 00:00:00 2001 From: Andrew Hadley Date: Mon, 25 Mar 2024 14:57:20 -0400 Subject: [PATCH 07/41] added tests --- spec/factories/appeal.rb | 29 +++++++++++++++++++++++++++++ spec/models/appeal_spec.rb | 13 +++++++++++++ 2 files changed, 42 insertions(+) diff --git a/spec/factories/appeal.rb b/spec/factories/appeal.rb index 37c270ffd47..d4e717cfb87 100644 --- a/spec/factories/appeal.rb +++ b/spec/factories/appeal.rb @@ -288,6 +288,35 @@ end end + trait :advanced_on_docket_attorney_claimant do + # the appeal has to be established before the motion is created to apply to it. + established_at { Time.zone.now - 1 } + after(:create) do |appeal| + # Create an appeal with two claimants, one with a denied AOD motion + # and one with a granted motion. The appeal should still be counted as AOD. Appeals only support one claimant, + # so set the aod claimant as the last claimant on the appeal (and create it last) + another_claimant = create(:claimant, decision_review: appeal) + create(:advance_on_docket_motion, person: another_claimant.person, granted: false, appeal: appeal) + + claimant = create(:claimant, decision_review: appeal) + create(:advance_on_docket_motion, person: claimant.person, granted: true, appeal: appeal) + + appeal.claimants = [another_claimant, claimant] + end + end + + trait :advanced_on_docket_granted_attorney_claimant do + # the appeal has to be established before the motion is created to apply to it. + established_at { Time.zone.now - 1 } + after(:create) do |appeal| + # Create an appeal with a granted AOD motion + claimant = create(:claimant, :attorney, decision_review: appeal) + create(:advance_on_docket_motion, person: claimant.person, granted: true, appeal: appeal) + + appeal.claimants = [claimant] + end + end + trait :cancelled do after(:create) do |appeal, _evaluator| # make sure a request issue exists, then mark all removed diff --git a/spec/models/appeal_spec.rb b/spec/models/appeal_spec.rb index fd781fbfacc..a9470c19f72 100644 --- a/spec/models/appeal_spec.rb +++ b/spec/models/appeal_spec.rb @@ -579,6 +579,19 @@ end end + context "when there is a granted aod, claimant is an AttorneyClaimant and aod_based_on_age is false" do + let(:appeal) { create(:appeal, :advanced_on_docket_granted_attorney_claimant) } + + it "returns true" do + expect(appeal.advanced_on_docket?).to eq(true) + expect(appeal.aod_based_on_age).to eq(false) + end + + it "does not return nil" do + expect(appeal.advanced_on_docket?).not_to eq(nil) + end + end + context "#find_appeal_by_uuid_or_find_or_create_legacy_appeal_by_vacols_id" do context "with a uuid (AMA appeal id)" do let(:veteran_file_number) { "64205050" } From d791892861e04c4bd1022f45567992fb9a6043d3 Mon Sep 17 00:00:00 2001 From: Andrew Hadley Date: Mon, 25 Mar 2024 16:36:26 -0400 Subject: [PATCH 08/41] refactored test to return true when motion is granted --- spec/models/claimant_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/models/claimant_spec.rb b/spec/models/claimant_spec.rb index 1ba955b144d..13a97457cfb 100644 --- a/spec/models/claimant_spec.rb +++ b/spec/models/claimant_spec.rb @@ -171,10 +171,13 @@ create(:advance_on_docket_motion, person_id: claimant.person.id, granted: true, appeal: appeal) end - it "returns false" do + it "returns false when based on age" do expect(claimant.advanced_on_docket_based_on_age?).to eq(false) - expect(claimant.advanced_on_docket_motion_granted?(appeal)).to eq(false) - expect(claimant.advanced_on_docket?(appeal)).to eq(false) + end + + it "returns true when motion is granted" do + expect(claimant.advanced_on_docket_motion_granted?(appeal)).to eq(true) + expect(claimant.advanced_on_docket?(appeal)).to eq(true) end end end From d7fc8728ac3685a6b4f35fdf348c2d927507b39d Mon Sep 17 00:00:00 2001 From: Christian Cain <149622375+christian-cain-bah@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:01:53 -0500 Subject: [PATCH 09/41] Hotfix/appeals 21696 (#21207) * fix(create conference): update test for nil appellant email * fix(create conference): nil appellant email check * fix(conference job): lint * fix(create conference): minor --- app/jobs/hearings/send_email.rb | 12 +++++-- .../create_conference_job_spec.rb | 34 ++++++++++++++----- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/app/jobs/hearings/send_email.rb b/app/jobs/hearings/send_email.rb index 76b8e238b1e..1a55d0f7625 100644 --- a/app/jobs/hearings/send_email.rb +++ b/app/jobs/hearings/send_email.rb @@ -29,7 +29,7 @@ def call # already been sent too. return if send_reminder - if !appellant_recipient.email_sent + if should_appellant_receive_email? appellant_recipient.update!(email_sent: send_email(appellant_recipient_info)) end @@ -37,7 +37,7 @@ def call judge_recipient.update!(email_sent: send_email(judge_recipient_info)) end - if representative_recipient&.email_address.present? && !representative_recipient.email_sent + if should_representative_receive_email? representative_recipient.update!(email_sent: send_email(representative_recipient_info)) end end @@ -238,4 +238,12 @@ def should_judge_receive_email? !hearing.judge_recipient&.email_sent && %w[confirmation updated_time_confirmation].include?(type) end + + def should_appellant_receive_email? + appellant_recipient&.email_address.present? && !appellant_recipient&.email_sent + end + + def should_representative_receive_email? + representative_recipient&.email_address.present? && !representative_recipient&.email_sent + end end diff --git a/spec/jobs/virtual_hearings/create_conference_job_spec.rb b/spec/jobs/virtual_hearings/create_conference_job_spec.rb index ea4297cedfb..a9a9003c0cc 100644 --- a/spec/jobs/virtual_hearings/create_conference_job_spec.rb +++ b/spec/jobs/virtual_hearings/create_conference_job_spec.rb @@ -85,16 +85,32 @@ end end - it "creates a conference", :aggregate_failures do - subject.perform_now + shared_examples "conference created" do + it "creates a conference", :aggregate_failures do + subject.perform_now + + virtual_hearing.reload + expect(virtual_hearing.conference_id).to eq(9001) + expect(virtual_hearing.status).to eq(:active) + expect(virtual_hearing.alias).to eq("0000001") + expect(virtual_hearing.alias_with_host).to eq("BVA0000001@#{pexip_url}") + expect(virtual_hearing.host_pin.to_s.length).to eq(8) + expect(virtual_hearing.guest_pin.to_s.length).to eq(11) + end + end - virtual_hearing.reload - expect(virtual_hearing.conference_id).to eq(9001) - expect(virtual_hearing.status).to eq(:active) - expect(virtual_hearing.alias).to eq("0000001") - expect(virtual_hearing.alias_with_host).to eq("BVA0000001@#{pexip_url}") - expect(virtual_hearing.host_pin.to_s.length).to eq(8) - expect(virtual_hearing.guest_pin.to_s.length).to eq(11) + context "conference creation" do + context "when all emails present" do + include_examples "conference created" + end + + context "when appealant email is missing" do + before do + virtual_hearing.update!(appellant_email: nil) + end + + include_examples "conference created" + end end include_examples "confirmation emails are sent" From 6724cfbb5b325acc4a845651c637e53da2d65f71 Mon Sep 17 00:00:00 2001 From: Aiman Kayad Date: Fri, 29 Mar 2024 14:02:01 -0400 Subject: [PATCH 10/41] Hotfix/appeals 23420 v3 (#21250) * Add LegacyAppealSearchSerializer to rendering * Make additional improvements to the Legacy Serializer * Add MST and PACT to both search serializers respectively --------- Co-authored-by: raymond-hughes --- .../work_queue/appeal_search_serializer.rb | 14 +++++++-- .../legacy_appeal_search_serializer.rb | 31 +++---------------- app/workflows/case_search_results_base.rb | 2 +- client/app/queue/utils.js | 6 +++- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/app/models/serializers/work_queue/appeal_search_serializer.rb b/app/models/serializers/work_queue/appeal_search_serializer.rb index fcc206a97a8..90be5a6f498 100644 --- a/app/models/serializers/work_queue/appeal_search_serializer.rb +++ b/app/models/serializers/work_queue/appeal_search_serializer.rb @@ -8,6 +8,10 @@ class WorkQueue::AppealSearchSerializer attribute :contested_claim, &:contested_claim? + attribute :mst, &:mst? + + attribute :pact, &:pact? + attribute :issues do |object| object.request_issues.active_or_decided_or_withdrawn.includes(:remand_reasons).map do |issue| { @@ -18,7 +22,11 @@ class WorkQueue::AppealSearchSerializer diagnostic_code: issue.contested_rating_issue_diagnostic_code, remand_reasons: issue.remand_reasons, closed_status: issue.closed_status, - decision_date: issue.decision_date + decision_date: issue.decision_date, + mst_status: FeatureToggle.enabled?(:mst_identification) ? issue.mst_status : false, + pact_status: FeatureToggle.enabled?(:pact_identification) ? issue.pact_status : false, + mst_justification: issue&.mst_status_update_reason_notes, + pact_justification: issue&.pact_status_update_reason_notes } end end @@ -39,7 +47,9 @@ class WorkQueue::AppealSearchSerializer benefit_type: issue.benefit_type, remand_reasons: issue.remand_reasons, diagnostic_code: issue.diagnostic_code, - request_issue_ids: issue.request_decision_issues.pluck(:request_issue_id) + request_issue_ids: issue.request_decision_issues.pluck(:request_issue_id), + mst_status: FeatureToggle.enabled?(:mst_identification) ? issue.mst_status : false, + pact_status: FeatureToggle.enabled?(:pact_identification) ? issue.pact_status : false } end end diff --git a/app/models/serializers/work_queue/legacy_appeal_search_serializer.rb b/app/models/serializers/work_queue/legacy_appeal_search_serializer.rb index 7cd374f20e6..5a1dbaaa76c 100644 --- a/app/models/serializers/work_queue/legacy_appeal_search_serializer.rb +++ b/app/models/serializers/work_queue/legacy_appeal_search_serializer.rb @@ -21,19 +21,11 @@ class WorkQueue::LegacyAppealSearchSerializer attribute :completed_hearing_on_previous_appeal? - attribute :appellant_is_not_veteran, &:appellant_is_not_veteran - attribute :appellant_full_name, &:appellant_name - attribute :appellant_address, &:appellant_address - - attribute :appellant_tz, &:appellant_tz - - attribute :appellant_relationship attribute :assigned_to_location attribute :vbms_id, &:sanitized_vbms_id attribute :veteran_full_name - attribute :veteran_death_date attribute :veteran_appellant_deceased, &:veteran_appellant_deceased? # Aliasing the vbms_id to make it clear what we're returning. attribute :veteran_file_number, &:sanitized_vbms_id @@ -59,27 +51,16 @@ class WorkQueue::LegacyAppealSearchSerializer object.veteran ? object.veteran.id : nil end + attribute :mst, &:mst? + + attribute :pact, &:pact? + attribute(:available_hearing_locations) { |object| available_hearing_locations(object) } attribute :docket_name do "legacy" end - attribute :document_id do |object| - latest_vacols_attorney_case_review(object)&.document_id - end - - attribute :can_edit_document_id do |object, params| - LegacyDocumentIdPolicy.new( - user: params[:user], - case_review: latest_vacols_attorney_case_review(object) - ).editable? - end - - attribute :attorney_case_review_id do |object| - latest_vacols_attorney_case_review(object)&.vacols_id - end - attribute :current_user_email do |_, params| params[:user]&.email end @@ -93,8 +74,4 @@ class WorkQueue::LegacyAppealSearchSerializer WorkQueue::PriorlocSerializer.new(location).serializable_hash[:data][:attributes] end end - - def self.latest_vacols_attorney_case_review(object) - VACOLS::CaseAssignment.latest_task_for_appeal(object.vacols_id) - end end diff --git a/app/workflows/case_search_results_base.rb b/app/workflows/case_search_results_base.rb index 46abed53883..ea30ccd739e 100644 --- a/app/workflows/case_search_results_base.rb +++ b/app/workflows/case_search_results_base.rb @@ -90,7 +90,7 @@ def search_page_json_appeals(appeals) ama_appeals, is_collection: true, params: { user: user } ).serializable_hash - legacy_hash = WorkQueue::LegacyAppealSerializer.new( + legacy_hash = WorkQueue::LegacyAppealSearchSerializer.new( legacy_appeals, is_collection: true, params: { user: user } ).serializable_hash diff --git a/client/app/queue/utils.js b/client/app/queue/utils.js index 0c078130bbf..50b5a066089 100644 --- a/client/app/queue/utils.js +++ b/client/app/queue/utils.js @@ -563,7 +563,9 @@ export const prepareAppealForSearchStore = (appeals) => { appeal.attributes.readable_hearing_request_type, readableOriginalHearingRequestType: appeal.attributes.readable_original_hearing_request_type, - vacateType: appeal.attributes.vacate_type + vacateType: appeal.attributes.vacate_type, + mst: appeal.attributes.mst, + pact: appeal.attributes.pact }; return accumulator; @@ -594,6 +596,8 @@ export const prepareAppealForSearchStore = (appeals) => { regionalOffice: appeal.attributes.regional_office, caseflowVeteranId: appeal.attributes.caseflow_veteran_id, locationHistory: prepareLocationHistoryForStore(appeal), + mst: appeal.attributes.mst, + pact: appeal.attributes.pact }; return accumulator; From e4e2b61d2f6101a50acce4e779ba8ebb69c1a9ea Mon Sep 17 00:00:00 2001 From: Jeremy Croteau Date: Fri, 29 Mar 2024 15:03:23 -0400 Subject: [PATCH 11/41] =?UTF-8?q?=F0=9F=94=A7=20Bypass=20DNS=20rebinding?= =?UTF-8?q?=20protection=20for=20all=20`demo`=20sub-domains=20(#21307)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rails 6 introduced DNS rebinding protection by default in development environments. Attempting to access domains other than `localhost` will likely result in an error like ``` Blocked host: yourcustomdomain.com ``` This change will bypass DNS rebinding protection on all sub-domains of `demo.appeals.va.gov`, so that we can load pages unimpeded in demo environments going forward. --- config/environments/development.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/environments/development.rb b/config/environments/development.rb index 1a33636ee4c..e26962cc7e2 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -70,6 +70,9 @@ # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker + # Bypass DNS rebinding protection for all `demo` sub-domains + config.hosts << ".demo.appeals.va.gov" + #===================================================================================================================== # Please keep custom config settings below this comment. # This will ensure cleaner diffs when generating config file changes during Rails upgrades. From 6aecc4f6605020e837293d7623550929c64cfe26 Mon Sep 17 00:00:00 2001 From: mikefinneran <110622959+mikefinneran@users.noreply.github.com> Date: Mon, 1 Apr 2024 07:54:01 -0400 Subject: [PATCH 12/41] feature/APPEALS-39456-40606 * RSPEC FAKE overide delete * v1 updates * update Va_dot_got to v1, update tests. * fix code climate issues, change env vars * Add Fake back to Stub * Fix fakes for facilityIds * remove to i for testing * Update distance check in SPEC * Update no distance tests * Update flow control * refactor distances into its own method in fake * fix method call * Testing changes * Revert "Testing changes" This reverts commit 7490151255828909e4728bec3f0b425ce32473b2. * add comment. * Update RSPEC to test is an integer * CircleCI fix * uncomment stub_const * fix tabbing * Change address format * added rspec tests to cover hotfix * testing for inclusion of expected values (addressLine1, etc.) * rspec test -- wip * still WIP * Fix address tests. * update json example and internationalPostalCode format * updated fakes * Update internationalPostalCode * appeals controller spec update * pagination fix * update request address * fix line too long * line too long fix * fix type error (#21055) * add metric attributes module * add statsd-instrument * Update metric model * update metric model attrs * update metric attributes and metric service * add dynatrace statsd calls * update DataDogService calls to Metric Service * update collect_datadog_metrics concern * update method names * update CollectDataDogMetrics reference * delete histogram controller * report_runtime update * naming update * metrics_service_report_time_segment update * log_to_datadog * record_error_in_metrics_service * record_success_in_datadog update * custom_metric_info method update * update segment method names * fix white spacing * add env to demo * add env to development * add env to test * Revert "delete histogram controller" This reverts commit fce319d61f522824a262531c96165c62097130fe. * re add histogram support * linting fixes * fix linting issues * fix naming linting issue * linting fixes * update names, ignore warns * ignore LongParameterList * update metrics service spec * add metric attributes to model * testing fake change * return zeros * or zero * move or zero, remove to_i * expect zeros * to_i, hash distances id with 0 * fix response object * no distance, multiple facilities fix * remove rubocop disable * fix param name * update bundler version for statsd-instrument * code climate --------- Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com> Co-authored-by: Anusha Palliyil Co-authored-by: Lauren Berry --- Gemfile | 1 + Gemfile.lock | 2 + app/controllers/application_controller.rb | 2 +- .../concerns/collect_custom_metrics.rb | 53 +++ .../concerns/collect_data_dog_metrics.rb | 50 --- app/controllers/health_checks_controller.rb | 2 +- .../metrics/v1/histogram_controller.rb | 2 +- app/jobs/caseflow_job.rb | 12 +- app/jobs/data_integrity_checks_job.rb | 2 +- app/jobs/dispatch_email_job.rb | 2 +- app/jobs/etl_builder_job.rb | 4 +- app/jobs/hearings/send_email.rb | 2 +- app/jobs/hearings/send_sent_status_email.rb | 6 +- .../send_membership_request_mailer_job.rb | 2 +- app/jobs/nightly_syncs_job.rb | 6 +- .../push_priority_appeals_to_judges_job.rb | 2 +- app/jobs/stats_collector_job.rb | 6 +- .../update_appellant_representation_job.rb | 4 +- .../update_cached_appeals_attributes_job.rb | 32 +- app/jobs/virtual_hearings/conference_job.rb | 2 +- .../virtual_hearings/create_conference_job.rb | 6 +- .../delete_conferences_job.rb | 8 +- app/jobs/warm_bgs_caches_job.rb | 38 +- app/models/concerns/appeal_concern.rb | 2 +- .../forms/base_hearing_update_form.rb | 10 +- app/models/legacy_appeal.rb | 2 +- app/models/metric.rb | 16 +- app/models/rating_issue.rb | 2 +- app/services/business_metrics.rb | 2 +- app/services/data_dog_service.rb | 53 --- app/services/external_api/bgs_service.rb | 4 +- .../external_api/va_dot_gov_service.rb | 396 +++++++++++++----- .../va_dot_gov_service/facilities_response.rb | 14 +- app/services/geomatch_service.rb | 2 +- app/services/hearings/reminder_service.rb | 6 +- app/services/metrics_service.rb | 75 +++- config.ru | 8 +- config/environments/demo.rb | 2 + config/environments/development.rb | 3 + config/environments/test.rb | 3 + lib/fakes/va_dot_gov_service.rb | 61 +-- .../idt/api/appeals_controller_spec.rb | 22 +- spec/jobs/caseflow_job_spec.rb | 2 +- spec/jobs/data_integrity_checks_job_spec.rb | 2 +- spec/jobs/etl_builder_job_spec.rb | 6 +- .../fetch_efolder_document_count_job_spec.rb | 2 +- .../hearings/send_sent_status_email_spec.rb | 2 +- ...send_membership_request_mailer_job_spec.rb | 4 +- spec/jobs/nightly_syncs_job_spec.rb | 2 +- spec/jobs/stats_collector_job_spec.rb | 6 +- spec/jobs/task_timer_job_spec.rb | 2 +- ...pdate_appellant_representation_job_spec.rb | 10 +- ...date_cached_appeals_attributes_job_spec.rb | 8 +- .../create_conference_job_spec.rb | 4 +- .../delete_conferences_job_spec.rb | 12 +- spec/models/concerns/appeal_concern_spec.rb | 2 +- .../forms/hearing_update_form_spec.rb | 4 +- spec/models/legacy_appeal_spec.rb | 2 +- spec/services/business_metrics_spec.rb | 2 +- .../daily_counts_stats_collector_spec.rb | 2 +- .../request_issues_stats_collector_spec.rb | 2 +- .../external_api/va_dot_gov_service_spec.rb | 82 +++- spec/services/metrics_service_spec.rb | 10 +- 63 files changed, 696 insertions(+), 401 deletions(-) create mode 100644 app/controllers/concerns/collect_custom_metrics.rb delete mode 100644 app/controllers/concerns/collect_data_dog_metrics.rb delete mode 100644 app/services/data_dog_service.rb diff --git a/Gemfile b/Gemfile index 16b4ccc9c99..af4cf12dd16 100644 --- a/Gemfile +++ b/Gemfile @@ -71,6 +71,7 @@ gem "sass-rails", "~> 5.0" # Error reporting to Sentry gem "sentry-raven" gem "shoryuken", "3.1.11" +gem "statsd-instrument" gem "stringex", require: false # catch problematic migrations at development/test time gem "strong_migrations" diff --git a/Gemfile.lock b/Gemfile.lock index 05012fefecc..63490abbc64 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -686,6 +686,7 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) sql_tracker (1.3.2) + statsd-instrument (3.7.0) stringex (2.8.5) strong_migrations (0.4.1) activerecord (>= 5) @@ -841,6 +842,7 @@ DEPENDENCIES sniffybara! solargraph sql_tracker + statsd-instrument stringex strong_migrations test-prof diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 35da5ae6edd..00ac5a7adba 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -49,7 +49,7 @@ def handle_non_critical_error(endpoint, err) err = Caseflow::Error::SerializableError.new(code: code, message: err.to_s) end - DataDogService.increment_counter( + MetricsService.increment_counter( metric_group: "errors", metric_name: "non_critical", app_name: RequestStore[:application], diff --git a/app/controllers/concerns/collect_custom_metrics.rb b/app/controllers/concerns/collect_custom_metrics.rb new file mode 100644 index 00000000000..725cb8e748e --- /dev/null +++ b/app/controllers/concerns/collect_custom_metrics.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module CollectCustomMetrics + extend ActiveSupport::Concern + + included do + before_action :collect_custom_metrics + end + + def collect_custom_metrics + collect_postgres_metrics + collect_vacols_metrics + end + + # :reek:FeatureEnvy + def collect_postgres_metrics + conns = ActiveRecord::Base.connection_pool.connections + + active = conns.count { |conn| conn.in_use? && conn.owner.alive? } + dead = conns.count { |conn| conn.in_use? && !conn.owner.alive? } + idle = conns.count { |conn| !conn.in_use? } + + emit_metrics_point("postgres", "active", active) + emit_metrics_point("postgres", "dead", dead) + emit_metrics_point("postgres", "idle", idle) + end + + # :reek:FeatureEnvy + def collect_vacols_metrics + conns = VACOLS::Record.connection_pool.connections + + active = conns.count { |conn| conn.in_use? && conn.owner.alive? } + dead = conns.count { |conn| conn.in_use? && !conn.owner.alive? } + idle = conns.count { |conn| !conn.in_use? } + + emit_metrics_point("vacols", "active", active) + emit_metrics_point("vacols", "dead", dead) + emit_metrics_point("vacols", "idle", idle) + end + + # :reek:UtilityFunction + def emit_metrics_point(db_name, type, count) + MetricsService.emit_gauge( + metric_group: "database", + metric_name: "#{type}_connections", + metric_value: count, + app_name: "caseflow", + attrs: { + database: db_name + } + ) + end +end diff --git a/app/controllers/concerns/collect_data_dog_metrics.rb b/app/controllers/concerns/collect_data_dog_metrics.rb deleted file mode 100644 index 9bf11d49789..00000000000 --- a/app/controllers/concerns/collect_data_dog_metrics.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module CollectDataDogMetrics - extend ActiveSupport::Concern - - included do - before_action :collect_data_dog_metrics - end - - def collect_data_dog_metrics - collect_postgres_metrics - collect_vacols_metrics - end - - def collect_postgres_metrics - conns = ActiveRecord::Base.connection_pool.connections - - active = conns.count { |c| c.in_use? && c.owner.alive? } - dead = conns.count { |c| c.in_use? && !c.owner.alive? } - idle = conns.count { |c| !c.in_use? } - - emit_datadog_point("postgres", "active", active) - emit_datadog_point("postgres", "dead", dead) - emit_datadog_point("postgres", "idle", idle) - end - - def collect_vacols_metrics - conns = VACOLS::Record.connection_pool.connections - - active = conns.count { |c| c.in_use? && c.owner.alive? } - dead = conns.count { |c| c.in_use? && !c.owner.alive? } - idle = conns.count { |c| !c.in_use? } - - emit_datadog_point("vacols", "active", active) - emit_datadog_point("vacols", "dead", dead) - emit_datadog_point("vacols", "idle", idle) - end - - def emit_datadog_point(db_name, type, count) - DataDogService.emit_gauge( - metric_group: "database", - metric_name: "#{type}_connections", - metric_value: count, - app_name: "caseflow", - attrs: { - database: db_name - } - ) - end -end diff --git a/app/controllers/health_checks_controller.rb b/app/controllers/health_checks_controller.rb index e86bcbd9fee..4ee3acc4440 100644 --- a/app/controllers/health_checks_controller.rb +++ b/app/controllers/health_checks_controller.rb @@ -3,7 +3,7 @@ # rubocop:disable Rails/ApplicationController class HealthChecksController < ActionController::Base include TrackRequestId - include CollectDataDogMetrics + include CollectCustomMetrics protect_from_forgery with: :exception newrelic_ignore_apdex diff --git a/app/controllers/metrics/v1/histogram_controller.rb b/app/controllers/metrics/v1/histogram_controller.rb index 662c4d52048..88795b83ba1 100644 --- a/app/controllers/metrics/v1/histogram_controller.rb +++ b/app/controllers/metrics/v1/histogram_controller.rb @@ -5,7 +5,7 @@ class Metrics::V1::HistogramController < ApplicationController def create histograms.each do |metric| - DataDogService.histogram( + MetricsService.histogram( metric_group: metric[:group], metric_name: metric[:name], metric_value: metric[:value], diff --git a/app/jobs/caseflow_job.rb b/app/jobs/caseflow_job.rb index ed5fbe8c58f..ab4fac2d639 100644 --- a/app/jobs/caseflow_job.rb +++ b/app/jobs/caseflow_job.rb @@ -11,22 +11,22 @@ class CaseflowJob < ApplicationJob # Note: This block is not called if an error occurs when `perform` is executed -- # see https://stackoverflow.com/questions/50263787/does-active-job-call-after-perform-when-perform-raises-an-error after_perform do |job| - datadog_report_runtime(metric_group_name: job.class.name.underscore) unless @reported_to_datadog + metrics_service_report_runtime(metric_group_name: job.class.name.underscore) unless @reported_to_metrics_service end - def datadog_report_runtime(metric_group_name:) - DataDogService.record_runtime( + def metrics_service_report_runtime(metric_group_name:) + MetricsService.record_runtime( app_name: "caseflow_job", metric_group: metric_group_name, start_time: @start_time ) - @reported_to_datadog = true + @reported_to_metrics_service = true end - def datadog_report_time_segment(segment:, start_time:) + def metrics_service_report_time_segment(segment:, start_time:) job_duration_seconds = Time.zone.now - start_time - DataDogService.emit_gauge( + MetricsService.emit_gauge( app_name: "caseflow_job_segment", metric_group: segment, metric_name: "runtime", diff --git a/app/jobs/data_integrity_checks_job.rb b/app/jobs/data_integrity_checks_job.rb index cbd9886e9b9..25d5b796a66 100644 --- a/app/jobs/data_integrity_checks_job.rb +++ b/app/jobs/data_integrity_checks_job.rb @@ -30,7 +30,7 @@ def perform checker_start_time = Time.zone.now checker = klass.constantize.new checker.call - datadog_report_time_segment(segment: klass.underscore, start_time: checker_start_time) + metrics_service_report_time_segment(segment: klass.underscore, start_time: checker_start_time) if checker.report? send_to_slack(checker) end diff --git a/app/jobs/dispatch_email_job.rb b/app/jobs/dispatch_email_job.rb index 3472ce65313..2d3e3a6e297 100644 --- a/app/jobs/dispatch_email_job.rb +++ b/app/jobs/dispatch_email_job.rb @@ -40,7 +40,7 @@ def external_message_id(msg) response = msg.response response_external_url = response.body.dig("_links", "self") - DataDogService.increment_counter( + MetricsService.increment_counter( app_name: Constants.DATADOG_METRICS.DISPATCH.APP_NAME, metric_group: Constants.DATADOG_METRICS.DISPATCH.OUTCODE_GROUP_NAME, metric_name: "email.sent", diff --git a/app/jobs/etl_builder_job.rb b/app/jobs/etl_builder_job.rb index a43bf6e7f35..cd0501aea2e 100644 --- a/app/jobs/etl_builder_job.rb +++ b/app/jobs/etl_builder_job.rb @@ -26,7 +26,7 @@ def perform def sweep_etl start = Time.zone.now swept = ETL::Sweeper.new.call - datadog_report_time_segment(segment: "etl_sweeper", start_time: start) + metrics_service_report_time_segment(segment: "etl_sweeper", start_time: start) return unless swept > 20 # big enough to warrant reality check @@ -37,7 +37,7 @@ def sweep_etl def build_etl start = Time.zone.now etl_build = ETL::Builder.new.incremental - datadog_report_time_segment(segment: "etl_builder", start_time: start) + metrics_service_report_time_segment(segment: "etl_builder", start_time: start) return unless etl_build.built == 0 diff --git a/app/jobs/hearings/send_email.rb b/app/jobs/hearings/send_email.rb index 1a55d0f7625..d6fffbd4195 100644 --- a/app/jobs/hearings/send_email.rb +++ b/app/jobs/hearings/send_email.rb @@ -99,7 +99,7 @@ def external_message_id(msg) response = msg.response response_external_url = response.body.dig("_links", "self") - DataDogService.increment_counter( + MetricsService.increment_counter( app_name: Constants.DATADOG_METRICS.HEARINGS.APP_NAME, metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, metric_name: "emails.submitted", diff --git a/app/jobs/hearings/send_sent_status_email.rb b/app/jobs/hearings/send_sent_status_email.rb index 7147d7601b6..3f9d0e62d67 100644 --- a/app/jobs/hearings/send_sent_status_email.rb +++ b/app/jobs/hearings/send_sent_status_email.rb @@ -67,13 +67,13 @@ def email_missing? end def log(message) - log_to_datadog(message) + log_to_metrics_service(message) log_to_logger(message) end - def log_to_datadog(message) + def log_to_metrics_service(message) hearing = @sent_hearing_email_event.hearing - DataDogService.increment_counter( + MetricsService.increment_counter( app_name: Constants.DATADOG_METRICS.HEARINGS.APP_NAME, metric_group: Constants.DATADOG_METRICS.HEARINGS.STATUS_EMAILS_GROUP_NAME, metric_name: "emails.admin_emails", diff --git a/app/jobs/memberships/send_membership_request_mailer_job.rb b/app/jobs/memberships/send_membership_request_mailer_job.rb index f39ceb7abb2..e8d8ac03f0c 100644 --- a/app/jobs/memberships/send_membership_request_mailer_job.rb +++ b/app/jobs/memberships/send_membership_request_mailer_job.rb @@ -37,7 +37,7 @@ def external_message_id(msg, mailer_parameters) response_msg = msg.response response_external_url = response_msg.body.dig("_link", "self") - DataDogService.increment_counter( + MetricsService.increment_counter( app_name: Constants.DATADOG_METRICS.VHA.APP_NAME, metric_group: Constants.DATADOG_METRICS.VHA.MEMBERSHIP_REQUESTS_GROUP_NAME, metric_name: "email.error", diff --git a/app/jobs/nightly_syncs_job.rb b/app/jobs/nightly_syncs_job.rb index 8db613ecd51..1dbe22bc95f 100644 --- a/app/jobs/nightly_syncs_job.rb +++ b/app/jobs/nightly_syncs_job.rb @@ -24,7 +24,7 @@ def perform def sync_vacols_users user_cache_start = Time.zone.now CachedUser.sync_from_vacols - datadog_report_time_segment(segment: "sync_users_from_vacols", start_time: user_cache_start) + metrics_service_report_time_segment(segment: "sync_users_from_vacols", start_time: user_cache_start) rescue StandardError => error @slack_report << "*Fatal error in sync_vacols_users:* #{error}" end @@ -54,7 +54,7 @@ def sync_vacols_cases if vacols_cases_with_error.any? @slack_report.unshift("VACOLS cases which cannot be deleted by sync_vacols_cases: #{vacols_cases_with_error}") end - datadog_report_time_segment(segment: "sync_cases_from_vacols", start_time: start_time) + metrics_service_report_time_segment(segment: "sync_cases_from_vacols", start_time: start_time) rescue StandardError => error @slack_report << "*Fatal error in sync_vacols_cases:* #{error}" end @@ -78,7 +78,7 @@ def sync_decision_review_tasks def sync_bgs_attorneys start_time = Time.zone.now BgsAttorney.sync_bgs_attorneys - datadog_report_time_segment(segment: "sync_bgs_attorneys", start_time: start_time) + metrics_service_report_time_segment(segment: "sync_bgs_attorneys", start_time: start_time) rescue StandardError => error @slack_report << "*Fatal error in sync_bgs_attorneys:* #{error}" end diff --git a/app/jobs/push_priority_appeals_to_judges_job.rb b/app/jobs/push_priority_appeals_to_judges_job.rb index 4442c35feb9..3e1bcfb7a9b 100644 --- a/app/jobs/push_priority_appeals_to_judges_job.rb +++ b/app/jobs/push_priority_appeals_to_judges_job.rb @@ -26,7 +26,7 @@ def perform slack_service.send_notification(slack_msg, self.class.name) log_error(error) ensure - datadog_report_runtime(metric_group_name: "priority_appeal_push_job") + metrics_service_report_runtime(metric_group_name: "priority_appeal_push_job") end def send_job_report diff --git a/app/jobs/stats_collector_job.rb b/app/jobs/stats_collector_job.rb index a8b8fdd84b7..a4f8a1bdce8 100644 --- a/app/jobs/stats_collector_job.rb +++ b/app/jobs/stats_collector_job.rb @@ -39,7 +39,7 @@ def perform rescue StandardError => error log_error(self.class.name, error) ensure - datadog_report_runtime(metric_group_name: METRIC_GROUP_NAME) + metrics_service_report_runtime(metric_group_name: METRIC_GROUP_NAME) end protected @@ -52,7 +52,7 @@ def run_collectors(stats_collectors) rescue StandardError => error log_error(collector_name, error) ensure - datadog_report_time_segment(segment: "#{METRIC_GROUP_NAME}.#{collector_name}", start_time: start_time) + metrics_service_report_time_segment(segment: "#{METRIC_GROUP_NAME}.#{collector_name}", start_time: start_time) end end @@ -82,7 +82,7 @@ def emit_untagged_hash(hash) end def emit(name, value, tags: {}) - DataDogService.emit_gauge( + MetricsService.emit_gauge( metric_group: METRIC_GROUP_NAME, metric_name: name, metric_value: value, diff --git a/app/jobs/update_appellant_representation_job.rb b/app/jobs/update_appellant_representation_job.rb index 36ee5b65857..ced37614c60 100644 --- a/app/jobs/update_appellant_representation_job.rb +++ b/app/jobs/update_appellant_representation_job.rb @@ -81,7 +81,7 @@ def active_docketed_appeals def increment_task_count(task_effect, appeal_id, count = 1) count.times do - DataDogService.increment_counter( + MetricsService.increment_counter( app_name: APP_NAME, metric_group: METRIC_GROUP_NAME, metric_name: "tasks", @@ -104,6 +104,6 @@ def log_error(start_time, err) slack_service.send_notification("[ERROR] #{msg}", self.class.to_s) - datadog_report_runtime(metric_group_name: METRIC_GROUP_NAME) + metrics_service_report_runtime(metric_group_name: METRIC_GROUP_NAME) end end diff --git a/app/jobs/update_cached_appeals_attributes_job.rb b/app/jobs/update_cached_appeals_attributes_job.rb index e414ce89818..3bf31ad2eff 100644 --- a/app/jobs/update_cached_appeals_attributes_job.rb +++ b/app/jobs/update_cached_appeals_attributes_job.rb @@ -17,13 +17,13 @@ def perform RequestStore.store[:current_user] = User.system_user ama_appeals_start = Time.zone.now cache_ama_appeals - datadog_report_time_segment(segment: "cache_ama_appeals", start_time: ama_appeals_start) + metrics_service_report_time_segment(segment: "cache_ama_appeals", start_time: ama_appeals_start) legacy_appeals_start = Time.zone.now cache_legacy_appeals - datadog_report_time_segment(segment: "cache_legacy_appeals", start_time: legacy_appeals_start) + metrics_service_report_time_segment(segment: "cache_legacy_appeals", start_time: legacy_appeals_start) - record_success_in_datadog + record_success_in_metrics_service rescue StandardError => error log_error(@start_time, error) end @@ -53,11 +53,17 @@ def cache_legacy_appeals cache_postgres_data_start = Time.zone.now cache_legacy_appeal_postgres_data(legacy_appeals) - datadog_report_time_segment(segment: "cache_legacy_appeal_postgres_data", start_time: cache_postgres_data_start) + metrics_service_report_time_segment( + segment: "cache_legacy_appeal_postgres_data", + start_time: cache_postgres_data_start + ) cache_vacols_data_start = Time.zone.now cache_legacy_appeal_vacols_data(all_vacols_ids) - datadog_report_time_segment(segment: "cache_legacy_appeal_vacols_data", start_time: cache_vacols_data_start) + metrics_service_report_time_segment( + segment: "cache_legacy_appeal_vacols_data", + start_time: cache_vacols_data_start + ) end def cache_legacy_appeal_postgres_data(legacy_appeals) @@ -81,7 +87,7 @@ def cache_legacy_appeal_vacols_data(all_vacols_ids) def increment_vacols_update_count(count) count.times do - DataDogService.increment_counter( + MetricsService.increment_counter( app_name: APP_NAME, metric_group: METRIC_GROUP_NAME, metric_name: "vacols_cases_cached" @@ -91,7 +97,7 @@ def increment_vacols_update_count(count) def increment_appeal_count(count, appeal_type) count.times do - DataDogService.increment_counter( + MetricsService.increment_counter( app_name: APP_NAME, metric_group: METRIC_GROUP_NAME, metric_name: "appeals_to_cache", @@ -121,21 +127,21 @@ def log_error(start_time, err) # * (Too little Postgres data cached) https://app.datadoghq.com/monitors/41421962 # * (Too little VACOLS data cached) https://app.datadoghq.com/monitors/41234223 # * (Job has not succeeded in the past day) https://app.datadoghq.com/monitors/41423568 - record_error_in_datadog + record_error_in_metrics_service - datadog_report_runtime(metric_group_name: METRIC_GROUP_NAME) + metrics_service_report_runtime(metric_group_name: METRIC_GROUP_NAME) end - def record_success_in_datadog - DataDogService.increment_counter( + def record_success_in_metrics_service + MetricsService.increment_counter( app_name: APP_NAME, metric_group: METRIC_GROUP_NAME, metric_name: "success" ) end - def record_error_in_datadog - DataDogService.increment_counter( + def record_error_in_metrics_service + MetricsService.increment_counter( app_name: APP_NAME, metric_group: METRIC_GROUP_NAME, metric_name: "error" diff --git a/app/jobs/virtual_hearings/conference_job.rb b/app/jobs/virtual_hearings/conference_job.rb index 6bdc9ca03db..4dfa3ad9e3c 100644 --- a/app/jobs/virtual_hearings/conference_job.rb +++ b/app/jobs/virtual_hearings/conference_job.rb @@ -5,7 +5,7 @@ class VirtualHearings::ConferenceJob < ApplicationJob private - def datadog_metric_info + def custom_metric_info { app_name: Constants.DATADOG_METRICS.HEARINGS.APP_NAME, metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME diff --git a/app/jobs/virtual_hearings/create_conference_job.rb b/app/jobs/virtual_hearings/create_conference_job.rb index 36d04423091..0da4a21227f 100644 --- a/app/jobs/virtual_hearings/create_conference_job.rb +++ b/app/jobs/virtual_hearings/create_conference_job.rb @@ -124,7 +124,7 @@ def log_virtual_hearing_state(virtual_hearing) end def create_conference_datadog_tags - datadog_metric_info.merge(attrs: { hearing_id: virtual_hearing.hearing_id }) + custom_metric_info.merge(attrs: { hearing_id: virtual_hearing.hearing_id }) end def create_conference @@ -149,12 +149,12 @@ def create_conference virtual_hearing.establishment.update_error!(error_display) - DataDogService.increment_counter(metric_name: "created_conference.failed", **create_conference_datadog_tags) + MetricsService.increment_counter(metric_name: "created_conference.failed", **create_conference_datadog_tags) fail pexip_response.error end - DataDogService.increment_counter(metric_name: "created_conference.successful", **create_conference_datadog_tags) + MetricsService.increment_counter(metric_name: "created_conference.successful", **create_conference_datadog_tags) virtual_hearing.update(conference_id: pexip_response.data[:conference_id]) end diff --git a/app/jobs/virtual_hearings/delete_conferences_job.rb b/app/jobs/virtual_hearings/delete_conferences_job.rb index c5e6849e522..fcc77df526f 100644 --- a/app/jobs/virtual_hearings/delete_conferences_job.rb +++ b/app/jobs/virtual_hearings/delete_conferences_job.rb @@ -116,14 +116,14 @@ def count_deleted_and_log(enumerable) end if removed > 0 - DataDogService.increment_counter( - metric_name: "deleted_conferences.successful", by: removed, **datadog_metric_info + MetricsService.increment_counter( + metric_name: "deleted_conferences.successful", by: removed, ** custom_metric_info ) end if failed > 0 - DataDogService.increment_counter( - metric_name: "deleted_conferences.failed", by: failed, **datadog_metric_info + MetricsService.increment_counter( + metric_name: "deleted_conferences.failed", by: failed, ** custom_metric_info ) end end diff --git a/app/jobs/warm_bgs_caches_job.rb b/app/jobs/warm_bgs_caches_job.rb index c8e2feb2b3f..ab72151c89c 100644 --- a/app/jobs/warm_bgs_caches_job.rb +++ b/app/jobs/warm_bgs_caches_job.rb @@ -69,16 +69,16 @@ def warm_poa_caches def warm_poa_and_cache_for_appeals_for_hearings_priority legacy_start_time = Time.zone.now legacy_appeals = LegacyAppeal.where(id: priority_appeal_ids(LegacyAppeal.name).first(LIMITS[:PRIORITY])) - legacy_datadog_segment = "warm_poa_bgs_and_cache_legacy_priority" - warm_poa_and_cache_for_legacy_appeals(legacy_appeals, legacy_start_time, legacy_datadog_segment) + legacy_metrics_segment = "warm_poa_bgs_and_cache_legacy_priority" + warm_poa_and_cache_for_legacy_appeals(legacy_appeals, legacy_start_time, legacy_metrics_segment) ama_start_time = Time.zone.now claimants_for_hearing = Claimant.where( decision_review_type: Appeal.name, decision_review_id: most_recent_appeal_ids(Appeal.name).first(LIMITS[:PRIORITY]) ) - ama_datadog_segment = "warm_poa_bgs_and_cache_ama_priority" - warm_poa_and_cache_for_ama_appeals(claimants_for_hearing, ama_start_time, ama_datadog_segment) + ama_metrics_segment = "warm_poa_bgs_and_cache_ama_priority" + warm_poa_and_cache_for_ama_appeals(claimants_for_hearing, ama_start_time, ama_metrics_segment) end # Warm POA and cache 1000(legacy + ama) appeals with active ScheduleHearingTask that have @@ -88,24 +88,24 @@ def warm_poa_and_cache_for_appeals_for_hearings_priority def warm_poa_and_cache_for_appeals_for_hearings_most_recent legacy_start_time = Time.zone.now legacy_appeals = LegacyAppeal.where(id: most_recent_appeal_ids(LegacyAppeal.name).first(LIMITS[:MOST_RECENT])) - legacy_datadog_segment = "warm_poa_bgs_and_cache_legacy_recent" - warm_poa_and_cache_for_legacy_appeals(legacy_appeals, legacy_start_time, legacy_datadog_segment) + legacy_metrics_segment = "warm_poa_bgs_and_cache_legacy_recent" + warm_poa_and_cache_for_legacy_appeals(legacy_appeals, legacy_start_time, legacy_metrics_segment) ama_start_time = Time.zone.now claimants_for_hearing = Claimant.where( decision_review_type: Appeal.name, decision_review_id: most_recent_appeal_ids(Appeal.name).first(LIMITS[:MOST_RECENT]) ) - ama_datadog_segment = "warm_poa_bgs_and_cache_ama_recent" - warm_poa_and_cache_for_ama_appeals(claimants_for_hearing, ama_start_time, ama_datadog_segment) + ama_metrics_segment = "warm_poa_bgs_and_cache_ama_recent" + warm_poa_and_cache_for_ama_appeals(claimants_for_hearing, ama_start_time, ama_metrics_segment) end # Warm POA for claimants that haven't been updated in a while and since we're warming, let's # also cache the appeal. def warm_poa_and_cache_ama_appeals_for_oldest_claimants start_time = Time.zone.now - datadog_segment = "warm_poa_claimants_and_cache_ama" - warm_poa_and_cache_for_ama_appeals(oldest_claimants_with_poa, start_time, datadog_segment) + metrics_segment = "warm_poa_claimants_and_cache_ama" + warm_poa_and_cache_for_ama_appeals(oldest_claimants_with_poa, start_time, metrics_segment) end # Warm POA records that haven't been synced in a while. @@ -120,10 +120,10 @@ def warm_poa_for_oldest_cached_records capture_exception(error: error) end end - datadog_report_time_segment(segment: "warm_poa_bgs_oldest", start_time: start_time) + metrics_service_report_time_segment(segment: "warm_poa_bgs_oldest", start_time: start_time) end - def warm_poa_and_cache_for_legacy_appeals(legacy_appeals, start_time, datadog_segment) + def warm_poa_and_cache_for_legacy_appeals(legacy_appeals, start_time, metrics_segment) appeals_to_cache = legacy_appeal_ids_to_file_numbers(legacy_appeals).map do |appeal_id, file_number| bgs_poa = fetch_bgs_power_of_attorney_by_file_number(file_number, appeal_id) @@ -135,10 +135,10 @@ def warm_poa_and_cache_for_legacy_appeals(legacy_appeals, start_time, datadog_se conflict_target: [:appeal_id, :appeal_type], columns: CACHED_APPEALS_BGS_POA_COLUMNS } - datadog_report_time_segment(segment: datadog_segment, start_time: start_time) + metrics_service_report_time_segment(segment: metrics_segment, start_time: start_time) end - def warm_poa_and_cache_for_ama_appeals(claimants, start_time, datadog_segment) + def warm_poa_and_cache_for_ama_appeals(claimants, start_time, metrics_segment) appeals_to_cache = claimants.map do |claimant| bgs_poa = claimant_poa_or_nil(claimant) claimant.update!(updated_at: Time.zone.now) @@ -151,7 +151,7 @@ def warm_poa_and_cache_for_ama_appeals(claimants, start_time, datadog_segment) conflict_target: [:appeal_id, :appeal_type], columns: CACHED_APPEALS_BGS_POA_COLUMNS } - datadog_report_time_segment(segment: datadog_segment, start_time: start_time) + metrics_service_report_time_segment(segment: metrics_segment, start_time: start_time) end # This block of code helps get file numbers associated with appeals in order to fetch poa @@ -252,7 +252,7 @@ def warm_participant_caches rescue StandardError => error Raven.capture_exception(error) end - datadog_report_time_segment(segment: "warm_participant_caches", start_time: start_time) + metrics_service_report_time_segment(segment: "warm_participant_caches", start_time: start_time) end def warm_ro_participant_caches(ro_ids) @@ -274,7 +274,7 @@ def warm_ro_participant_caches(ro_ids) # Ensure errors are sent to Sentry, but don't block the job from continuing. Raven.capture_exception(error) end - datadog_report_time_segment(segment: "warm_ro_participant_caches", start_time: start_time) + metrics_service_report_time_segment(segment: "warm_ro_participant_caches", start_time: start_time) end def warm_veteran_attribute_caches @@ -296,7 +296,7 @@ def warm_veteran_attribute_caches Raven.capture_exception(error) end end - datadog_report_time_segment(segment: "warm_veteran_attribute_caches", start_time: start_time) + metrics_service_report_time_segment(segment: "warm_veteran_attribute_caches", start_time: start_time) end def warm_veterans_for_hearings_on_day(date_to_cache) @@ -316,6 +316,6 @@ def warm_veterans_for_hearings_on_day(date_to_cache) def warm_attorney_address_caches start_time = Time.zone.now BgsAttorney.all.each(&:warm_address_cache) - datadog_report_time_segment(segment: "warm_attorney_address_caches", start_time: start_time) + metrics_service_report_time_segment(segment: "warm_attorney_address_caches", start_time: start_time) end end diff --git a/app/models/concerns/appeal_concern.rb b/app/models/concerns/appeal_concern.rb index 5a1b6d508cf..767c63be2e1 100644 --- a/app/models/concerns/appeal_concern.rb +++ b/app/models/concerns/appeal_concern.rb @@ -183,7 +183,7 @@ def timezone_identifier_for_address(addr) # only look up time zones by country for foreign addresses. We do not act on these errors (they # are valid addresses, we just cannot determine the time zone) so we do not send the error to # Sentry, only to Datadog for trend tracking. - DataDogService.increment_counter( + MetricsService.increment_counter( metric_group: "appeal_timezone_service", metric_name: "ambiguous_timezone_error", app_name: RequestStore[:application], diff --git a/app/models/hearings/forms/base_hearing_update_form.rb b/app/models/hearings/forms/base_hearing_update_form.rb index de9002b5c0c..259b4acf547 100644 --- a/app/models/hearings/forms/base_hearing_update_form.rb +++ b/app/models/hearings/forms/base_hearing_update_form.rb @@ -69,7 +69,7 @@ def hearing_updated? private - def datadog_metric_info + def custom_metric_info { app_name: RequestStore[:application], metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME @@ -367,20 +367,20 @@ def create_or_update_virtual_hearing end # Merge the hearing ID into the DataDog metrics - updated_metric_info = datadog_metric_info.merge(attrs: { hearing_id: hearing&.id }) + updated_metric_info = custom_metric_info.merge(attrs: { hearing_id: hearing&.id }) # Handle the status toggle of the virtual hearing if virtual_hearing_cancelled? virtual_hearing.update!(request_cancelled: true) update_email_recipients - DataDogService.increment_counter(metric_name: "cancelled_virtual_hearing.successful", **updated_metric_info) + MetricsService.increment_counter(metric_name: "cancelled_virtual_hearing.successful", **updated_metric_info) elsif !virtual_hearing_created? virtual_hearing.establishment.restart! update_email_recipients - DataDogService.increment_counter(metric_name: "updated_virtual_hearing.successful", **updated_metric_info) + MetricsService.increment_counter(metric_name: "updated_virtual_hearing.successful", **updated_metric_info) else VirtualHearingEstablishment.create!(virtual_hearing: virtual_hearing) - DataDogService.increment_counter(metric_name: "created_virtual_hearing.successful", **updated_metric_info) + MetricsService.increment_counter(metric_name: "created_virtual_hearing.successful", **updated_metric_info) end end diff --git a/app/models/legacy_appeal.rb b/app/models/legacy_appeal.rb index 2d67e6de745..25c9d152563 100644 --- a/app/models/legacy_appeal.rb +++ b/app/models/legacy_appeal.rb @@ -736,7 +736,7 @@ def veteran_file_number caseflow_file_number = veteran.file_number if vacols_file_number != caseflow_file_number - DataDogService.increment_counter( + MetricsService.increment_counter( metric_group: "database_disagreement", metric_name: "file_number", app_name: RequestStore[:application], diff --git a/app/models/metric.rb b/app/models/metric.rb index 48788fff209..3e3f515bfa2 100644 --- a/app/models/metric.rb +++ b/app/models/metric.rb @@ -5,7 +5,12 @@ class Metric < CaseflowRecord delegate :css_id, to: :user METRIC_TYPES = { error: "error", log: "log", performance: "performance", info: "info" }.freeze - LOG_SYSTEMS = { datadog: "datadog", rails_console: "rails_console", javascript_console: "javascript_console" }.freeze + LOG_SYSTEMS = { + dynatrace: "dynatrace", + datadog: "datadog", + rails_console: "rails_console", + javascript_console: "javascript_console" + }.freeze PRODUCT_TYPES = { queue: "queue", hearings: "hearings", @@ -14,7 +19,7 @@ class Metric < CaseflowRecord efolder: "efolder", reader: "reader", caseflow: "caseflow", # Default product - # Added below because MetricService has usages of this as a service + # Added below because MetricsService has usages of this as a service vacols: "vacols", bgs: "bgs", gov_delivery: "gov_delivery", @@ -70,9 +75,10 @@ def sent_to_in_log_systems # - end # - duration - # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity + # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength # :reek:ControlParameter def self.default_object(klass, params, user) + product_types = PRODUCT_TYPES { uuid: params[:uuid], event_id: params[:event_id], @@ -82,7 +88,7 @@ def self.default_object(klass, params, user) metric_group: params[:group] || METRIC_GROUPS[:service], metric_message: params[:message] || METRIC_TYPES[:log], metric_type: params[:type] || METRIC_TYPES[:log], - metric_product: PRODUCT_TYPES[params[:product].to_sym] || PRODUCT_TYPES[:caseflow], + metric_product: product_types[params[:product].to_sym] || product_types[:caseflow], app_name: params[:app_name] || APP_NAMES[:caseflow], metric_attributes: params[:metric_attributes], additional_info: params[:additional_info], @@ -94,7 +100,7 @@ def self.default_object(klass, params, user) duration: calculate_duration(params[:start], params[:end], params[:duration]) } end - # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity + # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength def self.calculate_duration(start, end_time, duration) return duration if duration || !start || !end_time diff --git a/app/models/rating_issue.rb b/app/models/rating_issue.rb index 382c4c37a1f..9f32cd281a9 100644 --- a/app/models/rating_issue.rb +++ b/app/models/rating_issue.rb @@ -55,7 +55,7 @@ def from_bgs_hash(rating, bgs_data) end def deserialize(serialized_hash) - DataDogService.increment_counter( + MetricsService.increment_counter( metric_group: "mst_pact_group", metric_name: "bgs_service.previous_service_call.rating_issue", app_name: RequestStore[:application] diff --git a/app/services/business_metrics.rb b/app/services/business_metrics.rb index 7909cad771e..598608d3507 100644 --- a/app/services/business_metrics.rb +++ b/app/services/business_metrics.rb @@ -4,7 +4,7 @@ class BusinessMetrics def self.record(service: nil, name: "unknown") app_name = RequestStore[:application] || "other" - DataDogService.increment_counter( + MetricsService.increment_counter( metric_group: "business", metric_name: "event", app_name: app_name, diff --git a/app/services/data_dog_service.rb b/app/services/data_dog_service.rb deleted file mode 100644 index 2fc455ccfaf..00000000000 --- a/app/services/data_dog_service.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -require "datadog/statsd" - -class DataDogService - @statsd = Datadog::Statsd.new - - def self.increment_counter(metric_group:, metric_name:, app_name:, attrs: {}, by: 1) - tags = get_tags(app_name, attrs) - stat_name = get_stat_name(metric_group, metric_name) - @statsd.increment(stat_name, tags: tags, by: by) - end - - def self.record_runtime(metric_group:, app_name:, start_time: Time.zone.now) - metric_name = "runtime" - job_duration_seconds = Time.zone.now - start_time - - emit_gauge( - app_name: app_name, - metric_group: metric_group, - metric_name: metric_name, - metric_value: job_duration_seconds - ) - end - - def self.emit_gauge(metric_group:, metric_name:, metric_value:, app_name:, attrs: {}) - tags = get_tags(app_name, attrs) - stat_name = get_stat_name(metric_group, metric_name) - @statsd.gauge(stat_name, metric_value, tags: tags) - end - - # :nocov: - def self.histogram(metric_group:, metric_name:, metric_value:, app_name:, attrs: {}) - tags = get_tags(app_name, attrs) - stat_name = get_stat_name(metric_group, metric_name) - @statsd.histogram(stat_name, metric_value, tags: tags) - end - # :nocov: - - private_class_method def self.get_stat_name(metric_group, metric_name) - "dsva-appeals.#{metric_group}.#{metric_name}" - end - - private_class_method def self.get_tags(app_name, attrs) - extra_tags = attrs.reduce([]) do |tags, (key, val)| - tags + ["#{key}:#{val}"] - end - [ - "app:#{app_name}", - "env:#{Rails.current_env}" - ] + extra_tags - end -end diff --git a/app/services/external_api/bgs_service.rb b/app/services/external_api/bgs_service.rb index 0b155f89293..9ece1d0f259 100644 --- a/app/services/external_api/bgs_service.rb +++ b/app/services/external_api/bgs_service.rb @@ -325,7 +325,7 @@ def bust_fetch_veteran_info_cache(vbms_id) def fetch_ratings_in_range(participant_id:, start_date:, end_date:) DBService.release_db_connections - DataDogService.increment_counter( + MetricsService.increment_counter( metric_group: "mst_pact_group", metric_name: "bgs_service.fetch_ratings_in_range_called", app_name: RequestStore[:application] @@ -349,7 +349,7 @@ def fetch_ratings_in_range(participant_id:, start_date:, end_date:) def fetch_rating_profile(participant_id:, profile_date:) DBService.release_db_connections - DataDogService.increment_counter( + MetricsService.increment_counter( metric_group: "mst_pact_group", metric_name: "bgs_service.fetch_rating_profile_called", app_name: RequestStore[:application] diff --git a/app/services/external_api/va_dot_gov_service.rb b/app/services/external_api/va_dot_gov_service.rb index d88e00e3717..30eb14c8f54 100644 --- a/app/services/external_api/va_dot_gov_service.rb +++ b/app/services/external_api/va_dot_gov_service.rb @@ -14,8 +14,8 @@ # class ExternalApi::VADotGovService BASE_URL = ENV["VA_DOT_GOV_API_URL"] || "" - FACILITY_IDS_ENDPOINT = "va_facilities/v0/ids" - FACILITIES_ENDPOINT = "va_facilities/v0/facilities" + FACILITY_IDS_ENDPOINT = "va_facilities/v1/ids" + FACILITIES_ENDPOINT = "va_facilities/v1/facilities" ADDRESS_VALIDATION_ENDPOINT = "address_validation/v1/validate" class << self @@ -34,7 +34,7 @@ class << self def get_distance(lat:, long:, ids:) send_facilities_requests( ids: ids, - query: { lat: lat, long: long, ids: ids.join(",") } + query: { lat: lat, long: long, facilityIds: ids.join(",") } ) end @@ -50,7 +50,7 @@ def get_distance(lat:, long:, ids:) def get_facility_data(ids:) send_facilities_requests( ids: ids, - query: { ids: ids.join(",") } + query: { facilityIds: ids.join(",") } ) end @@ -204,6 +204,7 @@ def check_facility_ids(ids: []) # Queries the VA.gov facilities API. # # @note Results are cached for 2 hours. + # distances values in the meta field are only returned if a lat and long are provided. # # @param query [Hash] query parameters # @@ -215,117 +216,284 @@ def check_facility_ids(ids: []) # Expected JSON Response from API: # # ``` - # { - # "data": [ - # { - # "id": "vha_688", - # "type": "va_facilities", - # "attributes": { - # "name": "Washington VA Medical Center", - # "classification": "VA Medical Center (VAMC)", - # "website": "http://www.washingtondc.va.gov", - # "address": { - # "mailing": { - # "zip": "20422-0001", - # "city": "Washington", - # "state": "DC", - # "address_1": "50 Irving Street, Northwest", - # "address_2": "string", - # "address_3": "string" - # }, - # "physical": { - # "zip": "20422-0001", - # "city": "Washington", - # "state": "DC", - # "address_1": "50 Irving Street, Northwest", - # "address_2": "string", - # "address_3": "string" - # } - # }, - # "phone": { - # "fax": "202-555-1212", - # "main": "202-555-1212", - # "pharmacy": "202-555-1212", - # "after_hours": "202-555-1212", - # "patient_advocate": "202-555-1212", - # "mental_health_clinic": "202-555-1212", - # "enrollment_coordinator": "202-555-1212" - # }, - # "hours": { - # "monday": "9AM-5PM", - # "tuesday": "9AM-5PM", - # "wednesday": "9AM-5PM", - # "thursday": "9AM-5PM", - # "friday": "9AM-5PM", - # "saturday": "Closed", - # "sunday": "Closed" - # }, - # "services": { - # "other": [ - # "OnlineScheduling" - # ], - # "health": [ - # "Audiology" - # ], - # "benefits": [ - # "ApplyingForBenefits" - # ], - # "last_updated": "2018-01-01" - # }, - # "satisfaction": { - # "health": { - # "primary_care_urgent": 0.85, - # "primary_care_routine": 0.85, - # "specialty_care_urgent": 0.85, - # "specialty_care_routine": 0.85 - # }, - # "effective_date": "2018-01-01" + # { + # "data": [ + # { + # "id": "vha_688", + # "type": "va_facilities", + # "attributes": { + # "name": "Washington VA Medical Center", + # "facilityType": "va_health_facility", + # "classification": "VA Medical Center (VAMC)", + # "parent": { + # "id": "vha_688", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688" + # }, + # "website": "https://www.va.gov/washington-dc-health-care/locations/washington-va-medical-center/", + # "lat": 38.929401, + # "long": -77.0111955, + # "timeZone": "America/New_York", + # "address": { + # "physical": { + # "zip": "20422-0001", + # "city": "Washington", + # "state": "DC", + # "address1": "50 Irving Street, Northwest" + # } + # }, + # "phone": { + # "fax": "202-745-8530", + # "main": "202-745-8000", + # "pharmacy": "202-745-8235", + # "afterHours": "202-745-8000", + # "patientAdvocate": "202-745-8588", + # "enrollmentCoordinator": "202-745-8000 x56333" + # }, + # "hours": { + # "monday": "24/7", + # "tuesday": "24/7", + # "wednesday": "24/7", + # "thursday": "24/7", + # "friday": "24/7", + # "saturday": "24/7", + # "sunday": "24/7" + # }, + # "operationalHoursSpecialInstructions": [ + # "Normal business hours are Monday through Friday, 8:00 a.m. to 4:30 p.m." + # ], + # "services": { + # "health": [ + # { + # "name": "Advice nurse", + # "serviceId": "adviceNurse", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/adviceNurse" + # }, + # { + # "name": "Anesthesia", + # "serviceId": "anesthesia", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/anesthesia" + # }, + # { + # "name": "Audiology and speech", + # "serviceId": "audiology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/audiology" + # }, + # { + # "name": "Cardiology", + # "serviceId": "cardiology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/cardiology" + # }, + # { + # "name": "CaregiverSupport", + # "serviceId": "caregiverSupport", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/caregiverSupport" + # }, + # { + # "name": "COVID-19 vaccines", + # "serviceId": "covid19Vaccine", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/covid19Vaccine" + # }, + # { + # "name": "Dental/oral surgery", + # "serviceId": "dental", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/dental" + # }, + # { + # "name": "Dermatology", + # "serviceId": "dermatology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/dermatology" + # }, + # { + # "name": "Emergency care", + # "serviceId": "emergencyCare", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/emergencyCare" + # }, + # { + # "name": "Gastroenterology", + # "serviceId": "gastroenterology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/gastroenterology" + # }, + # { + # "name": "Geriatrics", + # "serviceId": "geriatrics", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/geriatrics" + # }, + # { + # "name": "Gynecology", + # "serviceId": "gynecology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/gynecology" + # }, + # { + # "name": "Hematology/oncology", + # "serviceId": "hematology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/hematology" + # }, + # { + # "name": "Homeless Veteran care", + # "serviceId": "homeless", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/homeless" + # }, + # { + # "name": "Palliative and hospice care", + # "serviceId": "hospice", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/hospice" + # }, + # { + # "name": "Hospital medicine", + # "serviceId": "hospitalMedicine", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/hospitalMedicine" + # }, + # { + # "name": "Laboratory and pathology", + # "serviceId": "laboratory", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/laboratory" + # }, + # { + # "name": "LGBTQ+ Veteran care", + # "serviceId": "lgbtq", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/lgbtq" + # }, + # { + # "name": "MentalHealth", + # "serviceId": "mentalHealth", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/mentalHealth" + # }, + # { + # "name": "Minority Veteran care", + # "serviceId": "minorityCare", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/minorityCare" + # }, + # { + # "name": "Nutrition, food, and dietary care", + # "serviceId": "nutrition", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/nutrition" + # }, + # { + # "name": "Ophthalmology", + # "serviceId": "ophthalmology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/ophthalmology" + # }, + # { + # "name": "Optometry", + # "serviceId": "optometry", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/optometry" + # }, + # { + # "name": "Orthopedics", + # "serviceId": "orthopedics", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/orthopedics" + # }, + # { + # "name": "Patient advocates", + # "serviceId": "patientAdvocates", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/patientAdvocates" + # }, + # { + # "name": "Pharmacy", + # "serviceId": "pharmacy", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/pharmacy" + # }, + # { + # "name": "Physical medicine and rehabilitation", + # "serviceId": "physicalMedicine", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/physicalMedicine" + # }, + # { + # "name": "Podiatry", + # "serviceId": "podiatry", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/podiatry" + # }, + # { + # "name": "Primary care", + # "serviceId": "primaryCare", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/primaryCare" + # }, + # { + # "name": "Psychology", + # "serviceId": "psychology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/psychology" + # }, + # { + # "name": "Rehabilitation and extended care", + # "serviceId": "rehabilitation", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/rehabilitation" + # }, + # { + # "name": "Suicide prevention", + # "serviceId": "suicidePrevention", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/suicidePrevention" + # }, + # { + # "name": "Surgery", + # "serviceId": "surgery", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/surgery" + # }, + # { + # "name": "Returning service member care", + # "serviceId": "transitionCounseling", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/transitionCounseling" + # }, + # { + # "name": "Transplant surgery", + # "serviceId": "transplantSurgery", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/transplantSurgery" + # }, + # { + # "name": "Urology", + # "serviceId": "urology", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/urology" + # }, + # { + # "name": "Women Veteran care", + # "serviceId": "womensHealth", + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services/womensHealth" + # } + # ], + # "link": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities/vha_688/services", + # "lastUpdated": "2024-03-03" + # }, + # "satisfaction": { + # "health": { + # "primaryCareUrgent": 0.7699999809265137, + # "primaryCareRoutine": 0.7300000190734863, + # "specialtyCareUrgent": 0.6499999761581421, + # "specialtyCareRoutine": 0.699999988079071 + # }, + # "effectiveDate": "2024-02-08" + # }, + # "mobile": false, + # "operatingStatus": { + # "code": "NORMAL", + # "supplementalStatus": [ + # { + # "id": "COVID_MEDIUM", + # "label": "COVID-19 health protection: Levels medium" + # } + # ] + # }, + # "visn": "5" + # } + # } + # ], + # "links": { + # "self": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities?facilityIds=vha_688", + # "first": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities?facilityIds=vha_688", + # "last": "https://sandbox-api.va.gov/services/va_facilities/v1/facilities?facilityIds=vha_688" + # }, + # "meta": { + # "pagination": { + # "currentPage": 1, + # "perPage": 10, + # "totalPages": 1, + # "totalEntries": 1 # }, - # "mobile": false, - # "visn": "20", - # "facility_type": "va_benefits_facility", - # "lat": 38.9311137, - # "long": -77.0109110499999, - # "wait_times": { - # "health": [ + # "distances": [ # { - # "service": "Audiology", - # "new": 10, - # "established": 5 + # "id": "vha_688", + # "distance": 5522.71 # } - # ], - # "effective_date": "2018-01-01" - # }, - # "active_status": "A", - # "operating_status": { - # "code": "NORMAL", - # "additional_info": "string" - # } - # } + # ] # } - # ], - # "links": { - # "related": "string", - # "self": "string", - # "first": "string", - # "prev": "string", - # "next": "string", - # "last": "string" - # }, - # "meta": { - # "pagination": { - # "current_page": 1, - # "per_page": 10, - # "total_pages": 217, - # "total_entries": 2162 - # }, - # "distances": [ - # { - # "id": "string", - # "distance": 0 - # } - # ] - # } # } # ``` def send_facilities_request(query:) @@ -357,7 +525,7 @@ def send_facilities_requests(ids:, query:) response = nil until remaining_ids.empty? || response.try(:next?) == false || response.try(:success?) == false - response = send_facilities_request(query: query.merge(page: page, per_page: 200)).merge(response) + response = send_facilities_request(query: query.merge(page: page, perPage: 200)).merge(response) remaining_ids -= response.data.pluck(:facility_id) @@ -436,7 +604,7 @@ def address_validation_request(address) city: address.city, zipCode5: address.zip, zipCode4: address.zip4, - international_postal_code: address.international_postal_code, + internationalPostalCode: address.international_postal_code, stateProvince: { name: address.state_name, code: address.state }, requestCountry: { countryName: address.country_name, countryCode: address.country }, addressPOU: address.address_pou @@ -476,7 +644,7 @@ def zip_code_validation_request(address) end def track_pages(pages) - DataDogService.emit_gauge( + MetricsService.emit_gauge( metric_group: "service", metric_name: "pages_requested", metric_value: pages, diff --git a/app/services/external_api/va_dot_gov_service/facilities_response.rb b/app/services/external_api/va_dot_gov_service/facilities_response.rb index f1d195d2368..e7320b8a500 100644 --- a/app/services/external_api/va_dot_gov_service/facilities_response.rb +++ b/app/services/external_api/va_dot_gov_service/facilities_response.rb @@ -26,7 +26,11 @@ def merge(facilities_response) private def distances - Hash[body[:meta][:distances].pluck(:id, :distance)] + if body[:meta].key?(:distances) + Hash[body[:meta][:distances].pluck(:id, :distance)] + else + Hash[body[:data].collect { |facility| [facility[:id], 0] }] + end end class Facility @@ -47,9 +51,9 @@ def physical_address def address @address ||= Address.new( - address_line_1: physical_address[:address_1], - address_line_2: physical_address[:address_2], - address_line_3: physical_address[:address_3], + address_line_1: physical_address[:address1], + address_line_2: physical_address[:address2], + address_line_3: physical_address[:address3], city: physical_address[:city], state: physical_address[:state], zip: physical_address[:zip] @@ -61,7 +65,7 @@ def format facility_id: facility[:id], type: facility[:type], distance: distance, - facility_type: attrs[:facility_type], + facility_type: attrs[:facilityType], name: attrs[:name], classification: attrs[:classification], lat: attrs[:lat], diff --git a/app/services/geomatch_service.rb b/app/services/geomatch_service.rb index 606a84b0306..0d3e53a13e4 100644 --- a/app/services/geomatch_service.rb +++ b/app/services/geomatch_service.rb @@ -67,7 +67,7 @@ def create_available_hearing_location_for_errored_appeal end def record_geomatched_appeal(status) - DataDogService.increment_counter( + MetricsService.increment_counter( app_name: RequestStore[:application], metric_group: "job", metric_name: "geomatched_appeals", diff --git a/app/services/hearings/reminder_service.rb b/app/services/hearings/reminder_service.rb index 96ed3f3518e..936f60aff4c 100644 --- a/app/services/hearings/reminder_service.rb +++ b/app/services/hearings/reminder_service.rb @@ -40,12 +40,12 @@ def log_reminder_type(type) "Is it a virtual_hearing?: #{hearing.virtual?}, " \ "Hearing class and id: #{hearing.class.name}, #{hearing.id})" ) - send_to_datadog(type) + send_to_metrics_service(type) end # Remove this when we enable feature to allow reminder for all hearings - def send_to_datadog(type) - DataDogService.increment_counter( + def send_to_metrics_service(type) + MetricsService.increment_counter( app_name: Constants.DATADOG_METRICS.HEARINGS.APP_NAME, metric_group: Constants.DATADOG_METRICS.HEARINGS.REMINDER_EMAILS_GROUP_NAME, metric_name: "emails.would_be_sent", diff --git a/app/services/metrics_service.rb b/app/services/metrics_service.rb index 7d3c8b0f922..7e201be75a5 100644 --- a/app/services/metrics_service.rb +++ b/app/services/metrics_service.rb @@ -1,9 +1,71 @@ # frozen_string_literal: true require "benchmark" +require "datadog/statsd" +require "statsd-instrument" # see https://dropwizard.github.io/metrics/3.1.0/getting-started/ for abstractions on metric types class MetricsService + @statsd = Datadog::Statsd.new + + # :reek:LongParameterList + def self.increment_counter(metric_group:, metric_name:, app_name:, attrs: {}, by: 1) + tags = get_tags(app_name, attrs) + stat_name = get_stat_name(metric_group, metric_name) + @statsd.increment(stat_name, tags: tags, by: by) + + # Dynatrace statD implementation + StatsD.increment(stat_name, tags: tags) + end + + def self.record_runtime(metric_group:, app_name:, start_time: Time.zone.now) + metric_name = "runtime" + job_duration_seconds = Time.zone.now - start_time + + emit_gauge( + app_name: app_name, + metric_group: metric_group, + metric_name: metric_name, + metric_value: job_duration_seconds + ) + end + + # :reek:LongParameterList + def self.emit_gauge(metric_group:, metric_name:, metric_value:, app_name:, attrs: {}) + tags = get_tags(app_name, attrs) + stat_name = get_stat_name(metric_group, metric_name) + @statsd.gauge(stat_name, metric_value, tags: tags) + + # Dynatrace statD implementation + StatsD.gauge(stat_name, metric_value, tags: tags) + end + + # :nocov: + # :reek:LongParameterList + def self.histogram(metric_group:, metric_name:, metric_value:, app_name:, attrs: {}) + tags = get_tags(app_name, attrs) + stat_name = get_stat_name(metric_group, metric_name) + @statsd.histogram(stat_name, metric_value, tags: tags) + + # Dynatrace statD implementation + StatsD.histogram(stat_name, metric_value, tags: tags) + end + # :nocov: + + private_class_method def self.get_stat_name(metric_group, metric_name) + "dsva-appeals.#{metric_group}.#{metric_name}" + end + + private_class_method def self.get_tags(app_name, attrs) + extra_tags = attrs.reduce([]) do |tags, (key, val)| + tags + ["#{key}:#{val}"] + end + [ + "app:#{app_name}", + "env:#{Rails.current_env}" + ] + extra_tags + end + # rubocop:disable Metrics/AbcSize, Metrics/MethodLength # :reek:LongParameterList def self.record(description, service: nil, name: "unknown", caller: nil) @@ -35,9 +97,10 @@ def self.record(description, service: nil, name: "unknown", caller: nil) uuid: uuid } } - DataDogService.emit_gauge(sent_to_info) + MetricsService.emit_gauge(sent_to_info) sent_to << Metric::LOG_SYSTEMS[:datadog] + sent_to << Metric::LOG_SYSTEMS[:dynatrace] end Rails.logger.info("FINISHED #{description}: #{stopwatch}") @@ -64,7 +127,7 @@ def self.record(description, service: nil, name: "unknown", caller: nil) Rails.logger.error("#{error.message}\n#{error.backtrace.join("\n")}") Raven.capture_exception(error, extra: { type: "request_error", service: service, name: name, app: app }) - increment_datadog_counter("request_error", service, name, app) if service + increment_metric_service_counter("request_error", service, name, app) if service metric_params = { name: "error", @@ -88,12 +151,13 @@ def self.record(description, service: nil, name: "unknown", caller: nil) # This is just to capture the metric. raise ensure - increment_datadog_counter("request_attempt", service, name, app) if service + increment_metric_service_counter("request_attempt", service, name, app) if service end # rubocop:enable Metrics/AbcSize, Metrics/MethodLength - private_class_method def self.increment_datadog_counter(metric_name, service, endpoint_name, app_name) - DataDogService.increment_counter( + # :reek:LongParameterList + private_class_method def self.increment_metric_service_counter(metric_name, service, endpoint_name, app_name) + increment_counter( metric_group: "service", metric_name: metric_name, app_name: app_name, @@ -103,6 +167,7 @@ def self.record(description, service: nil, name: "unknown", caller: nil) } ) end + # :reek:ControlParameter def self.store_record_metric(uuid, params, caller) return nil unless FeatureToggle.enabled?(:metrics_monitoring, user: RequestStore[:current_user]) diff --git a/config.ru b/config.ru index 8d76f8e80bc..cb504065454 100644 --- a/config.ru +++ b/config.ru @@ -24,8 +24,8 @@ module PumaThreadLogger waiting = @waiting } - emit_datadog_point("idle", waiting) - emit_datadog_point("active", thread_count - waiting) + emit_metrics_point("idle", waiting) + emit_metrics_point("active", thread_count - waiting) # For some reason, even a single Puma server (not clustered) has two booted ThreadPools. # One of them is empty, and the other is actually doing work. @@ -49,8 +49,8 @@ module PumaThreadLogger super *args end - def emit_datadog_point(type, count) - DataDogService.emit_gauge( + def emit_metrics_point(type, count) + MetricsService.emit_gauge( metric_group: "puma", metric_name: "#{type}_threads", metric_value: count, diff --git a/config/environments/demo.rb b/config/environments/demo.rb index 931531d74ac..2000da40c1b 100644 --- a/config/environments/demo.rb +++ b/config/environments/demo.rb @@ -97,6 +97,8 @@ ENV["REQUEST_ISSUE_PAGINATION_OFFSET"] ||= "10" ENV["REQUEST_ISSUE_DEFAULT_UPPER_BOUND_PER_PAGE"] ||= "50" + # Dynatrace variables + ENV["STATSD_ENV"] = "development" # Setup S3 config.s3_enabled = ENV["AWS_BUCKET_NAME"].present? diff --git a/config/environments/development.rb b/config/environments/development.rb index e26962cc7e2..3d5d43787e7 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -147,6 +147,9 @@ ENV["PACMAN_API_SYS_ACCOUNT"] ||= "CSS_ID_OF_OUR_ACCOUNT" ENV["PACMAN_API_URL"] ||= "https://pacman-uat.dev.bip.va.gov/" + # Dynatrace variables + ENV["STATSD_ENV"] = "development" + # eFolder API URL to retrieve appeal documents config.efolder_url = "http://localhost:4000" config.efolder_key = "token" diff --git a/config/environments/test.rb b/config/environments/test.rb index f0176ee6098..df91ac33a6f 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -149,4 +149,7 @@ ENV["PACMAN_API_TOKEN_SECRET"] ||= "client-secret" ENV["PACMAN_API_TOKEN_ISSUER"] ||= "issuer-of-our-token" ENV["PACMAN_API_SYS_ACCOUNT"] ||= "CSS_ID_OF_OUR_ACCOUNT" + + # Dynatrace variables + ENV["STATSD_ENV"] = "test" end diff --git a/lib/fakes/va_dot_gov_service.rb b/lib/fakes/va_dot_gov_service.rb index cf008936a39..4a1116c249e 100644 --- a/lib/fakes/va_dot_gov_service.rb +++ b/lib/fakes/va_dot_gov_service.rb @@ -4,22 +4,15 @@ class Fakes::VADotGovService < ExternalApi::VADotGovService # rubocop:disable Metrics/MethodLength def self.send_va_dot_gov_request(endpoint:, query: {}, **args) if endpoint == VADotGovService::FACILITIES_ENDPOINT - facilities = query[:ids].split(",").map do |id| + facilities = query[:facilityIds].split(",").map do |id| data = fake_facilities_data[:data][0] data["id"] = id data end - distances = query[:ids].split(",").map.with_index do |id, index| - { - id: id, - distance: index - } - end - fake_facilities = fake_facilities_data fake_facilities[:data] = facilities - fake_facilities[:meta][:distances] = distances + fake_facilities[:meta][:distances] = distances(query) HTTPI::Response.new 200, {}, fake_facilities.to_json elsif endpoint == VADotGovService::ADDRESS_VALIDATION_ENDPOINT request_address_keys = args[:body][:requestAddress].keys @@ -36,6 +29,24 @@ def self.send_va_dot_gov_request(endpoint:, query: {}, **args) end end + def self.distances(query) + if query[:lat].present? && query[:long].present? + query[:facilityIds].split(",").map.with_index do |id, index| + { + id: id, + distance: index + } + end + else + query[:facilityIds].split(",").map do |id| + { + id: id, + distance: 0 + } + end + end + end + def self.fake_address_data { "messages": [ @@ -146,7 +157,7 @@ def self.fake_facilities_data "type": "va_facilities", "attributes": { "name": "Holdrege VA Clinic", - "facility_type": "va_health_facility", + "facilityType": "va_health_facility", "classification": "Primary Care CBOC", "website": nil, "lat": 40.4454392100001, @@ -159,19 +170,19 @@ def self.fake_facilities_data "zip": "68949-1705", "city": "Holdrege", "state": "NE", - "address_1": "1118 Burlington Street", - "address_2": "", - "address_3": nil + "address1": "1118 Burlington Street", + "address2": "", + "address3": nil } }, "phone": { "fax": "555-555-3775 x", "main": "555-555-3760 x", "pharmacy": "555-555-0827 x", - "after_hours": "555-555-5555 x", - "patient_advocate": "555-555-5555 x7933", - "mental_health_clinic": "555-555-5555", - "enrollment_coordinator": "555-555-5555 x" + "afterHours": "555-555-5555 x", + "patientAdvocate": "555-555-5555 x7933", + "mentalHealthClinic": "555-555-5555", + "enrollmentCoordinator": "555-555-5555 x" }, "hours": { "friday": "800AM-430PM", @@ -192,17 +203,17 @@ def self.fake_facilities_data Audiology Cardiology ], - "last_updated": "2019-01-02" + "lastUpdated": "2019-01-02" }, "satisfaction": { "health": { }, - "effective_date": nil + "effectiveDate": nil }, - "wait_times": { + "waitTimes": { "health": [], - "effective_date": "2018-12-24" + "effectiveDate": "2018-12-24" } } } @@ -216,10 +227,10 @@ def self.fake_facilities_data }, "meta": { "pagination": { - "current_page": 1, - "per_page": 30, - "total_pages": 77, - "total_entries": 2289 + "currentPage": 1, + "perPage": 30, + "totalPages": 77, + "totalEntries": 2289 }, "distances": [ { diff --git a/spec/controllers/idt/api/appeals_controller_spec.rb b/spec/controllers/idt/api/appeals_controller_spec.rb index 27727ff5e79..9630707afd9 100644 --- a/spec/controllers/idt/api/appeals_controller_spec.rb +++ b/spec/controllers/idt/api/appeals_controller_spec.rb @@ -731,22 +731,22 @@ def create_legacy_appeal_with_id(id) let(:params) do { "request_address": { - "address_line_1": "string", - "address_line_2": "string", - "address_line_3": "string", + "addressLine1": "string", + "addressLine2": "string", + "addressLine3": "string", "city": "string", - "zip_code_5": "string", - "zip_code_4": "string", - "international_postal_code": "string", - "state_province": { + "zipCode5": "string", + "zipCode4": "string", + "internationalPostalCode": "string", + "stateProvince": { "name": "string", "code": "string" }, - "request_country": { - "country_name": "string", - "country_code": "string" + "requestCountry": { + "countryName": "string", + "countryCode": "string" }, - "address_pou": "RESIDENCE/CHOICE" + "addressPOU": "RESIDENCE/CHOICE" } } end diff --git a/spec/jobs/caseflow_job_spec.rb b/spec/jobs/caseflow_job_spec.rb index cfd0589e40f..632808dda93 100644 --- a/spec/jobs/caseflow_job_spec.rb +++ b/spec/jobs/caseflow_job_spec.rb @@ -13,7 +13,7 @@ def perform context "when a CaseflowJob doesn't explicitly report to DataDog" do before do - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "caseflow_job", metric_group: "some_caseflow_job", metric_name: "runtime", diff --git a/spec/jobs/data_integrity_checks_job_spec.rb b/spec/jobs/data_integrity_checks_job_spec.rb index 890e841275a..d835117100d 100644 --- a/spec/jobs/data_integrity_checks_job_spec.rb +++ b/spec/jobs/data_integrity_checks_job_spec.rb @@ -40,7 +40,7 @@ allow(slack_service).to receive(:send_notification) { |msg| slack_messages << msg } @emitted_gauges = [] - allow(DataDogService).to receive(:emit_gauge) do |args| + allow(MetricsService).to receive(:emit_gauge) do |args| @emitted_gauges.push(args) end diff --git a/spec/jobs/etl_builder_job_spec.rb b/spec/jobs/etl_builder_job_spec.rb index 05a72e7670e..108875ebeae 100644 --- a/spec/jobs/etl_builder_job_spec.rb +++ b/spec/jobs/etl_builder_job_spec.rb @@ -34,19 +34,19 @@ describe "perform" do before do allow_any_instance_of(SlackService).to receive(:send_notification) { |_, first_arg| @slack_msg = first_arg } - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "caseflow_job", metric_group: "etl_builder_job", metric_name: "runtime", metric_value: anything ) - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "caseflow_job_segment", metric_group: "etl_builder", metric_name: "runtime", metric_value: anything ) - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "caseflow_job_segment", metric_group: "etl_sweeper", metric_name: "runtime", diff --git a/spec/jobs/fetch_efolder_document_count_job_spec.rb b/spec/jobs/fetch_efolder_document_count_job_spec.rb index 76a5de6af0c..eba087cdeaa 100644 --- a/spec/jobs/fetch_efolder_document_count_job_spec.rb +++ b/spec/jobs/fetch_efolder_document_count_job_spec.rb @@ -9,7 +9,7 @@ before do @emitted_gauges = [] - allow(DataDogService).to receive(:emit_gauge) do |args| + allow(MetricsService).to receive(:emit_gauge) do |args| @emitted_gauges.push(args) end end diff --git a/spec/jobs/hearings/send_sent_status_email_spec.rb b/spec/jobs/hearings/send_sent_status_email_spec.rb index 1af3ba62020..865811412af 100644 --- a/spec/jobs/hearings/send_sent_status_email_spec.rb +++ b/spec/jobs/hearings/send_sent_status_email_spec.rb @@ -45,7 +45,7 @@ # Expect we logged the failure to Rails.logger expect(Rails.logger).to receive(:info).at_least(:once) # Expect we logged the failure to DataDog - expect(DataDogService).to receive(:increment_counter).at_least(:once) + expect(MetricsService).to receive(:increment_counter).at_least(:once) # Call the sender subject # We should not set an external_message_id because we didnt sent an email diff --git a/spec/jobs/memberships/send_membership_request_mailer_job_spec.rb b/spec/jobs/memberships/send_membership_request_mailer_job_spec.rb index 6dc1a4bbd3e..8e9e71728a5 100644 --- a/spec/jobs/memberships/send_membership_request_mailer_job_spec.rb +++ b/spec/jobs/memberships/send_membership_request_mailer_job_spec.rb @@ -119,14 +119,14 @@ let(:email_message) { instance_double(GovDelivery::TMS::EmailMessage) } let(:response) { instance_double("Response") } - it "Calls the DataDogService in the external_message_id method" do + it "Calls the MetricsService in the external_message_id method" do allow_any_instance_of(ActionMailer::Parameterized::MessageDelivery).to receive(:deliver_now!) .and_return(email_message) allow(email_message).to receive(:is_a?).with(GovDelivery::TMS::EmailMessage).and_return(true) allow(email_message).to receive(:response).and_return(response) allow(response).to receive(:body).and_return({}) allow(response).to receive(:status).and_return("200 Good") - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "caseflow_job", metric_group: Memberships::SendMembershipRequestMailerJob.name.underscore, metric_name: "runtime", diff --git a/spec/jobs/nightly_syncs_job_spec.rb b/spec/jobs/nightly_syncs_job_spec.rb index 12c5e3501ce..0422aad1ac9 100644 --- a/spec/jobs/nightly_syncs_job_spec.rb +++ b/spec/jobs/nightly_syncs_job_spec.rb @@ -8,7 +8,7 @@ 5.times { create(:staff) } @emitted_gauges = [] - allow(DataDogService).to receive(:emit_gauge) do |args| + allow(MetricsService).to receive(:emit_gauge) do |args| @emitted_gauges.push(args) end end diff --git a/spec/jobs/stats_collector_job_spec.rb b/spec/jobs/stats_collector_job_spec.rb index 06c0903ec9f..c536531e4b8 100644 --- a/spec/jobs/stats_collector_job_spec.rb +++ b/spec/jobs/stats_collector_job_spec.rb @@ -97,7 +97,7 @@ def collect_stats context "with a daily collector" do it "records the job's runtime and collector stats" do - allow(DataDogService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } + allow(MetricsService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } described_class.perform_now @@ -124,7 +124,7 @@ def collect_stats end it "records the job's runtime and collector stats despite a failing collector" do - allow(DataDogService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } + allow(MetricsService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } allow(Raven).to receive(:capture_exception) @@ -172,7 +172,7 @@ def collect_stats end it "records stats with tags when provided in collector results" do - allow(DataDogService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } + allow(MetricsService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } slack_msg = [] allow_any_instance_of(SlackService).to receive(:send_notification) { |_, first_arg| slack_msg << first_arg } diff --git a/spec/jobs/task_timer_job_spec.rb b/spec/jobs/task_timer_job_spec.rb index 4fedd89945e..ef019950f6c 100644 --- a/spec/jobs/task_timer_job_spec.rb +++ b/spec/jobs/task_timer_job_spec.rb @@ -98,7 +98,7 @@ def timer_ends_at end it "records the job's runtime with Datadog" do - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "caseflow_job", metric_group: TaskTimerJob.name.underscore, metric_name: "runtime", diff --git a/spec/jobs/update_appellant_representation_job_spec.rb b/spec/jobs/update_appellant_representation_job_spec.rb index 5bfe84c9db4..f045696399a 100644 --- a/spec/jobs/update_appellant_representation_job_spec.rb +++ b/spec/jobs/update_appellant_representation_job_spec.rb @@ -35,13 +35,13 @@ it "runs the job as expected" do expect_any_instance_of(UpdateAppellantRepresentationJob).to_not receive(:log_error).with(anything, anything) - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "caseflow_job", metric_group: "update_appellant_representation_job", metric_name: "runtime", metric_value: anything ) - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "queue_job", attrs: { endpoint: "AppellantNotification.appeal_mapper", service: "queue_job", uuid: anything }, metric_group: "service", @@ -82,7 +82,7 @@ end it "sends the correct number of messages to DataDog and not send a message to Slack" do - expect(DataDogService).to receive(:increment_counter).exactly(7).times + expect(MetricsService).to receive(:increment_counter).exactly(7).times expect_any_instance_of(SlackService).to_not receive(:send_notification) UpdateAppellantRepresentationJob.perform_now @@ -131,7 +131,7 @@ it "the job still runs to completion but sends the errors to DataDog" do args = {} - allow(DataDogService).to receive(:emit_gauge) do |function_args| + allow(MetricsService).to receive(:emit_gauge) do |function_args| args = function_args end @@ -160,7 +160,7 @@ end it "sends a message to Slack that includes the error" do - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( app_name: "caseflow_job", metric_group: UpdateAppellantRepresentationJob.name.underscore, metric_name: "runtime", diff --git a/spec/jobs/update_cached_appeals_attributes_job_spec.rb b/spec/jobs/update_cached_appeals_attributes_job_spec.rb index 442bb669abd..df52155520d 100644 --- a/spec/jobs/update_cached_appeals_attributes_job_spec.rb +++ b/spec/jobs/update_cached_appeals_attributes_job_spec.rb @@ -64,7 +64,7 @@ end it "records the jobs runtime" do - allow(DataDogService).to receive(:emit_gauge) do |args| + allow(MetricsService).to receive(:emit_gauge) do |args| emitted_gauges.push(args) end @@ -79,7 +79,7 @@ end it "records the number of appeals cached" do - allow(DataDogService).to receive(:increment_counter) do |args| + allow(MetricsService).to receive(:increment_counter) do |args| emitted_gauges.push(args) end @@ -90,7 +90,7 @@ end it "records a successful run of the job" do - allow(DataDogService).to receive(:increment_counter) do |args| + allow(MetricsService).to receive(:increment_counter) do |args| emitted_gauges.push(args) end @@ -115,7 +115,7 @@ end it "increments the job error Datadog gauge" do - allow(DataDogService).to receive(:increment_counter) do |args| + allow(MetricsService).to receive(:increment_counter) do |args| emitted_gauges.push(args) end diff --git a/spec/jobs/virtual_hearings/create_conference_job_spec.rb b/spec/jobs/virtual_hearings/create_conference_job_spec.rb index a9a9003c0cc..9828792b5b2 100644 --- a/spec/jobs/virtual_hearings/create_conference_job_spec.rb +++ b/spec/jobs/virtual_hearings/create_conference_job_spec.rb @@ -118,7 +118,7 @@ include_examples "sent email event objects are created" it "logs success to datadog" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "created_conference.successful", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, @@ -189,7 +189,7 @@ end it "logs failure to datadog" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "created_conference.failed", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, diff --git a/spec/jobs/virtual_hearings/delete_conferences_job_spec.rb b/spec/jobs/virtual_hearings/delete_conferences_job_spec.rb index c35f53c23e9..527fda1e772 100644 --- a/spec/jobs/virtual_hearings/delete_conferences_job_spec.rb +++ b/spec/jobs/virtual_hearings/delete_conferences_job_spec.rb @@ -185,7 +185,7 @@ it "it marks the virtual hearing as deleted" do expect(job).to receive(:client).twice.and_return(PexipService.new) - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "deleted_conferences.successful", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, @@ -210,7 +210,7 @@ include_examples "job is retried", 5 it "does not mark the virtual hearings as deleted" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "deleted_conferences.failed", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, @@ -238,7 +238,7 @@ include_examples "job is not retried" it "assumes a 404 means the virtual hearing conference was already deleted" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "deleted_conferences.successful", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, @@ -267,7 +267,7 @@ include_examples "job is retried", 5 it "fails to delete conference" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "deleted_conferences.failed", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, @@ -292,7 +292,7 @@ include_examples "job is retried" it "fails first but then succeeds in deleting conference" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "deleted_conferences.successful", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, @@ -300,7 +300,7 @@ ) ) - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "deleted_conferences.failed", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, diff --git a/spec/models/concerns/appeal_concern_spec.rb b/spec/models/concerns/appeal_concern_spec.rb index 7df2c08a717..e122aaa420c 100644 --- a/spec/models/concerns/appeal_concern_spec.rb +++ b/spec/models/concerns/appeal_concern_spec.rb @@ -66,7 +66,7 @@ class TestAppellantAddressClass let(:country) { "Australia" } it "Returns nil and increments a datadog counter" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( app_name: nil, metric_group: "appeal_timezone_service", metric_name: "ambiguous_timezone_error", diff --git a/spec/models/hearings/forms/hearing_update_form_spec.rb b/spec/models/hearings/forms/hearing_update_form_spec.rb index ebc266555ea..927471d9cd0 100644 --- a/spec/models/hearings/forms/hearing_update_form_spec.rb +++ b/spec/models/hearings/forms/hearing_update_form_spec.rb @@ -41,7 +41,7 @@ end it "sends an update event to datadog" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "updated_virtual_hearing.successful", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, @@ -74,7 +74,7 @@ context "creating a virtual hearing" do it "sends a create event to datadog" do - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( hash_including( metric_name: "created_virtual_hearing.successful", metric_group: Constants.DATADOG_METRICS.HEARINGS.VIRTUAL_HEARINGS_GROUP_NAME, diff --git a/spec/models/legacy_appeal_spec.rb b/spec/models/legacy_appeal_spec.rb index eaace098025..ad9b107919d 100644 --- a/spec/models/legacy_appeal_spec.rb +++ b/spec/models/legacy_appeal_spec.rb @@ -84,7 +84,7 @@ let(:legacy_appeal) { create(:legacy_appeal, vacols_case: create(:case, bfcorlid: "#{ssn}S")) } before do - allow(DataDogService).to receive(:increment_counter) { @datadog_called = true } + allow(MetricsService).to receive(:increment_counter) { @datadog_called = true } end it "prefers the Caseflow Veteran.file_number" do diff --git a/spec/services/business_metrics_spec.rb b/spec/services/business_metrics_spec.rb index 85a860fb672..664bda87f7e 100644 --- a/spec/services/business_metrics_spec.rb +++ b/spec/services/business_metrics_spec.rb @@ -6,7 +6,7 @@ it "sends business metrics to datadog service" do RequestStore[:application] = "queue" - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( metric_group: "business", metric_name: "event", app_name: "queue", diff --git a/spec/services/collectors/daily_counts_stats_collector_spec.rb b/spec/services/collectors/daily_counts_stats_collector_spec.rb index 64a4366458c..ef9ebb3a2be 100644 --- a/spec/services/collectors/daily_counts_stats_collector_spec.rb +++ b/spec/services/collectors/daily_counts_stats_collector_spec.rb @@ -73,7 +73,7 @@ def random_time_of_day end it "records stats with tags" do - allow(DataDogService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } + allow(MetricsService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } slack_msg = [] allow_any_instance_of(SlackService).to receive(:send_notification) { |_, first_arg| slack_msg << first_arg } diff --git a/spec/services/collectors/request_issues_stats_collector_spec.rb b/spec/services/collectors/request_issues_stats_collector_spec.rb index 2f5fae0e566..0a738a6aa21 100644 --- a/spec/services/collectors/request_issues_stats_collector_spec.rb +++ b/spec/services/collectors/request_issues_stats_collector_spec.rb @@ -73,7 +73,7 @@ end it "records stats with tags" do - allow(DataDogService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } + allow(MetricsService).to receive(:emit_gauge) { |args| emitted_gauges.push(args) } slack_msg = [] allow_any_instance_of(SlackService).to receive(:send_notification) { |_, first_arg| slack_msg << first_arg } diff --git a/spec/services/external_api/va_dot_gov_service_spec.rb b/spec/services/external_api/va_dot_gov_service_spec.rb index 45cca494440..2b6acb81aad 100644 --- a/spec/services/external_api/va_dot_gov_service_spec.rb +++ b/spec/services/external_api/va_dot_gov_service_spec.rb @@ -30,6 +30,62 @@ end end + describe "#validate_street_address" do + it "returns validated street address" do + result = VADotGovService.validate_address(address) + + body = JSON.parse(result.response.body) + message_keys = body["messages"].pluck("key") + + expect(result.error).to be_nil + expect(result.data).to_not be_nil + expect(message_keys).to_not include("InvalidRequestStreetAddress") + expect(body["address"]).to include("addressLine1", "addressLine2", "addressLine3") + end + end + + describe "#validate_address_state" do + it "returns validated state in the address" do + result = VADotGovService.validate_address(address) + + body = JSON.parse(result.response.body) + message_keys = body["messages"].pluck("key") + + expect(result.error).to be_nil + expect(result.data).to_not be_nil + expect(message_keys).to_not include("InvalidRequestState") + expect(body["address"]).to include("stateProvince") + end + end + + describe "#validate_address_country" do + it "returns validated country in the address" do + result = VADotGovService.validate_address(address) + + body = JSON.parse(result.response.body) + message_keys = body["messages"].pluck("key") + + expect(result.error).to be_nil + expect(result.data).to_not be_nil + expect(message_keys).to_not include("InvalidRequestCountry") + expect(body["address"]).to include("country") + end + end + + describe "#validate_presence_of_zip_code" do + it "returns validated presence of zip code in address" do + result = VADotGovService.validate_address(address) + + body = JSON.parse(result.response.body) + message_keys = body["messages"].pluck("key") + + expect(result.error).to be_nil + expect(result.data).to_not be_nil + expect(message_keys).to_not include("InvalidRequestPostalCode") + expect(body["address"]).to include("zipCode5") + end + end + describe "#validate_zip_code" do it "returns invalid full address with valid geographic coordinates" do result = VADotGovService.validate_zip_code(address) @@ -48,25 +104,43 @@ describe "#get_distance" do it "returns distance to facilities" do result = VADotGovService.get_distance( - ids: %w[vha_757 vha_539 vha_539], + ids: %w[vha_757 vha_539], lat: 0.0, long: 0.0 ) - expect(result.data.pluck(:facility_id)).to eq(%w[vha_757 vha_539 vha_539]) + expect(result.data.pluck(:facility_id)).to match_array(%w[vha_757 vha_539]) + expect(result.body[:meta][:distances].pluck(:id)).to match_array(%w[vha_757 vha_539]) + expect(result.body[:meta][:distances].pluck(:distance)).to all(be_an(Integer)) + expect(result.error).to be_nil end end describe "#get_facility_data" do it "returns facility data" do - result = VADotGovService.get_facility_data(ids: %w[vha_757 vha_539 vha_539]) + result = VADotGovService.get_facility_data(ids: %w[vha_757 vha_539]) - expect(result.data.pluck(:facility_id)).to eq(%w[vha_757 vha_539 vha_539]) + expect(result.data.pluck(:facility_id)).to match_array(%w[vha_757 vha_539]) + expect(result.body[:meta][:distances].pluck(:id)).to match_array(%w[vha_757 vha_539]) + expect(result.body[:meta][:distances].pluck(:distance)).to all(be_zero) expect(result.error).to be_nil end end + describe "#check_facilities_attributes" do + it "returns facility attributes" do + result = VADotGovService.get_facility_data(ids: %w[vha_757 vha_539]) + + expect(result.body[:data].first.keys).to include(:id, :type, :attributes) + expect(result.body[:data].pluck(:attributes).first.keys).to include(:name, :facilityType, :classification) + + attributes = result.body[:data].pluck(:attributes) + keys = attributes.pluck(:address).pluck(:physical).first.keys + expect(keys).to include(:zip, :city, :state, :address1) + end + end + describe "#check_facility_ids" do it "returns missing facility ids" do result = VADotGovService.check_facility_ids(ids: %w[vba_317 vba_318 vba_319 vba_99999]) diff --git a/spec/services/metrics_service_spec.rb b/spec/services/metrics_service_spec.rb index b9d5b168c2c..6360a5273b8 100644 --- a/spec/services/metrics_service_spec.rb +++ b/spec/services/metrics_service_spec.rb @@ -31,7 +31,7 @@ it "records metrics" do allow(Rails.logger).to receive(:info) - expect(DataDogService).to receive(:emit_gauge).with( + expect(MetricsService).to receive(:emit_gauge).with( metric_group: "service", metric_name: "request_latency", metric_value: anything, @@ -42,7 +42,7 @@ uuid: anything } ) - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( metric_group: "service", app_name: "other", metric_name: "request_attempt", @@ -64,7 +64,7 @@ service: service, endpoint: name }, - sent_to: [["rails_console"], "datadog"], + sent_to: [["rails_console"], "datadog", "dynatrace"], sent_to_info: { metric_group: "service", metric_name: "request_latency", @@ -95,7 +95,7 @@ allow(Benchmark).to receive(:measure).and_raise(StandardError) expect(Rails.logger).to receive(:error) - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( metric_group: "service", app_name: "other", metric_name: "request_error", @@ -104,7 +104,7 @@ endpoint: name } ) - expect(DataDogService).to receive(:increment_counter).with( + expect(MetricsService).to receive(:increment_counter).with( metric_group: "service", app_name: "other", metric_name: "request_attempt", From 5175f0af6ab2fda6af2d9ec8dab0e8c9ca73e337 Mon Sep 17 00:00:00 2001 From: Craig Reese <109101548+craigrva@users.noreply.github.com> Date: Mon, 1 Apr 2024 09:13:33 -0500 Subject: [PATCH 13/41] SCT Appeals, Exclude Judges from Affinity, Lever Modifications (#21310) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * SeanC/APPEALS-35192 | Creation of SCT Organization (#20520) * Created the org for specialty case team * Created new users for sct in the seeds * Added the SCT org to the spec * Isaiah/appeals 38453 migrations (#20661) * APPEALS-38453: ac1-2-added migration to add col. for org. * APPEALS-38453: AC3-update org serialize method * APPEALS-38453: AC1-2 update to caseflow migration * APPEALS-38453: AC1/2-updated syntax * APPEALS-38453: AC1/2 added not null constraint * APPEALS-38453: added etl migration * removed AC3 * Isaiah/appeals 38453 (#20650) * APPEALS-38453: ac1-2-added migration to add col. for org. * APPEALS-38453: AC3-update org serialize method * APPEALS-38453: AC1-2 update to caseflow migration * APPEALS-38453: AC1/2-updated syntax * APPEALS-38453: AC1/2 added not null constraint * APPEALS-38453: added etl migration * APPEALS-38453: ac4-add class method to judge_team * APPEALS-38453: ac4 revised into class method * APPEALS-38453: AC5-added rspec setup * added testing + migration * added inactive judge team to testing --------- Co-authored-by: Calvin Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> * Exclude Work (#20647) * Exclude Work * fixed button * fixed colspan for button * styling + rubocop fixes * added border between sections to match wireframe * updated button styling * fixed lingering border bottom * backend implemented + fixed more css issues * updated snapshot * Changing cases to appeals in label * updated team management spec to ensure org is updated correctly * feature test * added description to feature tests * TYLERB/APPEALS-35191: Distribution of cases to SCT Queue (#20545) * Added a placeholder SCT org. * Added some initial code to distribute SCT appeals. * Added specialty_case_team_assign_task and factory.Copied how the JudgeAssignTask for the new task. * First try at looping code for SCT distributions. * Updated the distrobution code to remove some syntax errors and started adjusting a docket test in order to attempt to test the code. * Commented out testing code and added feature toggle to the docket.rb distribute appeals method to quickly switch SCT_Appeals on and off. * sct task creator and sct assign task specs * Moved the sct creation to the distribution concern so it could be used in the HearingRequests docket. Added in code so SCT appeals can be distributed via a HearingsRequestDocket as well. Fixed an appeal factory bug where it was not reloading after adding request issues via the :with_vha_issue trait. Added additional testing code in docket_spec.rb and added a test in the hearing request docket spec.rb file. * Added a method to docket.rb to check for the sct distribute appeals feature toggle. Cleaned up debugging code. Created an sct_predicates array in the distribution concern to allow for easily adding new rules for appeals that should be assigned to the specialty case team. Added an additional test to the hearing request docket spec to test when the feature toggle is disabled. Added feature toggle wrappers to the hearing request docket.rb file and the hearing request case distributor.rb file. Refactored some methods to fix rubocop errors. * Rubocop fix in docket.rb. * Added some extra ama statistics for sct_appeals to the automatic_case_distribution.rb and by_docket_date_distribution.rb * Cleaned up todo statements. Updated the SCTAssign task block comment to be more correct. Fixed the sct_assign_task factory to put the appeal in a more correct state after distribution. Added some ignore reek FeatureEnvy in line disable comments. * Fixed a test and expanded the sct_distribution feature toggle check to include the user parameter. * Turned on validation for distributed case for ama dockets to see if it works. * Removed testing sct org code from the branch. * Updated tests to work with the new validation for DistributedCases for the sct_field for ama_dockets. Update the sct assign task factory to be direct review docket instead of evidence submission by default. Added SCT assign tasks to the vha seeding files. * Fixed a bug that could result in an infinite loop due to a where not in null clause. Changed the distribution distributed cases count method to not count sct appeals in the value that is returned to the user interface. * Fixed rubocop and code climate issues. * Fixing a bug caused by code climate fixes. Fixing test failures by adding a feature toggle check in case distribution.rb. * Fixed some test failures that I think came from master. * Renamed the SCTAssignTaskCreator to its full name of SpecialtyCaseTeamAssignTaskCreator. Also renamed the file names and the spec file. * Removed code that got reverted from master. Hopefully doesn't break anything in the future. * Added rubocop statement into by_docket_date_distribution.rb --------- Co-authored-by: Jonathan Hoang * Craig/appeals 37330 (#20713) * add seed for affinity, add to seeds.rb * revert change to hearing day factory to fix tests * fix seed to run from command line instead of only rails console * fix issue with seed file causing failure when doing make reset * SeanC/APPEALS-35193 | Creation of Action Required and Completed tab (#20575) * created the model for the specialty_case_team_action_required_tasks_tab * created the model for the specialty_case_team_completed_tasks_tab * Added constants for the action required and completed tabs * added new tabs to specialty case team model * made a barebones spec for the specialty case team * added a new def for completed tasks in the last 14 days * added new last 14 days completed method to task * added new def to get the completed tasks from last 14 days * added def for on hold task with child attorney tasks that are cancelled * working on the tests * working on a new factory * working on a new factory * Revert "working on a new factory" This reverts commit 41be05b1017422282efac39d1004ee90843b1e65. * changed the query for the action required task tab * cleaned up some lint * fixed a data setup and a failing test * most recent version of sct_assgin_task factory * Fixed a failing test * moved the factory * Added missing files from Tylers PR * created seeds to sct appeals * removed comments * removed unnecessary line * removed unneed assigned_to * improved the seed data * Added a unique name for the completed tasks * improved tests * slight improvement to test * fixed failing test * Sean/appeals 37339 (#20731) * apply affinity exclusions logic to the docket * added adjust_for_affinity * cleaned up parameters * Added safe navigation * added feature toggle * added spec for acd_exclude_from_affinity when toggle is enable * include query fix --------- Co-authored-by: Sean Parker Co-authored-by: samasudhirreddy * J hoang/appeals 35650 (#20737) * Added a placeholder SCT org. * Added some initial code to distribute SCT appeals. * Added specialty_case_team_assign_task and factory.Copied how the JudgeAssignTask for the new task. * First try at looping code for SCT distributions. * Updated the distrobution code to remove some syntax errors and started adjusting a docket test in order to attempt to test the code. * Commented out testing code and added feature toggle to the docket.rb distribute appeals method to quickly switch SCT_Appeals on and off. * sct task creator and sct assign task specs * Moved the sct creation to the distribution concern so it could be used in the HearingRequests docket. Added in code so SCT appeals can be distributed via a HearingsRequestDocket as well. Fixed an appeal factory bug where it was not reloading after adding request issues via the :with_vha_issue trait. Added additional testing code in docket_spec.rb and added a test in the hearing request docket spec.rb file. * Added a method to docket.rb to check for the sct distribute appeals feature toggle. Cleaned up debugging code. Created an sct_predicates array in the distribution concern to allow for easily adding new rules for appeals that should be assigned to the specialty case team. Added an additional test to the hearing request docket spec to test when the feature toggle is disabled. Added feature toggle wrappers to the hearing request docket.rb file and the hearing request case distributor.rb file. Refactored some methods to fix rubocop errors. * Rubocop fix in docket.rb. * Added some extra ama statistics for sct_appeals to the automatic_case_distribution.rb and by_docket_date_distribution.rb * Cleaned up todo statements. Updated the SCTAssign task block comment to be more correct. Fixed the sct_assign_task factory to put the appeal in a more correct state after distribution. Added some ignore reek FeatureEnvy in line disable comments. * Fixed a test and expanded the sct_distribution feature toggle check to include the user parameter. * Turned on validation for distributed case for ama dockets to see if it works. * Removed testing sct org code from the branch. * Updated tests to work with the new validation for DistributedCases for the sct_field for ama_dockets. Update the sct assign task factory to be direct review docket instead of evidence submission by default. Added SCT assign tasks to the vha seeding files. * Fixed a bug that could result in an infinite loop due to a where not in null clause. Changed the distribution distributed cases count method to not count sct appeals in the value that is returned to the user interface. * Fixed rubocop and code climate issues. * Fixing a bug caused by code climate fixes. Fixing test failures by adding a feature toggle check in case distribution.rb. * Fixed some test failures that I think came from master. * Renamed the SCTAssignTaskCreator to its full name of SpecialtyCaseTeamAssignTaskCreator. Also renamed the file names and the spec file. * Removed code that got reverted from master. Hopefully doesn't break anything in the future. * Added rubocop statement into by_docket_date_distribution.rb * Move to SCT Modal creation * initial feature test * feature tests, update flash alerts and conditional modal prompt * remove console.log * code climate fixes * update feature test failure * trying another fix for feature test * more feature test changes, no querying * veteran name clarity * addressed pr comments * change veteran reference to claimant instead * fix claimant reference * remove check in spec for cases that were moved to sct since the tab has not been created * addressing more pr comments * do not move appeal to sct if predocket is needed or if in predocket already * fix moveToSctModal visibility and sct success banner visibility * wrap modal and success banner visibility behind feature toggle, --------- Co-authored-by: = Co-authored-by: Jonathan Hoang * TYLERB/APPEALS-29233-Master-merge (#20864) * added nonpriority iterations to until clause in requested_distribution * add tests for limiting nonpriority iterations * Revert "Revert "Feature/appeals 26736"" * change iterations limit to batch_size * hotfix/APPEALS-39368: fix bug where nil ends up in @appeals array (#20668) * fix bug where nil ends up in @appeals array * add ama_statistics error handling * clarify error message when rescuing in ama_statistics * fix priority push job * fix tests * fix test * add seed file to populate judges and attorneys from VACOLS * add task to can redistribute check on appeal (#20843) * add task to can redistribute check on appeal * update test * add tests for distribution concern file * add comment to can_redistribute_appeal? describing the irrelevant tasks * reduce the max number of nonpriority iterations * fix test in by docket date distribution * Fixed flaky tests in docket_spec.rb file by adding receipt dates to the appeals. Added sct_appeal? to the static_test_data seeds to fix the static test data seeds spec test. Fixed code climate issue in case distribution by extracting the remainder decrement to another method. * Fixing spec failures. * Forgot to include a parameter in the method defintion. * Fixed failing specs in push_priority_appeals_to_judges_job_spec.rb. Fixed reek feature envy in case distribution. --------- Co-authored-by: Craig Reese Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> * TYLERB/APPEALS-29233-master-merge-v3 (#20895) * added nonpriority iterations to until clause in requested_distribution * add tests for limiting nonpriority iterations * Revert "Revert "Feature/appeals 26736"" * change iterations limit to batch_size * hotfix/APPEALS-39368: fix bug where nil ends up in @appeals array (#20668) * fix bug where nil ends up in @appeals array * add ama_statistics error handling * clarify error message when rescuing in ama_statistics * fix priority push job * fix tests * fix test * add seed file to populate judges and attorneys from VACOLS * add task to can redistribute check on appeal (#20843) * add task to can redistribute check on appeal * update test * add tests for distribution concern file * add comment to can_redistribute_appeal? describing the irrelevant tasks * reduce the max number of nonpriority iterations * fix test in by docket date distribution --------- Co-authored-by: Craig Reese Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> * [APPEALS-37338]Modify Hearings Docket SQL for Named Judge Affinity Ex… (#20807) * [APPEALS-37338]Modify Hearings Docket SQL for Named Judge Affinity Exclusions * added feature toggle to only genpop appeals method * added new route for acd_exclude_from_affinity query * added non_genpop_appeals to hearing query * removes comment * Updated test case when feature toggle enable and judge present --------- Co-authored-by: Calvin * Reset to commit before we tried to fix merge conflicts * Initial commit to fix test failures due to master merge conflicts. * Fixed code climate issue. * move scopes from dockets to distribution_scopes (#20816) * move scopes from dockets to distribution_scopes * add comment, add rubocop disable * Feature/appeals 26750 int (#20933) * placeholder files exist (#19734) * placeholder files exist * APPEALS-32385 the lever component should be singular * APPEALS-32385 fixed plurality in the content file * adds admin_case_distribution to features_config (#19745) * fix the json syntax error (#19781) Co-authored-by: SHarshain * Added a basic reducer for the Levers (#19790) - Allow intial state to be passed into the Lever Reducer - Add generator to Lever Reducer - Add functions for Lever Reducer - Fix test data array Co-authored-by: Christopher Detlef <> * ricky/APPEALS-32386 - Lever History (#19793) * Created LeverHistory Component and updated test data * Fixed name and title, resubmitted styling and testing --------- Co-authored-by: 631966 * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history --------- Co-authored-by: 631966 * Amycommits/appeals 37248 (#20310) * fixed linting errors * APPEALS-37248 progress on the lint errors * APPEALS-37248 took out custom lint fix command * mbeard/APPEALS-36896 (#20293) * updates reducer, modal, actiontypes, index * fixes words and ads asterisks * removes one asterisk * fixes margin * updates scss padding --------- Co-authored-by: 631966 * Ricky/appeals-34350-Error-and-Validation-Handling (#20288) * Updated LeverModal button and reducer to fix error handling * Implemented new error handling in DocketTimeGoals and BatchSize Lever groups * Updated error handling for lever inputs for affinity days * Fixed incorrect check and messages in CheckIsInRange function * Added first part of input validation for duplicate values * Removed leftover code * Updated logic to handle save button enabling if duplicate values are put in fields --------- Co-authored-by: 631966 * Ricky/appeals-34224 (#20316) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631966 * mbeard/APPEALS-36175 (#20285) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * adds url to controller * updates erb files * updates controller * APPEALS-36175 took out extraneous code in the lever modal * updates controller dropdowm menu --------- Co-authored-by: 631966 * Amycommits/appeals 37286 (#20322) * Ricky/appeals 34224 (#20321) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631068 * reverted changes to the caseflow distribution content page that were causing an error * reverted changes to the caseflow distribution content page that were causing an error --------- Co-authored-by: 631068 * APPEALS-36334 Seed Data for ACD Lever Testing (#20317) * APPEALS-36334 Seed Data for ACD Lever Testing * For testing * Re-add lever test seed data --------- Co-authored-by: Christopher Detlef <> * APPEALS-37279 reverted code changes based on feedback (#20318) * APPEALS-37279 reverted code changes based on feedback * APPEALS-37279. revert the api_status_alert lever item --------- Co-authored-by: SHarshain * APPEALS-34623. Created DB table and logged the data to acd-controls t… (#20193) * APPEALS-34623. Created DB table and logged the data to acd-controls test page * APPEALS-34623. Added model associations and spec * sharsha/APPEALS-34623. revert changes in schema to match the feature branch --------- Co-authored-by: SHarshain * APPEALS-37314 fixes X functionality (#20339) * APPEALS-37227. Sort the levers (#20319) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-37290. Refactor (#20340) * APPEALS-37290. Refactor * APPEALS-37290. Updated the integer and float levers and some refactor --------- Co-authored-by: SHarshain Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-36550 Queries for User Testing (#20311) * APPEALS-36550 set up the link so that a query can be downloaded as a CSV on the test page * APPEALS-36550 built out the link with the appropriate routes, and started the appeals ready for distribution query * Add dashboard to test/users Miscellaneous tab * Add navigation links * Update test.html.erb * get appeals ready for distribution for each docket * extract works * Update appeals_ready_for_distribution.rb * legacy appeals ready to distribute done * Update appeals_ready_for_distribution.rb * all ama distributed appeals * distributed legacy appeals * comments --------- Co-authored-by: 631966 * APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373) Co-authored-by: SHarshain Co-authored-by: Matt Roth * APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374) Co-authored-by: SHarshain * added lever_group column and updated seeds files (#20379) * mbeard/APPEALS-37248 (#20364) * corrects scss linting issues * updates scss linting issues * fixes linting issues in scss * fixes almost all linting issues * fixes furhter linting issues * updates linter styling issues * updates leverhistory linting issues * fixes scss linting issues * fixes disappearing save button * "updates styling for linting issues" * "updates styling and fixes leverhistory" * "final edits to styling" * "final final" * adds utiljs and imports function * "updates dockettimegoals" * renaming scss * fixes style issues * "fixes app/styles" --------- Co-authored-by: Matt Roth * Tmr/appeals 32252 refactor (#20376) * remove redundant checks and move url addition to within existing checks * Update case_distribution_levers_controller.rb * linting fixes * Update push_priority_appeals_to_judges_job.rb * Update push_priority_appeals_to_judges_job_spec.rb * Remove CaseDistributionAlgorithmLog * rubocop * Update routes.rb * Update seeds.rb * Update docket_coordinator_spec.rb * Update schema.rb * fix typos * Update application_controller.rb * move unit tests to client/test/ to match project standards * remove storybook files * revert unrelated changes to schema * Delete ToggleSwitch.stories.js * mbeard/APPEALS-36896 (#20391) * "fixes copy" * "updates COPY titles" * "TYPO" * APPEALS-36381 Replace ACD Lever variables with constants (#20398) Co-authored-by: Christopher Detlef <> * APPEALS-37582: Refactor: Audit table cleanup (#20403) * cleanup audit table * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * remove old fields * Update 20240103134452_update_case_distribution_audit_lever_entry.rb * add seed data * prop type validations * Adjust history rendering to account for new database table setup * unit test and remove console logs * update serializer to pass along lever fields for audit entries * Hun jer bah/appeals 32252 redux refactor (#20365) * created root reducer and refactored actions list * swapped Contants for ACTIONS * created place holder lever actions * created proof of concept action for redux store. * fixed action * fixed naming convention * created action to update affinity days * Fix Misc. Controller Linting Issues * created test route to load lever info in full * set up loadLever action to pull add data from new temp controller route * added lever grouping to controller * passed down organized levers to child components * rolled back schema before merging feature in * fixed merge conflict * Update application_controller.rb * cleaned up code for handoff to Kepler team * removed leftover comment * removed ApiUtil method of passing values and used index.html.erb * set up BatchSize to use hooks from store * cleaned up BatchSize props * updated docket time goals and affininty days (pass values to affinity day levers only) * Fix Misc. Issues - Fix levers not loading in BatchSize by moving loading logic to parent component constructor vs. running on component mount. - Fix DB migration issue with not-null column lacking a default. * Remove merge markers * cleaned up old use effects * Update case_distribution_levers_controller.rb * remove loadLevers from PropTypes * add initial state of levers to new store * Update InteractableLeversWrapper.jsx * update to use new store and refactor work * remove passing around of loadedLevers * Update BatchSize.jsx * cleanup --------- Co-authored-by: Alexander Smith Co-authored-by: Matthew Roth * APPEALS-37505: Create Case Distro Algorithm Control users in Demo (#20401) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * revert changes unrelated to work * Update case_distribution_levers_controller_spec.rb * APPEALS-37554 Refactor: Redux Load Levers: Fixes (#20422) * rename folder * rename folder * rename redux properties * fix dashboard * Rename from CaseflowDistribution to CaseDistribution (#20428) * move from caseflowDistribution to caseDistribution * update import statements * rename page * cleanup text strings * remaining instances of CaseflowDistribution * rename reducers/Levers to reducers/levers * pull updates in * rename Levers to levers * bad or missing imports * cleanup unused variable and imports * Update users.rb * Update users.rb * APPEALS-37582 Test Data page swap to css_id for Audit Entries table (#20436) * Update test.html.erb * rename files to match their functional components * Amycommits/appeals 37719 (#20444) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37719 fixed some of the linting and typos * APPEALS-37720 changed the variables in the reducer (#20445) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * Amycommits/appeals 37719.appeals 37720.appeals 37692 (#20446) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37692 fixed linting error * PPEALS-37692 merged the feature branch back in * Serializer was named incorrectly, renaming to match class and database table name (#20451) * Fix mispelled file name * fixed linting errors and warnings * APPEALS-37558 restructured the levers to store the backend lever valu… (#20447) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37558 restructured the levers to store the backend lever value and keep tabs of the actual value change. * mbeard/APPEALS-37526 (#20453) * "updates COPY and fixes some linting issues" * "updates COPY and moves sectiontitles to constantsjs" * "removes linting changes from reducer" * Amycommits/appeals 37767 (#20465) * APPEALS-37767 initial load works * APPEALS-37767 refactored how the admin permissions are stored * APPEALS-37767 updated exclusion table to use admin variable from redux * APPEALS-37767 cleaned up the usage of isAdmin * APPEALS-37767 fixed some linting issues * APPEALS-37767 removed the sectionTitle from the content page * APPEALS-37558 Refactor: Redux Confirm Save (#20452) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * Update case_distribution_audit_lever_entry_serializer_spec.rb * Update case_distribution_levers_controller.rb * rename route and method to update_levers * move lever updating logic into the model * priority distributions comment and affinity days case generation * Create case_distribution_lever_spec.rb * Update case_distribution_levers_controller.rb * Update case_distribution_levers_controller_spec.rb * move data_types constants into an object in ACD_LEVERS * Update case_distribution_lever.rb * Add validation for data_types * case_distribution_lever_spec * linter errors * remove passing around sectionTitles * move algorithm and lever_group strings into ACD_LEVERS * Update DocketTimeGoals.jsx * Update LeverSaveButton.jsx * Update leversSelector.js * create new actions * create individual actions for each data type * use new action in DocketTImeGoals * create SaveModal file * clean up around the different data type updates * show changed levers * show changed levers * Save works and success banner displays * cleanup and account for multiple levers being changed * error banner display * batch size saves * clean up Affinity Days and ensure order * Ensure BatchSize order * Fix DocketTimeGoals ordering * clear errors out when hiding banner * more cleanup * props cleanup * clean up from feature branch merge * linting errors * APPEALS-37558: Refactor: Redux Confirm Save (#20490) * Update ExclusionTable.jsx * update levers after save * update history and audit table to show css_id * Update leversReducer.js * APPEALS-37558 (#20498) * Fix error banner not displaying * Update case_distribution_levers_controller.rb * mbeard/APPEALS-37559 (#20494) * "updates lever cancel function" * "final updates to cancel button, updates controller" * "updated routes, method, and function" * "Unit test for cancel button" * "removed comments from test" * Amycommits/appeals 37508 (#20503) * APPEALS-37508 validation works * APPEALS-37508 added a check for lever errors to the save button. * APPEALS-37508 cleaned up some of the validation functions * github test (#20491) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers --------- Co-authored-by: Christopher Detlef <> * Chrisbdetlef/appeals 37692 (#20512) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers * Add constants and custom html for capybara tests --------- Co-authored-by: Christopher Detlef <> * APPEALS-37558 Fix issues found during QA testing (#20511) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * APPEALS-37558 Prevent bad audit entries (#20522) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * prevent invalid lever changes from getting audit entries * Update case_distribution_lever_spec.rb * APPEALS-37508 redoing the seeds (#20531) * Sharsha/appeals 37511 2 (#20521) * APPEALS-37511. ExclusionTable scss refactor * APPEALS-37511. Static levers scss refactor * APPEALS-37511. Lever History refactor scss * sharsha/APPEALS-37511. linting fixes * APPEALS-37511. Refactor Interactable Levers scss * APPEALS-37511. fix cancel and save button styling * APPEALS-37511. fixes * APPEALS-37511. Lint fixes * APPEALS-37511. updated the mock to use the updated scss files * APPEALS-37511. LeverButtonsWrapper css cleanup * APPEALS-37511. Exclusion table header styling --------- Co-authored-by: SHarshain * Demo VLJ and AVLJ users updates (#20540) * and _AVLJ to AVLJ names * Update case_distribution_test_data.rb * APPEALS-38398 Disabled levers are still showing focus on Admin UI (#20559) * disable tabbing to disable inputs * clean up ToggleSwitch css * Update _toggle_switch.scss * move import * Update _toggle_switch.scss * Update ToggleSwitch.jsx * Update _toggle_switch.scss * test that props are being passed in correctly * Ricky/appeals-37871 (#20534) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data --------- Co-authored-by: Matt Roth * add disabled to other NumberFields (#20564) * mbeard/APPEALS-38541 (#20553) * "makes too_many_cases error dynamic" * "updates controller method to be dynamic" * sharsha/APPEALS-37511_3. Added 30px right padding for table header (#20562) Co-authored-by: SHarshain * APPEALS-37525 Refactor ACD Levers Test Page (#20535) * APPEALS-37525 Refactor ACD Levers Test Page * Change Test Page to React component * Use lever history serializer in controller * Add all current attributes to the Lever Table * Add more attributes to Lever History Table * Update links from ruby to React * APPEALS-37525 moved the lever_history to the model because it's being… (#20538) * APPEALS-37525 moved the lever_history to the model because it's being used in multiple places * APPEALS-37525 changed the options to only display values * Fix unit test --------- Co-authored-by: Christopher Detlef <> * Fix Option Values column * DRY out the history unit test --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-37794 (#20532) * "updates copy issue and radiofield" * "updates accessibility labels" * "attempt to update label" * "updates accessibility vioce over" * "moves logic from radiofield to exclusiontable" * "Updated fixes from comments" * "removes last thing from TextField component" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-37832. Test data seed spec for case distribution (#20561) * APPEALS-37832. Test data seed spec for case distribution * APPEALS-37832. more changes * APPEALS-37832. Added CaseDistributionlevers count --------- Co-authored-by: SHarshain * Ricky/appeals-37556 (#20502) * Updated LeverHistory component, formatting and storage in redux * Updated Jest testing for LeverHistory * Code cleanup and address comments. Reverted save_levers changes * Feature test outline and class names added * Updated feature tests * Fixed linting error with SaveModal * Updated testing for LeverHistory and fixed css id from showing * Created individual lever history action, updated reducer, updated testing * Removed unneeded data in jest test * Cleaned up formatTimestamp function --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-38556 (#20574) * Initial testing for BatchSize and lever data for testing. * Updated BatchSize Testing and additional testing data. * Updated tests to get full testing coverage * APPEALS-37508 resetting the errors when the cancel button is clicked (#20589) * APPEALS-37511. Fix exclusion table member view (#20595) Co-authored-by: SHarshain * Ricky/appeals-37871 (#20596) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data * Updated spacing between value and unit for static lever, updated testing * Updated static lever to separate value and unit using css --------- Co-authored-by: Matt Roth * APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613) Co-authored-by: SHarshain * APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614) Co-authored-by: SHarshain * APPEALS-38570. Improve the test coverage (#20584) * APPEALS-38570. Improve the test coverage * APPEALS-38570. Dead code cleanup * APPEALS-38570. test coverage to address the exception --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38764 Add Batch Size Lever feautre tests (#20618) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-38561 (#20622) * "initial commit, adds test and save button export" * "adds leversavebutton unit test" * APPEALS-38789 Added error message validation to feature test for Docket Goals (#20625) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * fix merge conflict error * APPEALS-38787 Add Affinity Days levers feature tests (#20619) Co-authored-by: Christopher Detlef <> * APPEALS-38903 Add Inactive Data Elements lever feature tests (#20621) Co-authored-by: Christopher Detlef <> * APPEALS-38555. Affinity Days jest test (#20633) Co-authored-by: SHarshain * Ricky/appeals-38557 (#20634) * Began work on DocketTimeGoal testing, updated toSorted to sort * Updated unit tests to improve coverage on DocketTimeGoals * Updated unit tests to begin working on testing toggleLever * rebuild PR (#20617) * rebuild PR * Update LeverHistory.jsx * Cleaned up DocketTimeGoals test --------- Co-authored-by: Matt Roth * APPEALS-38904 Add Feature Test for Audit Lever History (#20637) * Initial pass * APPEALS-38904 Add Feature Test for Audit Lever History --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * mbeard/APPEALS-38558 (#20630) * "initial commit, created test, updated wrapper" * "adds test cases for save and cancel buttons" * "updates revertLevers to resetLevers for clarity" * "removes problematic test case" --------- Co-authored-by: Matt Roth * APPEALS-38526. 100% test coverage for Case distribution test data seed (#20638) * APPEALS-38526. 100% test coverage for Case distribution test data seed * APPEALS-38526. Fix the typo * APPEALS-38526. Fix the typo in class and related spec --------- Co-authored-by: SHarshain * Ricky/appeals-38567 (#20642) * Updated caseDistributionApp test file and added additional test lever data * Updated test for CaseDistributionApp * Updated rootreducer test for full coverage (#20653) * APPEALS-38555. Added the test coverage to verify the text input (#20654) Co-authored-by: SHarshain * Update to audit lever history time entries to display leading 0s for hours, minutes, and seconds (#20652) * APPEALS-38558 amended test to cover the remaining thee lines of code (#20643) * APPEALS-38790 Add Lever Button feature tests (#20662) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-39284 (#20663) * "initial commit with updates controller, actions, reducer" * "updates leversActions error message" * "updates case dist levers controller spec" * "removes redundant line from update_levers method" * pull changes from hotfix branch (#20667) * APPEALS-38542 got rid of code that is not being used (#20673) * APPEALS-38542 got rid of code that is not being used * APPEALS-38542. Remove unused constant from actions list * APPEALS-38542. remove deadcode spec --------- Co-authored-by: SHarshain * APPEALS-38562./ Removes the unused component (#20697) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "Created jest for leversactions" (#20701) * Chrisbdetlef/appeals 38966 (#20700) * APPEALS-38966 Add dynamic * generation for lever labels/titles * Remove file * Refactor to use a single utility method --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * Ricky/appeals-38569 (#20681) * Pushed changes to LeversReducer Test * Updated unit tests for additional coverage * Pushed up changes to have eyes on async tests * Pulled in Amy's changes and moved data to adminCaseDistributionLevers * Updated test data naming for mocks and tests * Updated testing to fix issues and improve coverage * Updated unit tests, added comments on unfinished work * APPEALS-38569 updated the reducer to give the expected information in the jest tests --------- Co-authored-by: 631966 * mbeard/APPEALS-37794 (#20685) * APPEALS-37794 made changes to the shared number and text components so that we have more control over what the aria-label is * "Updates arialabeltext for batchsize, jests for batchsize and docket time goals" * "updates admin jest aria text query" --------- Co-authored-by: 631966 * revert changes that are causing the Unable to load banner to appear to quick (#20712) * APPEALS-32252 fixed a few rspec tests (#20738) * added the judge list all and attorney list all to help with caching issues * APPEALS-39893 CaseDistributionLever swap over to method_missing (#20744) * remove find_float and find_float, swap to method_missing * codeclimate updates * Update case_distribution_lever.rb * Update case_distribution_lever.rb * APPEALS-39660 Correct ACD Lever Seeds (#20747) Co-authored-by: Christopher Detlef <> * APPEALS-39889 CodeClimate issues (#20740) * move to story branch * Update .codeclimate.yml * pull in dev-support/APPEALS-39031 * Update case_distribution_lever.rb * Update .codeclimate.yml * disable DataClump for db seeds * lint fixes * Update affinity_days_levers_spec.rb * Update case_distribution_lever.rb * Update .codeclimate.yml * pull over other changes * Update case_distribution_lever.rb * Update case_distribution_lever.rb * fix codeclimate issues * fix more issues * rubocop auto fixes * Update test.jsx * mbeard/APPEALS-39895 (#20746) * "updates value in test method and adds new contexts" * "put everything back" * "updates seed value for Dockt weight" * "verifies seed data is correct" (#20754) * APPEALS-39897. Ambiguous id match removed from the component and matched the parent css element (#20745) * APPEALS-39897. Ambiguous id match removed from the component and matched to parent css element * APPEALS-39897. Refactored spec * APPEALS-39897. rubocop fixes * APPEALS-39897. Lint fix --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update leversActions.js (#20760) * APPEALS-39899. Spec fix (#20758) Co-authored-by: SHarshain * revert and move new code to correct file (#20766) * APPEALS-39889 Code Climate issues part 2 (#20759) * swap over to using USWDS colors * more rubocop fixes * add extra lines, remove spaces * Update affinity_days_levers_spec.rb * cleanup unit tests * Update audit_lever_history_table_spec.rb * Update inactive_data_elements_levers_spec.rb * Update _interactable_levers.scss * refactor duplicate code * Update _lever_history.scss * Update affinity_days_levers_spec.rb --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-39984 Update test to match css fix (#20768) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40085 Update ACD lever count (#20769) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40092. Fix negative rspec matcher (#20772) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "fixed spelling and updated spec to include two new users" (#20777) Co-authored-by: Matt Roth * mbeard/APPEALS-38563 (#20577) * "creates savemodal test by adding save button" * "updates and deleted and recreated file" * "latest update to mockstore" * "adds export to save button and updates test" * "current updaates to the test" * "Updates the confirm button to mock confirm button" * Updated testing data and SaveModal tests * "updates logic in utils and updates test" * "adds changedLevers constant mocked data and renders corrrectly" * "adds affinity days to test, and close modal" * "updates test data, adds new cases, adds ids to table" --------- Co-authored-by: 631068 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: 631966 * APPEALS-40134. Add missing traits in factories (#20789) Co-authored-by: SHarshain * APPEALS-40131. Fix case_distribution_levers seed spec (#20786) Co-authored-by: SHarshain * APPEALS-39980. Mock the value in the spec (#20784) Co-authored-by: SHarshain * "updates control group and rsec to never recieve tasks" (#20790) * Updated constants from by docket date to static docket date (#20796) * APPEALS-39892 Unit test fixes (#20798) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * merge issue * Update case_docket.rb (#20782) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * ricky/APPEALS-40090 (#20803) * APPEALS-39892 fixed one file for rubocop issues * Updated jest unit tests to fix issues * Updated leversReducer unit tests * Added export back to LeverSaveButton --------- Co-authored-by: 631966 * APPEALS-39892 Unit tests fixes (#20810) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update case_docket.rb * APPEALS-39987 updated failing snapshots (#20751) * Updated jest config to ignore test.jsx files (#20826) * APPEALS-40136 Bring test data back into range of displayed data (#20824) Co-authored-by: Christopher Detlef <> * Updated By Docket Date to Docket Date (#20827) * APPEALS-39899. docket_coordinator_spec fix (#20829) Co-authored-by: SHarshain * APPEALS-39980. Fix the timestamp failure in the spec (#20836) Co-authored-by: SHarshain * move to new feature branch (#20889) * move to new feature branch (#20890) * APPEALS-38967 Update Implementation of Affinity Days in Admin UI (#20656) * bring over fix for ordering * suggested change * Create 20240130152058_update_case_distribution_levers_is_toggle_active.rb * Update schema.rb * Updates to enable levers that are being tested and for null values in is_toggle_active for n/a levers * Update test.jsx * Update test.jsx * updates for Combination levers, missing updates to allow saving of them * Save combination levers * Update SaveModal.jsx * swap over to methods focused on updating a specific attribute of a lever * change radio to not have value in value * for radio levers set selectedOption when loading levers * Update case_distribution_lever.rb * Update AffinityDays.jsx * Update case_distribution_lever.rb * updates to account for is_toggle_active being nullable * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * fix validation error messages, Radio levers update redux store correctly * changing radio enables Save and displays in Save Modal correctly * fix max values to be 999 * Can save Radio levers successfully * history entries match frontend * Update AffinityDays.jsx * cleanup and comments --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: 631966 Co-authored-by: 631068 Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> Co-authored-by: Alexander Smith * Update case_distribution_lever.rb * Revert schema.rb to correct version for feature work APPEALS-29233 (#20936) * Revert to proper schema.rb for feature work * Use newer version of schema.rb from after merge conflicts were resolved --------- Co-authored-by: Robert Travis Pierce * TYLERB/APPEALS-35646: Assignment of SCT cases from Bulk Assign page (#20698) * Initial commit with the bulk assign page turned on for the SpecialtyCaseTeam. * Created a bunch scaffolding code to mimic how vha camo bulk assign works for the specialty case team in redux and react. * Pulled in the SCT assign task from APPEALS-35191 since the task is needed for this story. * Added new javascript methods to support the sct bulk assign page. Added a new controller and route to handle assigning a task to an attorney from the sct bulk assign page. The task tree is not yet implemented correctly. * Updated the AttorneyTaskCreator to create an attorney task and judge decision review task from an SpecialtyCaseTeamAssignTask. Updated the SCT bulk assign ui to more closely match the designs. Refactored the queue actions for the SCT bulk assign page to work with the returned values from the specialty_case_team_assign_tasks_controller.rb route. * Added in the specialty case team queue tabs from APPEALS-35193 to preemptively test how it would intefere with bulk assign. Added the unassigned queue tab and a method to hide it from the queue via in order to give the SCT bulk assign page a tab that it could use as the basis for the page. Added a few more code comments and removed some old unused code. * Added more styling to the AssignToAttorneyWidget for the SCT bulk assign page for the new property hidePrimaryAssignDropdown. * Added SCT task factory into this PR. Added a randomized vha issue trait to appeal for demoing. Created a bulk assign feature test for the SpecialtyCaseTeam organization. * Added a spec test for the new specialty_case_team_assign_tasks_controller.rb file. * Removed testing code, most todo statements and fixed a few code climate issues. Changed how a few columns were being serialized in the task column serializer to include columns that are used in the SCT organization. * Cleaned up the last of the todos. Fixed a couple more linting issues. Updated the constants in the specialty case team unassigned tasks tab. * Updated spec tests to work with the new hide_from_queue_table_view method. * More code climate fixes. * Fixed typo in spec file. * Changed the tab name to avoid any conflicts with the normal organizations unassigned task tab name. * Updated the UnassignedCasesPage storybook file to show the state for the SCT bulk assign. Added test data for that storybook setup. Updated the selectors for the SCT bulk assign to include in progress tasks in addition to assigned. * Added a new text placeholder for the other assign dropdown attorney search widget for the SCT bulk assign page to match the ui designs. * Removed todo statement in the storybook file for unassigned cases. * Updated the check to determine which assign bulk assignp age you are on to include the role param from the url get params. Added two selectors to support this after the inital active organization is set in the QueueLoadingScreen. This will allow a user who happens to be a member of two orgs that have bulk assign pages to actually use both pages without bugs. * Added traits to the SpecialtyCaseTeamAssignTask factory to generate the correct task tree for the action required and completed tab states. * Fix code climate issues for sct task factory. * Fixed duplicate COPY.json constants. * Updated the SCT unassigned tasks tab to only be assigned tasks. Changed the SCT Action required tab to use the in progress tasks query. Updated the sct factory trait name from on_hold to action_required and changed it in the seeds and spec files. Added back a queue config constant that was missed during the merge. * Updated seeds methods for code climate. * Updated the seed files again. * Disable code climate warning in sct seed method. * Fixed selector bug for specialty case team tasks. Also swapped it back to assigned only for the bulk assign page. * Added else block back into assigned_to task_column_serializer. * Updated success message on the bulk assign page to match the ui designs. * Updated the button on the sct bulk assign page to be disabled instead of the normal error messages that would occur on the user assign page. Updated the wording on the success banner to say cases instead of tasks. Updated the button component to retain styling when loading. Updated tests to reflect the changed sct behavior. * Address code climate issues * Fix legacy appeal's intake edit issues access error * JHoang/APPEALS-35647 (#20872) * functionality to return case to sct queue from attorney queue * Lint cleanup for QueueApp.jsx * merge TYLERB/APPEALS-35646 for task factory and action_required tab changes * Some refactoring based off PR comments. * fix PropType in CancelTaskModal.jsx * revert sct_appeal? logic * refactor attorney return action, rename serializer attrib, attorney_queue spec update * refactor attorney cancel action check --------- Co-authored-by: Jonathan Hoang Co-authored-by: = * TYLERB/APPEALS-35200: Return to Distribution (Split Appeal) (#20859) * Initial commit with the SCT appeals info banner during the split appeals process in the ReviewAppealView component. * Added the task from the distribution story. * Added constant for the SCT task label from the distribution story. * Added specialty case team feature toggle to the ReviewAppealView jsx file. Also added it to the erb file for the edit page so it will be added to the redux store. * Added another factory to get an appeal into a state that is ready for a split appeal. * Updated the issue count column and the issue types column in the task serializer and task column serializer to more accurately reflect the request issues displayed to the user by using the active scope. * Started adding sct_appeal code to the split appeal controller.rb. * Added in a couple of methods to the split appeal controller to send an sct appeal to the sct queue and to send a non sct appeal back to distribution. Also added one additional check to the ui to not display the banner at all if neither of the new appeal streams is an sct appeal. * Cleaned up some old logic and started building the final logic for split sct appeals. * Implemented the full logic for the sct split appeals. * Rewrote the sct_parsing method. * Rewrote some of the split appeal controller spec to reduce code duplication. * Removed some unused code. Refactored some of the SCT split appeals code by fixing bugs and altering the task cloning. Fixed a in the normal split appeal task tree cloning that was causing after update and save hooks to run on clone tasks which would result in a different task tree state from the original appeal. Added tests for SCT split appeals to the split appeal controller. * Refactored the sct split appeal code into a new class named SpecialtyCaseTeamSplitAppealHandler. Removed todos from the ReviewAppealView component. * Refactored specialty case team split appeal handler methods for code climate issues. Removed the remove appeal from current queue method into the appeal class and changed the reference to it in the specialty case team split appeal handler and request issues update. Updated the appeals controller to use a shared appeal method in a couple of places instead of local methods. * Rewrote a lot of the split appeals edit_spec.rb feature tests to require a lot less setup. * Removed unused methods and commented out code from the edit spec. * Fixed a split appeals bug in the appeals.rb model class when cloning an issue due to the unique index on contention_reference_id. Updated the edit_spec.rb file to reduce the amount of setup needed for it by grouping tests and also expanded the test to actually run through a split appeal to completion. * Added feature tests for splitting appeals with a specialty case team request issue. * Updated comment wording. Renamed function to be more explicit. * Added current user accessor to the specialty case team split appeal handler. Added a new method in the handler to cancel the SCT task if it exists when moving an appeal back to distribution. * Removed some todos and added a reek disable to fix code climate issues. * Added tests for sct_appeal? appeal model method and sct_benefit_type? request issue model method. * Removed commented out code. Fixed spec failures due to DecisionIssues not having a contention_reference_id, but request issues do. * Fixed code climate issue. * Removed abc metric disable in distribution concern. * Updated assigned status in specialty case team split appeal handler to use the correct task status constant instead of the string value. * SeanC/APPEALS-35194 | 'Assign to Attorney' task action behavior and execution v3 (#21001) * updated one of the backend test for sct assign task * updated the backend tests for sct queue * updated the availble actions for the sct assign task * added constants for text * added userIsSCTCoordinator to CaseDetails * made some changes to the AssignToAttorneyModalView to meet ac * updated the AssignToAttorneyWidget to disable submit button * fixing failing tests * fixed a lot of failing tests * fixed all of the failing tests in scm_judge_assignment_spec * Updated button text for the ama queue spec.rb feature spec file. * Fixed code climate code duplication. * changed locator for Assign task button to use constant instead of css id * removed waits from excepts in scm_judge_assignment_spec * changed locator for the Assign task button to use the constant instead of the css id in specialty_case_team_queue_spec * reordered the tests in the specialty_case_team_queue_spec * changed the locator for the Assign task button to use the constant instead of the css id in investigate_scm_cant_reassign_spec * fixing the text constant for the locators in judge_assignment_spec * added optional pathAfterSubmit prop for the sct modal * added to expects for the redirct for the modal in the specs * fixed redirect url * Included QueueTableBuilder fix for the hidden queue tab from appeals-35199 and added the specific redirect to the sct queue action required tab in AssignToAttorney back in to the PR. * fixed failing test --------- Co-authored-by: = * TYLERB/APPEALS-35199: Return to Distribution (Edit Issues) (#20922) * Initial commit with the changes required to move an appeal back to distribution when all the sct issues are removed from it. * Updated methods in request issue updates with the correct logic to move an appeal to distribution if the sct feature toggle is enabled, the appeal is no longer an sct appeal, the appeal has a distribution task, and the appeal has a SpecialtyCaseTeamAssignedTask. * Refactored some of the logic in request issues updates for the move to distribution. * Changed a few method names in request issues update to match the appeal model method names. Added a feature test in edit spec for moving an appeal to distribution if all sct issues are removed. * Refactored modal display logic in the EditButtons.jsx file to be more DRY. Added a SPECIALTY_CASE_TEAM_BENEFIT_TYPES.json constants file to make adding additonal benefit types (or another type of check) to the Specialty Case Team easier in the future. Refactored the appeals_controller message display logic to remove code climate error disabling. Updated the request issue model sct_benefit_type? method to use the new constants file as well. * Added more todo comments of things to verify. * Added sct_appeal? method to claim reviews to avoid type checking or try method calls in all the shared locations. * Fixed two broken sct edit_spec.rb tests. * Removed old todo statements. * Fixed a bug for the SCT queue where the tab that was hidden was causing an index out of bounds to default to no selected tab. Also removed the lodash _ import from queue table builder since the only import was the indexOf function. * Added a method to check if an appeal has a specialty case team assign task to prevent the banner from displaying if the appeal was created before the SCT case team existed. * Added an additional check to make sure the appeal is already in the SCT queue to avoid moving appeals back to distribution that were distributed before the SCT work began. * Moved SCT methods out of appeal.rb into a mixin. Also renamed some of them due to code climate issues. * Fixed a double method definition in legacy appeal. Removed the distribution method from legacy appeal and replaced the usage of it with a .try in the edit.html.erb file. * Refactored some logic in request issues update to remove cyclomatic complexity disable. Added method to SCT appeals mixin and moved it out of request issue updates. * Fixed a code climate issue. Added the SCT method mixin to the appeals.rb model file. Fixed a copy and paste error where the call was review.tasks instead of tasks. * Renamed the SCT mixin file and class name because it was failing to load when the file name differed from the class name. * Fixed a syntax error in a method in the sct methods mixin. * More fixes from the mixin method refactor and the mst merge rewrite. * Refactored split appeals to work with methods in the specialty case team methods mixin. Added new logic to the review appeal view jsx file to work with the SCT benefit type constants file. * Fixed an incorrect method name used in split appeals. * Changed benefitType to benefit_type in ReviewAppealView.jsx file after refactor. * Updated the SCT tests in the edit spec feature file to consolodate a few lines of code with a prexisting method. * Added code to make sure that withdrawn issues also trigger the SCT move to distrobution modal and success banner. * Refactored the messages used when adding an issue and removing an sct issue in the appeals controller for easier reusability in the MST/PACT banner. Added messages to the MST/PACT banner for moving an appeal to the SCT queue and moving an appeal to distribution. * Updated SCT logic in the MST/PACT success message again. * Updated the schema file to match the correct date. (#21115) * Merge 36998 into integrated branch (#21123) * APPEALS-41109 ACD Distribution Statistics (#20954) * add distribution_stats * store distribution_stats * unit tests * fix comments * Update distribution.rb * update push priority job to account for distribution_stats table * Revert "update push priority job to account for distribution_stats table" This reverts commit 9ba948858f078fb15bb5175705f7159e2b61ff41. * make sure batch_size ends up in distribution.statistics, rubocop issue fix * Update distribution_spec.rb * Update case_distribution_lever.rb * Sean/appeals 37320 (#20969) * adding slim info Alert to Case Distribution Content * Case Distribution alert with team management page link * correct single quote error * comment code cleanup and removal of unneeded class names * feature toggle and testing for the Case Distribution Content Banner Alert * banner now is toggled by Feature Toggle * add linked alert back in, as requested * added jest tests * fixed lint * fixed more linting issues * revert snapshot * snapshot... * one last change --------- Co-authored-by: Calvin * toggle coverage for judge_team model (#20979) * toggle coverage for judge_team model * featureToggle added to exclude toggles + description * Added feature toggle condition for acd_exclude_from_affinity specs * fixed rspec with feature toggles * addressed comments * fixed rubocop --------- Co-authored-by: Calvin Co-authored-by: samasudhirreddy * have all levers show in snapshot (#21058) * Calvin/APPEALS-41587 create new CDA admin (#21073) * creates new cda admin user in seed * added BVA admin rights * updated user count * update spec * updated for consistency * [APPEALS-40908] Case Distro Algorithm Control group (#21100) Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> --------- Co-authored-by: Matt Roth Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com> Co-authored-by: Calvin Co-authored-by: Isaiah Saucedo Co-authored-by: samasudhirreddy Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Co-authored-by: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> * Feature/appeals 26750 kepler (#21132) * placeholder files exist (#19734) * placeholder files exist * APPEALS-32385 the lever component should be singular * APPEALS-32385 fixed plurality in the content file * adds admin_case_distribution to features_config (#19745) * fix the json syntax error (#19781) Co-authored-by: SHarshain * Added a basic reducer for the Levers (#19790) - Allow intial state to be passed into the Lever Reducer - Add generator to Lever Reducer - Add functions for Lever Reducer - Fix test data array Co-authored-by: Christopher Detlef <> * ricky/APPEALS-32386 - Lever History (#19793) * Created LeverHistory Component and updated test data * Fixed name and title, resubmitted styling and testing --------- Co-authored-by: 631966 * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history --------- Co-authored-by: 631966 * Amycommits/appeals 37248 (#20310) * fixed linting errors * APPEALS-37248 progress on the lint errors * APPEALS-37248 took out custom lint fix command * mbeard/APPEALS-36896 (#20293) * updates reducer, modal, actiontypes, index * fixes words and ads asterisks * removes one asterisk * fixes margin * updates scss padding --------- Co-authored-by: 631966 * Ricky/appeals-34350-Error-and-Validation-Handling (#20288) * Updated LeverModal button and reducer to fix error handling * Implemented new error handling in DocketTimeGoals and BatchSize Lever groups * Updated error handling for lever inputs for affinity days * Fixed incorrect check and messages in CheckIsInRange function * Added first part of input validation for duplicate values * Removed leftover code * Updated logic to handle save button enabling if duplicate values are put in fields --------- Co-authored-by: 631966 * Ricky/appeals-34224 (#20316) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631966 * mbeard/APPEALS-36175 (#20285) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * adds url to controller * updates erb files * updates controller * APPEALS-36175 took out extraneous code in the lever modal * updates controller dropdowm menu --------- Co-authored-by: 631966 * Amycommits/appeals 37286 (#20322) * Ricky/appeals 34224 (#20321) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631068 * reverted changes to the caseflow distribution content page that were causing an error * reverted changes to the caseflow distribution content page that were causing an error --------- Co-authored-by: 631068 * APPEALS-36334 Seed Data for ACD Lever Testing (#20317) * APPEALS-36334 Seed Data for ACD Lever Testing * For testing * Re-add lever test seed data --------- Co-authored-by: Christopher Detlef <> * APPEALS-37279 reverted code changes based on feedback (#20318) * APPEALS-37279 reverted code changes based on feedback * APPEALS-37279. revert the api_status_alert lever item --------- Co-authored-by: SHarshain * APPEALS-34623. Created DB table and logged the data to acd-controls t… (#20193) * APPEALS-34623. Created DB table and logged the data to acd-controls test page * APPEALS-34623. Added model associations and spec * sharsha/APPEALS-34623. revert changes in schema to match the feature branch --------- Co-authored-by: SHarshain * APPEALS-37314 fixes X functionality (#20339) * APPEALS-37227. Sort the levers (#20319) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-37290. Refactor (#20340) * APPEALS-37290. Refactor * APPEALS-37290. Updated the integer and float levers and some refactor --------- Co-authored-by: SHarshain Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-36550 Queries for User Testing (#20311) * APPEALS-36550 set up the link so that a query can be downloaded as a CSV on the test page * APPEALS-36550 built out the link with the appropriate routes, and started the appeals ready for distribution query * Add dashboard to test/users Miscellaneous tab * Add navigation links * Update test.html.erb * get appeals ready for distribution for each docket * extract works * Update appeals_ready_for_distribution.rb * legacy appeals ready to distribute done * Update appeals_ready_for_distribution.rb * all ama distributed appeals * distributed legacy appeals * comments --------- Co-authored-by: 631966 * APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373) Co-authored-by: SHarshain Co-authored-by: Matt Roth * APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374) Co-authored-by: SHarshain * added lever_group column and updated seeds files (#20379) * mbeard/APPEALS-37248 (#20364) * corrects scss linting issues * updates scss linting issues * fixes linting issues in scss * fixes almost all linting issues * fixes furhter linting issues * updates linter styling issues * updates leverhistory linting issues * fixes scss linting issues * fixes disappearing save button * "updates styling for linting issues" * "updates styling and fixes leverhistory" * "final edits to styling" * "final final" * adds utiljs and imports function * "updates dockettimegoals" * renaming scss * fixes style issues * "fixes app/styles" --------- Co-authored-by: Matt Roth * Tmr/appeals 32252 refactor (#20376) * remove redundant checks and move url addition to within existing checks * Update case_distribution_levers_controller.rb * linting fixes * Update push_priority_appeals_to_judges_job.rb * Update push_priority_appeals_to_judges_job_spec.rb * Remove CaseDistributionAlgorithmLog * rubocop * Update routes.rb * Update seeds.rb * Update docket_coordinator_spec.rb * Update schema.rb * fix typos * Update application_controller.rb * move unit tests to client/test/ to match project standards * remove storybook files * revert unrelated changes to schema * Delete ToggleSwitch.stories.js * mbeard/APPEALS-36896 (#20391) * "fixes copy" * "updates COPY titles" * "TYPO" * APPEALS-36381 Replace ACD Lever variables with constants (#20398) Co-authored-by: Christopher Detlef <> * APPEALS-37582: Refactor: Audit table cleanup (#20403) * cleanup audit table * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * remove old fields * Update 20240103134452_update_case_distribution_audit_lever_entry.rb * add seed data * prop type validations * Adjust history rendering to account for new database table setup * unit test and remove console logs * update serializer to pass along lever fields for audit entries * Hun jer bah/appeals 32252 redux refactor (#20365) * created root reducer and refactored actions list * swapped Contants for ACTIONS * created place holder lever actions * created proof of concept action for redux store. * fixed action * fixed naming convention * created action to update affinity days * Fix Misc. Controller Linting Issues * created test route to load lever info in full * set up loadLever action to pull add data from new temp controller route * added lever grouping to controller * passed down organized levers to child components * rolled back schema before merging feature in * fixed merge conflict * Update application_controller.rb * cleaned up code for handoff to Kepler team * removed leftover comment * removed ApiUtil method of passing values and used index.html.erb * set up BatchSize to use hooks from store * cleaned up BatchSize props * updated docket time goals and affininty days (pass values to affinity day levers only) * Fix Misc. Issues - Fix levers not loading in BatchSize by moving loading logic to parent component constructor vs. running on component mount. - Fix DB migration issue with not-null column lacking a default. * Remove merge markers * cleaned up old use effects * Update case_distribution_levers_controller.rb * remove loadLevers from PropTypes * add initial state of levers to new store * Update InteractableLeversWrapper.jsx * update to use new store and refactor work * remove passing around of loadedLevers * Update BatchSize.jsx * cleanup --------- Co-authored-by: Alexander Smith Co-authored-by: Matthew Roth * APPEALS-37505: Create Case Distro Algorithm Control users in Demo (#20401) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * revert changes unrelated to work * Update case_distribution_levers_controller_spec.rb * APPEALS-37554 Refactor: Redux Load Levers: Fixes (#20422) * rename folder * rename folder * rename redux properties * fix dashboard * Rename from CaseflowDistribution to CaseDistribution (#20428) * move from caseflowDistribution to caseDistribution * update import statements * rename page * cleanup text strings * remaining instances of CaseflowDistribution * rename reducers/Levers to reducers/levers * pull updates in * rename Levers to levers * bad or missing imports * cleanup unused variable and imports * Update users.rb * Update users.rb * APPEALS-37582 Test Data page swap to css_id for Audit Entries table (#20436) * Update test.html.erb * rename files to match their functional components * Amycommits/appeals 37719 (#20444) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37719 fixed some of the linting and typos * APPEALS-37720 changed the variables in the reducer (#20445) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * Amycommits/appeals 37719.appeals 37720.appeals 37692 (#20446) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37692 fixed linting error * PPEALS-37692 merged the feature branch back in * Serializer was named incorrectly, renaming to match class and database table name (#20451) * Fix mispelled file name * fixed linting errors and warnings * APPEALS-37558 restructured the levers to store the backend lever valu… (#20447) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37558 restructured the levers to store the backend lever value and keep tabs of the actual value change. * mbeard/APPEALS-37526 (#20453) * "updates COPY and fixes some linting issues" * "updates COPY and moves sectiontitles to constantsjs" * "removes linting changes from reducer" * Amycommits/appeals 37767 (#20465) * APPEALS-37767 initial load works * APPEALS-37767 refactored how the admin permissions are stored * APPEALS-37767 updated exclusion table to use admin variable from redux * APPEALS-37767 cleaned up the usage of isAdmin * APPEALS-37767 fixed some linting issues * APPEALS-37767 removed the sectionTitle from the content page * APPEALS-37558 Refactor: Redux Confirm Save (#20452) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * Update case_distribution_audit_lever_entry_serializer_spec.rb * Update case_distribution_levers_controller.rb * rename route and method to update_levers * move lever updating logic into the model * priority distributions comment and affinity days case generation * Create case_distribution_lever_spec.rb * Update case_distribution_levers_controller.rb * Update case_distribution_levers_controller_spec.rb * move data_types constants into an object in ACD_LEVERS * Update case_distribution_lever.rb * Add validation for data_types * case_distribution_lever_spec * linter errors * remove passing around sectionTitles * move algorithm and lever_group strings into ACD_LEVERS * Update DocketTimeGoals.jsx * Update LeverSaveButton.jsx * Update leversSelector.js * create new actions * create individual actions for each data type * use new action in DocketTImeGoals * create SaveModal file * clean up around the different data type updates * show changed levers * show changed levers * Save works and success banner displays * cleanup and account for multiple levers being changed * error banner display * batch size saves * clean up Affinity Days and ensure order * Ensure BatchSize order * Fix DocketTimeGoals ordering * clear errors out when hiding banner * more cleanup * props cleanup * clean up from feature branch merge * linting errors * APPEALS-37558: Refactor: Redux Confirm Save (#20490) * Update ExclusionTable.jsx * update levers after save * update history and audit table to show css_id * Update leversReducer.js * APPEALS-37558 (#20498) * Fix error banner not displaying * Update case_distribution_levers_controller.rb * mbeard/APPEALS-37559 (#20494) * "updates lever cancel function" * "final updates to cancel button, updates controller" * "updated routes, method, and function" * "Unit test for cancel button" * "removed comments from test" * Amycommits/appeals 37508 (#20503) * APPEALS-37508 validation works * APPEALS-37508 added a check for lever errors to the save button. * APPEALS-37508 cleaned up some of the validation functions * github test (#20491) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers --------- Co-authored-by: Christopher Detlef <> * Chrisbdetlef/appeals 37692 (#20512) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers * Add constants and custom html for capybara tests --------- Co-authored-by: Christopher Detlef <> * APPEALS-37558 Fix issues found during QA testing (#20511) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * APPEALS-37558 Prevent bad audit entries (#20522) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * prevent invalid lever changes from getting audit entries * Update case_distribution_lever_spec.rb * APPEALS-37508 redoing the seeds (#20531) * Sharsha/appeals 37511 2 (#20521) * APPEALS-37511. ExclusionTable scss refactor * APPEALS-37511. Static levers scss refactor * APPEALS-37511. Lever History refactor scss * sharsha/APPEALS-37511. linting fixes * APPEALS-37511. Refactor Interactable Levers scss * APPEALS-37511. fix cancel and save button styling * APPEALS-37511. fixes * APPEALS-37511. Lint fixes * APPEALS-37511. updated the mock to use the updated scss files * APPEALS-37511. LeverButtonsWrapper css cleanup * APPEALS-37511. Exclusion table header styling --------- Co-authored-by: SHarshain * Demo VLJ and AVLJ users updates (#20540) * and _AVLJ to AVLJ names * Update case_distribution_test_data.rb * APPEALS-38398 Disabled levers are still showing focus on Admin UI (#20559) * disable tabbing to disable inputs * clean up ToggleSwitch css * Update _toggle_switch.scss * move import * Update _toggle_switch.scss * Update ToggleSwitch.jsx * Update _toggle_switch.scss * test that props are being passed in correctly * Ricky/appeals-37871 (#20534) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data --------- Co-authored-by: Matt Roth * add disabled to other NumberFields (#20564) * mbeard/APPEALS-38541 (#20553) * "makes too_many_cases error dynamic" * "updates controller method to be dynamic" * sharsha/APPEALS-37511_3. Added 30px right padding for table header (#20562) Co-authored-by: SHarshain * APPEALS-37525 Refactor ACD Levers Test Page (#20535) * APPEALS-37525 Refactor ACD Levers Test Page * Change Test Page to React component * Use lever history serializer in controller * Add all current attributes to the Lever Table * Add more attributes to Lever History Table * Update links from ruby to React * APPEALS-37525 moved the lever_history to the model because it's being… (#20538) * APPEALS-37525 moved the lever_history to the model because it's being used in multiple places * APPEALS-37525 changed the options to only display values * Fix unit test --------- Co-authored-by: Christopher Detlef <> * Fix Option Values column * DRY out the history unit test --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-37794 (#20532) * "updates copy issue and radiofield" * "updates accessibility labels" * "attempt to update label" * "updates accessibility vioce over" * "moves logic from radiofield to exclusiontable" * "Updated fixes from comments" * "removes last thing from TextField component" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-37832. Test data seed spec for case distribution (#20561) * APPEALS-37832. Test data seed spec for case distribution * APPEALS-37832. more changes * APPEALS-37832. Added CaseDistributionlevers count --------- Co-authored-by: SHarshain * Ricky/appeals-37556 (#20502) * Updated LeverHistory component, formatting and storage in redux * Updated Jest testing for LeverHistory * Code cleanup and address comments. Reverted save_levers changes * Feature test outline and class names added * Updated feature tests * Fixed linting error with SaveModal * Updated testing for LeverHistory and fixed css id from showing * Created individual lever history action, updated reducer, updated testing * Removed unneeded data in jest test * Cleaned up formatTimestamp function --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-38556 (#20574) * Initial testing for BatchSize and lever data for testing. * Updated BatchSize Testing and additional testing data. * Updated tests to get full testing coverage * APPEALS-37508 resetting the errors when the cancel button is clicked (#20589) * APPEALS-37511. Fix exclusion table member view (#20595) Co-authored-by: SHarshain * Ricky/appeals-37871 (#20596) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data * Updated spacing between value and unit for static lever, updated testing * Updated static lever to separate value and unit using css --------- Co-authored-by: Matt Roth * APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613) Co-authored-by: SHarshain * APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614) Co-authored-by: SHarshain * APPEALS-38570. Improve the test coverage (#20584) * APPEALS-38570. Improve the test coverage * APPEALS-38570. Dead code cleanup * APPEALS-38570. test coverage to address the exception --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38764 Add Batch Size Lever feautre tests (#20618) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-38561 (#20622) * "initial commit, adds test and save button export" * "adds leversavebutton unit test" * APPEALS-38789 Added error message validation to feature test for Docket Goals (#20625) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * fix merge conflict error * APPEALS-38787 Add Affinity Days levers feature tests (#20619) Co-authored-by: Christopher Detlef <> * APPEALS-38903 Add Inactive Data Elements lever feature tests (#20621) Co-authored-by: Christopher Detlef <> * APPEALS-38555. Affinity Days jest test (#20633) Co-authored-by: SHarshain * Ricky/appeals-38557 (#20634) * Began work on DocketTimeGoal testing, updated toSorted to sort * Updated unit tests to improve coverage on DocketTimeGoals * Updated unit tests to begin working on testing toggleLever * rebuild PR (#20617) * rebuild PR * Update LeverHistory.jsx * Cleaned up DocketTimeGoals test --------- Co-authored-by: Matt Roth * APPEALS-38904 Add Feature Test for Audit Lever History (#20637) * Initial pass * APPEALS-38904 Add Feature Test for Audit Lever History --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * mbeard/APPEALS-38558 (#20630) * "initial commit, created test, updated wrapper" * "adds test cases for save and cancel buttons" * "updates revertLevers to resetLevers for clarity" * "removes problematic test case" --------- Co-authored-by: Matt Roth * APPEALS-38526. 100% test coverage for Case distribution test data seed (#20638) * APPEALS-38526. 100% test coverage for Case distribution test data seed * APPEALS-38526. Fix the typo * APPEALS-38526. Fix the typo in class and related spec --------- Co-authored-by: SHarshain * Ricky/appeals-38567 (#20642) * Updated caseDistributionApp test file and added additional test lever data * Updated test for CaseDistributionApp * Updated rootreducer test for full coverage (#20653) * APPEALS-38555. Added the test coverage to verify the text input (#20654) Co-authored-by: SHarshain * Update to audit lever history time entries to display leading 0s for hours, minutes, and seconds (#20652) * APPEALS-38558 amended test to cover the remaining thee lines of code (#20643) * APPEALS-38790 Add Lever Button feature tests (#20662) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-39284 (#20663) * "initial commit with updates controller, actions, reducer" * "updates leversActions error message" * "updates case dist levers controller spec" * "removes redundant line from update_levers method" * pull changes from hotfix branch (#20667) * APPEALS-38542 got rid of code that is not being used (#20673) * APPEALS-38542 got rid of code that is not being used * APPEALS-38542. Remove unused constant from actions list * APPEALS-38542. remove deadcode spec --------- Co-authored-by: SHarshain * APPEALS-38562./ Removes the unused component (#20697) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "Created jest for leversactions" (#20701) * Chrisbdetlef/appeals 38966 (#20700) * APPEALS-38966 Add dynamic * generation for lever labels/titles * Remove file * Refactor to use a single utility method --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * Ricky/appeals-38569 (#20681) * Pushed changes to LeversReducer Test * Updated unit tests for additional coverage * Pushed up changes to have eyes on async tests * Pulled in Amy's changes and moved data to adminCaseDistributionLevers * Updated test data naming for mocks and tests * Updated testing to fix issues and improve coverage * Updated unit tests, added comments on unfinished work * APPEALS-38569 updated the reducer to give the expected information in the jest tests --------- Co-authored-by: 631966 * mbeard/APPEALS-37794 (#20685) * APPEALS-37794 made changes to the shared number and text components so that we have more control over what the aria-label is * "Updates arialabeltext for batchsize, jests for batchsize and docket time goals" * "updates admin jest aria text query" --------- Co-authored-by: 631966 * revert changes that are causing the Unable to load banner to appear to quick (#20712) * APPEALS-32252 fixed a few rspec tests (#20738) * added the judge list all and attorney list all to help with caching issues * APPEALS-39893 CaseDistributionLever swap over to method_missing (#20744) * remove find_float and find_float, swap to method_missing * codeclimate updates * Update case_distribution_lever.rb * Update case_distribution_lever.rb * APPEALS-39660 Correct ACD Lever Seeds (#20747) Co-authored-by: Christopher Detlef <> * APPEALS-39889 CodeClimate issues (#20740) * move to story branch * Update .codeclimate.yml * pull in dev-support/APPEALS-39031 * Update case_distribution_lever.rb * Update .codeclimate.yml * disable DataClump for db seeds * lint fixes * Update affinity_days_levers_spec.rb * Update case_distribution_lever.rb * Update .codeclimate.yml * pull over other changes * Update case_distribution_lever.rb * Update case_distribution_lever.rb * fix codeclimate issues * fix more issues * rubocop auto fixes * Update test.jsx * mbeard/APPEALS-39895 (#20746) * "updates value in test method and adds new contexts" * "put everything back" * "updates seed value for Dockt weight" * "verifies seed data is correct" (#20754) * APPEALS-39897. Ambiguous id match removed from the component and matched the parent css element (#20745) * APPEALS-39897. Ambiguous id match removed from the component and matched to parent css element * APPEALS-39897. Refactored spec * APPEALS-39897. rubocop fixes * APPEALS-39897. Lint fix --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update leversActions.js (#20760) * APPEALS-39899. Spec fix (#20758) Co-authored-by: SHarshain * revert and move new code to correct file (#20766) * APPEALS-39889 Code Climate issues part 2 (#20759) * swap over to using USWDS colors * more rubocop fixes * add extra lines, remove spaces * Update affinity_days_levers_spec.rb * cleanup unit tests * Update audit_lever_history_table_spec.rb * Update inactive_data_elements_levers_spec.rb * Update _interactable_levers.scss * refactor duplicate code * Update _lever_history.scss * Update affinity_days_levers_spec.rb --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-39984 Update test to match css fix (#20768) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40085 Update ACD lever count (#20769) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40092. Fix negative rspec matcher (#20772) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "fixed spelling and updated spec to include two new users" (#20777) Co-authored-by: Matt Roth * mbeard/APPEALS-38563 (#20577) * "creates savemodal test by adding save button" * "updates and deleted and recreated file" * "latest update to mockstore" * "adds export to save button and updates test" * "current updaates to the test" * "Updates the confirm button to mock confirm button" * Updated testing data and SaveModal tests * "updates logic in utils and updates test" * "adds changedLevers constant mocked data and renders corrrectly" * "adds affinity days to test, and close modal" * "updates test data, adds new cases, adds ids to table" --------- Co-authored-by: 631068 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: 631966 * APPEALS-40134. Add missing traits in factories (#20789) Co-authored-by: SHarshain * APPEALS-40131. Fix case_distribution_levers seed spec (#20786) Co-authored-by: SHarshain * APPEALS-39980. Mock the value in the spec (#20784) Co-authored-by: SHarshain * "updates control group and rsec to never recieve tasks" (#20790) * Updated constants from by docket date to static docket date (#20796) * APPEALS-39892 Unit test fixes (#20798) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * merge issue * Update case_docket.rb (#20782) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * ricky/APPEALS-40090 (#20803) * APPEALS-39892 fixed one file for rubocop issues * Updated jest unit tests to fix issues * Updated leversReducer unit tests * Added export back to LeverSaveButton --------- Co-authored-by: 631966 * APPEALS-39892 Unit tests fixes (#20810) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update case_docket.rb * APPEALS-39987 updated failing snapshots (#20751) * Updated jest config to ignore test.jsx files (#20826) * APPEALS-40136 Bring test data back into range of displayed data (#20824) Co-authored-by: Christopher Detlef <> * Updated By Docket Date to Docket Date (#20827) * APPEALS-39899. docket_coordinator_spec fix (#20829) Co-authored-by: SHarshain * APPEALS-39980. Fix the timestamp failure in the spec (#20836) Co-authored-by: SHarshain * move to new feature branch (#20889) * move to new feature branch (#20890) * APPEALS-38967 Update Implementation of Affinity Days in Admin UI (#20656) * bring over fix for ordering * suggested change * Create 20240130152058_update_case_distribution_levers_is_toggle_active.rb * Update schema.rb * Updates to enable levers that are being tested and for null values in is_toggle_active for n/a levers * Update test.jsx * Update test.jsx * updates for Combination levers, missing updates to allow saving of them * Save combination levers * Update SaveModal.jsx * swap over to methods focused on updating a specific attribute of a lever * change radio to not have value in value * for radio levers set selectedOption when loading levers * Update case_distribution_lever.rb * Update AffinityDays.jsx * Update case_distribution_lever.rb * updates to account for is_toggle_active being nullable * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * fix validation error messages, Radio levers update redux store correctly * changing radio enables Save and displays in Save Modal correctly * fix max values to be 999 * Can save Radio levers successfully * history entries match frontend * Update AffinityDays.jsx * cleanup and comments * Update case_distribution_lever.rb * Update LeverHistory.jsx * Revert "Update LeverHistory.jsx" This reverts commit 6eca84730cac808e5d25b467d370dd21a34013d1. * APPEALS-26750 auto_texts was created as a part of master * Update case_distribution_lever.rb (#20946) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38967 Remove units showing when not needed (#20975) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: 631966 * APPEALS-38744 Update AMA Hearing Case Affinity Days Lever (#20956) * APPEALS-38744 added checks for ama hearing case affinity days lever * APPEALS-38744 refactored logic for ama hearing case affinity days lever * APPEALS-38744 update method name * APPEALS-41456 made changes to the affinity days test data and jest tests to conform to new data changes (#20991) * Tmr/appeals 38967 4 (#21034) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: Matthew Roth * Ricky/appeals-35179 (#20988) * "adds ama aod original appeals method to scopes" * "adds conditional to only_genpop_appeals" * "removes unnecessary copied code" * "adds comment" * "Updates to formatting for shovel methods" * "updates conditional to include correct function, changes scope chain" * "Updates and adds scope for infinite, test passes" * "adds infinite method to scopes" * "created new test scenarios" * "moves line up" * "updates distribution scope methods" * "updates methods" * "updates rspec to update attribute" * "updates def and values" * "updates rspec to new methods" --------- Co-authored-by: Michael Beard * APPEALS-38967 made sure that the lever history displays properly (#21041) * APPEALS-37024 Create Seeds For ACD Demo (#21038) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-38744 (#21039) * "init commit for updating not_genpop_appeals" * "adds new context and updates top ama" * "updates methods on scopes, adds new appeals, updates specs" * Updated logic and rspec tests * APPEALS-38744 rearranged the not_genpop_appeals to only run the not_genpop_appeals query once * APPEALS-38744 took out puts * APPEALS-38744 the queries work through binding.pry the tests are failing due to setup issues * APPEALS-38744 update with new pattern * APPEALS-38744 added a conditional to make affinity days chained correctly * APPEALS-38744 more fiddling * Fix code issues for query structures * Make returns uniformly arrays of arrays * flagged error * "updates hearing docket method to if else" * "fixes ish respecs adding with_no_held_hearings to the array" * "cleanup brush brush brush" --------- Co-authored-by: 631068 Co-authored-by: 631966 Co-authored-by: Christopher Detlef <> * APPEALS-42090 Add newly enabled levers to capybara test (#21117) Co-authored-by: Christopher Detlef <> * APPEALS-26750 updating the kepler feature with the combined branch so that there isn't 200 changed files --------- Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: 631068 Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> Co-authored-by: Matt Roth Co-authored-by: Alexander Smith Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: Michael Beard * Feature/appeals 26750 kepler (#21142) * placeholder files exist (#19734) * placeholder files exist * APPEALS-32385 the lever component should be singular * APPEALS-32385 fixed plurality in the content file * adds admin_case_distribution to features_config (#19745) * fix the json syntax error (#19781) Co-authored-by: SHarshain * Added a basic reducer for the Levers (#19790) - Allow intial state to be passed into the Lever Reducer - Add generator to Lever Reducer - Add functions for Lever Reducer - Fix test data array Co-authored-by: Christopher Detlef <> * ricky/APPEALS-32386 - Lever History (#19793) * Created LeverHistory Component and updated test data * Fixed name and title, resubmitted styling and testing --------- Co-authored-by: 631966 * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history --------- Co-authored-by: 631966 * Amycommits/appeals 37248 (#20310) * fixed linting errors * APPEALS-37248 progress on the lint errors * APPEALS-37248 took out custom lint fix command * mbeard/APPEALS-36896 (#20293) * updates reducer, modal, actiontypes, index * fixes words and ads asterisks * removes one asterisk * fixes margin * updates scss padding --------- Co-authored-by: 631966 * Ricky/appeals-34350-Error-and-Validation-Handling (#20288) * Updated LeverModal button and reducer to fix error handling * Implemented new error handling in DocketTimeGoals and BatchSize Lever groups * Updated error handling for lever inputs for affinity days * Fixed incorrect check and messages in CheckIsInRange function * Added first part of input validation for duplicate values * Removed leftover code * Updated logic to handle save button enabling if duplicate values are put in fields --------- Co-authored-by: 631966 * Ricky/appeals-34224 (#20316) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631966 * mbeard/APPEALS-36175 (#20285) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * adds url to controller * updates erb files * updates controller * APPEALS-36175 took out extraneous code in the lever modal * updates controller dropdowm menu --------- Co-authored-by: 631966 * Amycommits/appeals 37286 (#20322) * Ricky/appeals 34224 (#20321) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631068 * reverted changes to the caseflow distribution content page that were causing an error * reverted changes to the caseflow distribution content page that were causing an error --------- Co-authored-by: 631068 * APPEALS-36334 Seed Data for ACD Lever Testing (#20317) * APPEALS-36334 Seed Data for ACD Lever Testing * For testing * Re-add lever test seed data --------- Co-authored-by: Christopher Detlef <> * APPEALS-37279 reverted code changes based on feedback (#20318) * APPEALS-37279 reverted code changes based on feedback * APPEALS-37279. revert the api_status_alert lever item --------- Co-authored-by: SHarshain * APPEALS-34623. Created DB table and logged the data to acd-controls t… (#20193) * APPEALS-34623. Created DB table and logged the data to acd-controls test page * APPEALS-34623. Added model associations and spec * sharsha/APPEALS-34623. revert changes in schema to match the feature branch --------- Co-authored-by: SHarshain * APPEALS-37314 fixes X functionality (#20339) * APPEALS-37227. Sort the levers (#20319) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-37290. Refactor (#20340) * APPEALS-37290. Refactor * APPEALS-37290. Updated the integer and float levers and some refactor --------- Co-authored-by: SHarshain Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-36550 Queries for User Testing (#20311) * APPEALS-36550 set up the link so that a query can be downloaded as a CSV on the test page * APPEALS-36550 built out the link with the appropriate routes, and started the appeals ready for distribution query * Add dashboard to test/users Miscellaneous tab * Add navigation links * Update test.html.erb * get appeals ready for distribution for each docket * extract works * Update appeals_ready_for_distribution.rb * legacy appeals ready to distribute done * Update appeals_ready_for_distribution.rb * all ama distributed appeals * distributed legacy appeals * comments --------- Co-authored-by: 631966 * APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373) Co-authored-by: SHarshain Co-authored-by: Matt Roth * APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374) Co-authored-by: SHarshain * added lever_group column and updated seeds files (#20379) * mbeard/APPEALS-37248 (#20364) * corrects scss linting issues * updates scss linting issues * fixes linting issues in scss * fixes almost all linting issues * fixes furhter linting issues * updates linter styling issues * updates leverhistory linting issues * fixes scss linting issues * fixes disappearing save button * "updates styling for linting issues" * "updates styling and fixes leverhistory" * "final edits to styling" * "final final" * adds utiljs and imports function * "updates dockettimegoals" * renaming scss * fixes style issues * "fixes app/styles" --------- Co-authored-by: Matt Roth * Tmr/appeals 32252 refactor (#20376) * remove redundant checks and move url addition to within existing checks * Update case_distribution_levers_controller.rb * linting fixes * Update push_priority_appeals_to_judges_job.rb * Update push_priority_appeals_to_judges_job_spec.rb * Remove CaseDistributionAlgorithmLog * rubocop * Update routes.rb * Update seeds.rb * Update docket_coordinator_spec.rb * Update schema.rb * fix typos * Update application_controller.rb * move unit tests to client/test/ to match project standards * remove storybook files * revert unrelated changes to schema * Delete ToggleSwitch.stories.js * mbeard/APPEALS-36896 (#20391) * "fixes copy" * "updates COPY titles" * "TYPO" * APPEALS-36381 Replace ACD Lever variables with constants (#20398) Co-authored-by: Christopher Detlef <> * APPEALS-37582: Refactor: Audit table cleanup (#20403) * cleanup audit table * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * remove old fields * Update 20240103134452_update_case_distribution_audit_lever_entry.rb * add seed data * prop type validations * Adjust history rendering to account for new database table setup * unit test and remove console logs * update serializer to pass along lever fields for audit entries * Hun jer bah/appeals 32252 redux refactor (#20365) * created root reducer and refactored actions list * swapped Contants for ACTIONS * created place holder lever actions * created proof of concept action for redux store. * fixed action * fixed naming convention * created action to update affinity days * Fix Misc. Controller Linting Issues * created test route to load lever info in full * set up loadLever action to pull add data from new temp controller route * added lever grouping to controller * passed down organized levers to child components * rolled back schema before merging feature in * fixed merge conflict * Update application_controller.rb * cleaned up code for handoff to Kepler team * removed leftover comment * removed ApiUtil method of passing values and used index.html.erb * set up BatchSize to use hooks from store * cleaned up BatchSize props * updated docket time goals and affininty days (pass values to affinity day levers only) * Fix Misc. Issues - Fix levers not loading in BatchSize by moving loading logic to parent component constructor vs. running on component mount. - Fix DB migration issue with not-null column lacking a default. * Remove merge markers * cleaned up old use effects * Update case_distribution_levers_controller.rb * remove loadLevers from PropTypes * add initial state of levers to new store * Update InteractableLeversWrapper.jsx * update to use new store and refactor work * remove passing around of loadedLevers * Update BatchSize.jsx * cleanup --------- Co-authored-by: Alexander Smith Co-authored-by: Matthew Roth * APPEALS-37505: Create Case Distro Algorithm Control users in Demo (#20401) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * revert changes unrelated to work * Update case_distribution_levers_controller_spec.rb * APPEALS-37554 Refactor: Redux Load Levers: Fixes (#20422) * rename folder * rename folder * rename redux properties * fix dashboard * Rename from CaseflowDistribution to CaseDistribution (#20428) * move from caseflowDistribution to caseDistribution * update import statements * rename page * cleanup text strings * remaining instances of CaseflowDistribution * rename reducers/Levers to reducers/levers * pull updates in * rename Levers to levers * bad or missing imports * cleanup unused variable and imports * Update users.rb * Update users.rb * APPEALS-37582 Test Data page swap to css_id for Audit Entries table (#20436) * Update test.html.erb * rename files to match their functional components * Amycommits/appeals 37719 (#20444) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37719 fixed some of the linting and typos * APPEALS-37720 changed the variables in the reducer (#20445) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * Amycommits/appeals 37719.appeals 37720.appeals 37692 (#20446) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37692 fixed linting error * PPEALS-37692 merged the feature branch back in * Serializer was named incorrectly, renaming to match class and database table name (#20451) * Fix mispelled file name * fixed linting errors and warnings * APPEALS-37558 restructured the levers to store the backend lever valu… (#20447) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37558 restructured the levers to store the backend lever value and keep tabs of the actual value change. * mbeard/APPEALS-37526 (#20453) * "updates COPY and fixes some linting issues" * "updates COPY and moves sectiontitles to constantsjs" * "removes linting changes from reducer" * Amycommits/appeals 37767 (#20465) * APPEALS-37767 initial load works * APPEALS-37767 refactored how the admin permissions are stored * APPEALS-37767 updated exclusion table to use admin variable from redux * APPEALS-37767 cleaned up the usage of isAdmin * APPEALS-37767 fixed some linting issues * APPEALS-37767 removed the sectionTitle from the content page * APPEALS-37558 Refactor: Redux Confirm Save (#20452) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * Update case_distribution_audit_lever_entry_serializer_spec.rb * Update case_distribution_levers_controller.rb * rename route and method to update_levers * move lever updating logic into the model * priority distributions comment and affinity days case generation * Create case_distribution_lever_spec.rb * Update case_distribution_levers_controller.rb * Update case_distribution_levers_controller_spec.rb * move data_types constants into an object in ACD_LEVERS * Update case_distribution_lever.rb * Add validation for data_types * case_distribution_lever_spec * linter errors * remove passing around sectionTitles * move algorithm and lever_group strings into ACD_LEVERS * Update DocketTimeGoals.jsx * Update LeverSaveButton.jsx * Update leversSelector.js * create new actions * create individual actions for each data type * use new action in DocketTImeGoals * create SaveModal file * clean up around the different data type updates * show changed levers * show changed levers * Save works and success banner displays * cleanup and account for multiple levers being changed * error banner display * batch size saves * clean up Affinity Days and ensure order * Ensure BatchSize order * Fix DocketTimeGoals ordering * clear errors out when hiding banner * more cleanup * props cleanup * clean up from feature branch merge * linting errors * APPEALS-37558: Refactor: Redux Confirm Save (#20490) * Update ExclusionTable.jsx * update levers after save * update history and audit table to show css_id * Update leversReducer.js * APPEALS-37558 (#20498) * Fix error banner not displaying * Update case_distribution_levers_controller.rb * mbeard/APPEALS-37559 (#20494) * "updates lever cancel function" * "final updates to cancel button, updates controller" * "updated routes, method, and function" * "Unit test for cancel button" * "removed comments from test" * Amycommits/appeals 37508 (#20503) * APPEALS-37508 validation works * APPEALS-37508 added a check for lever errors to the save button. * APPEALS-37508 cleaned up some of the validation functions * github test (#20491) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers --------- Co-authored-by: Christopher Detlef <> * Chrisbdetlef/appeals 37692 (#20512) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers * Add constants and custom html for capybara tests --------- Co-authored-by: Christopher Detlef <> * APPEALS-37558 Fix issues found during QA testing (#20511) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * APPEALS-37558 Prevent bad audit entries (#20522) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * prevent invalid lever changes from getting audit entries * Update case_distribution_lever_spec.rb * APPEALS-37508 redoing the seeds (#20531) * Sharsha/appeals 37511 2 (#20521) * APPEALS-37511. ExclusionTable scss refactor * APPEALS-37511. Static levers scss refactor * APPEALS-37511. Lever History refactor scss * sharsha/APPEALS-37511. linting fixes * APPEALS-37511. Refactor Interactable Levers scss * APPEALS-37511. fix cancel and save button styling * APPEALS-37511. fixes * APPEALS-37511. Lint fixes * APPEALS-37511. updated the mock to use the updated scss files * APPEALS-37511. LeverButtonsWrapper css cleanup * APPEALS-37511. Exclusion table header styling --------- Co-authored-by: SHarshain * Demo VLJ and AVLJ users updates (#20540) * and _AVLJ to AVLJ names * Update case_distribution_test_data.rb * APPEALS-38398 Disabled levers are still showing focus on Admin UI (#20559) * disable tabbing to disable inputs * clean up ToggleSwitch css * Update _toggle_switch.scss * move import * Update _toggle_switch.scss * Update ToggleSwitch.jsx * Update _toggle_switch.scss * test that props are being passed in correctly * Ricky/appeals-37871 (#20534) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data --------- Co-authored-by: Matt Roth * add disabled to other NumberFields (#20564) * mbeard/APPEALS-38541 (#20553) * "makes too_many_cases error dynamic" * "updates controller method to be dynamic" * sharsha/APPEALS-37511_3. Added 30px right padding for table header (#20562) Co-authored-by: SHarshain * APPEALS-37525 Refactor ACD Levers Test Page (#20535) * APPEALS-37525 Refactor ACD Levers Test Page * Change Test Page to React component * Use lever history serializer in controller * Add all current attributes to the Lever Table * Add more attributes to Lever History Table * Update links from ruby to React * APPEALS-37525 moved the lever_history to the model because it's being… (#20538) * APPEALS-37525 moved the lever_history to the model because it's being used in multiple places * APPEALS-37525 changed the options to only display values * Fix unit test --------- Co-authored-by: Christopher Detlef <> * Fix Option Values column * DRY out the history unit test --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-37794 (#20532) * "updates copy issue and radiofield" * "updates accessibility labels" * "attempt to update label" * "updates accessibility vioce over" * "moves logic from radiofield to exclusiontable" * "Updated fixes from comments" * "removes last thing from TextField component" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-37832. Test data seed spec for case distribution (#20561) * APPEALS-37832. Test data seed spec for case distribution * APPEALS-37832. more changes * APPEALS-37832. Added CaseDistributionlevers count --------- Co-authored-by: SHarshain * Ricky/appeals-37556 (#20502) * Updated LeverHistory component, formatting and storage in redux * Updated Jest testing for LeverHistory * Code cleanup and address comments. Reverted save_levers changes * Feature test outline and class names added * Updated feature tests * Fixed linting error with SaveModal * Updated testing for LeverHistory and fixed css id from showing * Created individual lever history action, updated reducer, updated testing * Removed unneeded data in jest test * Cleaned up formatTimestamp function --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-38556 (#20574) * Initial testing for BatchSize and lever data for testing. * Updated BatchSize Testing and additional testing data. * Updated tests to get full testing coverage * APPEALS-37508 resetting the errors when the cancel button is clicked (#20589) * APPEALS-37511. Fix exclusion table member view (#20595) Co-authored-by: SHarshain * Ricky/appeals-37871 (#20596) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data * Updated spacing between value and unit for static lever, updated testing * Updated static lever to separate value and unit using css --------- Co-authored-by: Matt Roth * APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613) Co-authored-by: SHarshain * APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614) Co-authored-by: SHarshain * APPEALS-38570. Improve the test coverage (#20584) * APPEALS-38570. Improve the test coverage * APPEALS-38570. Dead code cleanup * APPEALS-38570. test coverage to address the exception --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38764 Add Batch Size Lever feautre tests (#20618) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-38561 (#20622) * "initial commit, adds test and save button export" * "adds leversavebutton unit test" * APPEALS-38789 Added error message validation to feature test for Docket Goals (#20625) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * fix merge conflict error * APPEALS-38787 Add Affinity Days levers feature tests (#20619) Co-authored-by: Christopher Detlef <> * APPEALS-38903 Add Inactive Data Elements lever feature tests (#20621) Co-authored-by: Christopher Detlef <> * APPEALS-38555. Affinity Days jest test (#20633) Co-authored-by: SHarshain * Ricky/appeals-38557 (#20634) * Began work on DocketTimeGoal testing, updated toSorted to sort * Updated unit tests to improve coverage on DocketTimeGoals * Updated unit tests to begin working on testing toggleLever * rebuild PR (#20617) * rebuild PR * Update LeverHistory.jsx * Cleaned up DocketTimeGoals test --------- Co-authored-by: Matt Roth * APPEALS-38904 Add Feature Test for Audit Lever History (#20637) * Initial pass * APPEALS-38904 Add Feature Test for Audit Lever History --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * mbeard/APPEALS-38558 (#20630) * "initial commit, created test, updated wrapper" * "adds test cases for save and cancel buttons" * "updates revertLevers to resetLevers for clarity" * "removes problematic test case" --------- Co-authored-by: Matt Roth * APPEALS-38526. 100% test coverage for Case distribution test data seed (#20638) * APPEALS-38526. 100% test coverage for Case distribution test data seed * APPEALS-38526. Fix the typo * APPEALS-38526. Fix the typo in class and related spec --------- Co-authored-by: SHarshain * Ricky/appeals-38567 (#20642) * Updated caseDistributionApp test file and added additional test lever data * Updated test for CaseDistributionApp * Updated rootreducer test for full coverage (#20653) * APPEALS-38555. Added the test coverage to verify the text input (#20654) Co-authored-by: SHarshain * Update to audit lever history time entries to display leading 0s for hours, minutes, and seconds (#20652) * APPEALS-38558 amended test to cover the remaining thee lines of code (#20643) * APPEALS-38790 Add Lever Button feature tests (#20662) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-39284 (#20663) * "initial commit with updates controller, actions, reducer" * "updates leversActions error message" * "updates case dist levers controller spec" * "removes redundant line from update_levers method" * pull changes from hotfix branch (#20667) * APPEALS-38542 got rid of code that is not being used (#20673) * APPEALS-38542 got rid of code that is not being used * APPEALS-38542. Remove unused constant from actions list * APPEALS-38542. remove deadcode spec --------- Co-authored-by: SHarshain * APPEALS-38562./ Removes the unused component (#20697) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "Created jest for leversactions" (#20701) * Chrisbdetlef/appeals 38966 (#20700) * APPEALS-38966 Add dynamic * generation for lever labels/titles * Remove file * Refactor to use a single utility method --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * Ricky/appeals-38569 (#20681) * Pushed changes to LeversReducer Test * Updated unit tests for additional coverage * Pushed up changes to have eyes on async tests * Pulled in Amy's changes and moved data to adminCaseDistributionLevers * Updated test data naming for mocks and tests * Updated testing to fix issues and improve coverage * Updated unit tests, added comments on unfinished work * APPEALS-38569 updated the reducer to give the expected information in the jest tests --------- Co-authored-by: 631966 * mbeard/APPEALS-37794 (#20685) * APPEALS-37794 made changes to the shared number and text components so that we have more control over what the aria-label is * "Updates arialabeltext for batchsize, jests for batchsize and docket time goals" * "updates admin jest aria text query" --------- Co-authored-by: 631966 * revert changes that are causing the Unable to load banner to appear to quick (#20712) * APPEALS-32252 fixed a few rspec tests (#20738) * added the judge list all and attorney list all to help with caching issues * APPEALS-39893 CaseDistributionLever swap over to method_missing (#20744) * remove find_float and find_float, swap to method_missing * codeclimate updates * Update case_distribution_lever.rb * Update case_distribution_lever.rb * APPEALS-39660 Correct ACD Lever Seeds (#20747) Co-authored-by: Christopher Detlef <> * APPEALS-39889 CodeClimate issues (#20740) * move to story branch * Update .codeclimate.yml * pull in dev-support/APPEALS-39031 * Update case_distribution_lever.rb * Update .codeclimate.yml * disable DataClump for db seeds * lint fixes * Update affinity_days_levers_spec.rb * Update case_distribution_lever.rb * Update .codeclimate.yml * pull over other changes * Update case_distribution_lever.rb * Update case_distribution_lever.rb * fix codeclimate issues * fix more issues * rubocop auto fixes * Update test.jsx * mbeard/APPEALS-39895 (#20746) * "updates value in test method and adds new contexts" * "put everything back" * "updates seed value for Dockt weight" * "verifies seed data is correct" (#20754) * APPEALS-39897. Ambiguous id match removed from the component and matched the parent css element (#20745) * APPEALS-39897. Ambiguous id match removed from the component and matched to parent css element * APPEALS-39897. Refactored spec * APPEALS-39897. rubocop fixes * APPEALS-39897. Lint fix --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update leversActions.js (#20760) * APPEALS-39899. Spec fix (#20758) Co-authored-by: SHarshain * revert and move new code to correct file (#20766) * APPEALS-39889 Code Climate issues part 2 (#20759) * swap over to using USWDS colors * more rubocop fixes * add extra lines, remove spaces * Update affinity_days_levers_spec.rb * cleanup unit tests * Update audit_lever_history_table_spec.rb * Update inactive_data_elements_levers_spec.rb * Update _interactable_levers.scss * refactor duplicate code * Update _lever_history.scss * Update affinity_days_levers_spec.rb --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-39984 Update test to match css fix (#20768) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40085 Update ACD lever count (#20769) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40092. Fix negative rspec matcher (#20772) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "fixed spelling and updated spec to include two new users" (#20777) Co-authored-by: Matt Roth * mbeard/APPEALS-38563 (#20577) * "creates savemodal test by adding save button" * "updates and deleted and recreated file" * "latest update to mockstore" * "adds export to save button and updates test" * "current updaates to the test" * "Updates the confirm button to mock confirm button" * Updated testing data and SaveModal tests * "updates logic in utils and updates test" * "adds changedLevers constant mocked data and renders corrrectly" * "adds affinity days to test, and close modal" * "updates test data, adds new cases, adds ids to table" --------- Co-authored-by: 631068 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: 631966 * APPEALS-40134. Add missing traits in factories (#20789) Co-authored-by: SHarshain * APPEALS-40131. Fix case_distribution_levers seed spec (#20786) Co-authored-by: SHarshain * APPEALS-39980. Mock the value in the spec (#20784) Co-authored-by: SHarshain * "updates control group and rsec to never recieve tasks" (#20790) * Updated constants from by docket date to static docket date (#20796) * APPEALS-39892 Unit test fixes (#20798) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * merge issue * Update case_docket.rb (#20782) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * ricky/APPEALS-40090 (#20803) * APPEALS-39892 fixed one file for rubocop issues * Updated jest unit tests to fix issues * Updated leversReducer unit tests * Added export back to LeverSaveButton --------- Co-authored-by: 631966 * APPEALS-39892 Unit tests fixes (#20810) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update case_docket.rb * APPEALS-39987 updated failing snapshots (#20751) * Updated jest config to ignore test.jsx files (#20826) * APPEALS-40136 Bring test data back into range of displayed data (#20824) Co-authored-by: Christopher Detlef <> * Updated By Docket Date to Docket Date (#20827) * APPEALS-39899. docket_coordinator_spec fix (#20829) Co-authored-by: SHarshain * APPEALS-39980. Fix the timestamp failure in the spec (#20836) Co-authored-by: SHarshain * move to new feature branch (#20889) * move to new feature branch (#20890) * APPEALS-38967 Update Implementation of Affinity Days in Admin UI (#20656) * bring over fix for ordering * suggested change * Create 20240130152058_update_case_distribution_levers_is_toggle_active.rb * Update schema.rb * Updates to enable levers that are being tested and for null values in is_toggle_active for n/a levers * Update test.jsx * Update test.jsx * updates for Combination levers, missing updates to allow saving of them * Save combination levers * Update SaveModal.jsx * swap over to methods focused on updating a specific attribute of a lever * change radio to not have value in value * for radio levers set selectedOption when loading levers * Update case_distribution_lever.rb * Update AffinityDays.jsx * Update case_distribution_lever.rb * updates to account for is_toggle_active being nullable * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * fix validation error messages, Radio levers update redux store correctly * changing radio enables Save and displays in Save Modal correctly * fix max values to be 999 * Can save Radio levers successfully * history entries match frontend * Update AffinityDays.jsx * cleanup and comments * Update case_distribution_lever.rb * Update LeverHistory.jsx * Revert "Update LeverHistory.jsx" This reverts commit 6eca84730cac808e5d25b467d370dd21a34013d1. * APPEALS-26750 auto_texts was created as a part of master * Update case_distribution_lever.rb (#20946) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38967 Remove units showing when not needed (#20975) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: 631966 * APPEALS-38744 Update AMA Hearing Case Affinity Days Lever (#20956) * APPEALS-38744 added checks for ama hearing case affinity days lever * APPEALS-38744 refactored logic for ama hearing case affinity days lever * APPEALS-38744 update method name * APPEALS-41456 made changes to the affinity days test data and jest tests to conform to new data changes (#20991) * Tmr/appeals 38967 4 (#21034) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: Matthew Roth * Ricky/appeals-35179 (#20988) * "adds ama aod original appeals method to scopes" * "adds conditional to only_genpop_appeals" * "removes unnecessary copied code" * "adds comment" * "Updates to formatting for shovel methods" * "updates conditional to include correct function, changes scope chain" * "Updates and adds scope for infinite, test passes" * "adds infinite method to scopes" * "created new test scenarios" * "moves line up" * "updates distribution scope methods" * "updates methods" * "updates rspec to update attribute" * "updates def and values" * "updates rspec to new methods" --------- Co-authored-by: Michael Beard * APPEALS-38967 made sure that the lever history displays properly (#21041) * APPEALS-37024 Create Seeds For ACD Demo (#21038) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-38744 (#21039) * "init commit for updating not_genpop_appeals" * "adds new context and updates top ama" * "updates methods on scopes, adds new appeals, updates specs" * Updated logic and rspec tests * APPEALS-38744 rearranged the not_genpop_appeals to only run the not_genpop_appeals query once * APPEALS-38744 took out puts * APPEALS-38744 the queries work through binding.pry the tests are failing due to setup issues * APPEALS-38744 update with new pattern * APPEALS-38744 added a conditional to make affinity days chained correctly * APPEALS-38744 more fiddling * Fix code issues for query structures * Make returns uniformly arrays of arrays * flagged error * "updates hearing docket method to if else" * "fixes ish respecs adding with_no_held_hearings to the array" * "cleanup brush brush brush" --------- Co-authored-by: 631068 Co-authored-by: 631966 Co-authored-by: Christopher Detlef <> * APPEALS-42090 Add newly enabled levers to capybara test (#21117) Co-authored-by: Christopher Detlef <> * APPEALS-26750 updating the kepler feature with the combined branch so that there isn't 200 changed files * mbeard/APPEALS-42093 (#21114) * "updates jest to reflect code changes and updates selector logic" * "updates savemodal jest" * "Updates leversActions test, removes redundancies" * "Updates infinite, omit, and updated value tests" * APPEALS-42010 Rework affinity lever tests (#21079) * APPEALS-42010 fix rspecs * APPEALS-42010 update specs and address pr suggestions --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Ricky/appeals-42088 (#21126) * Updated seed data * Updated seed data for days_before_goal_due_for_distribution lever * Reworked solution and renamed lever to be correct * Updated tests (#21135) * Feature/appeals 26750 revert affinity (#21137) * APPEALS-26750 commenting out method that was failing in seeds * APPEALS-26750 added logic for unique veteran too * APPEALS-26750 updating the seeds to get the params properly * APPEALS-26750 enabled the call to create_case_ready_for_more_than_hearing_affinity_days(judge) * increase the number of digits in the css_id sequence (#21139) * increase the number of digits in the css_id sequence * modify generated CSS_IDs and sequence to shorten to 12 characters * ensures that the veteran id is unique, even though it always ought to be unique (#21143) --------- Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: 631068 Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> Co-authored-by: Matt Roth Co-authored-by: Alexander Smith Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: Michael Beard Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> * Feature/appeals 26750 kepler (#21156) * placeholder files exist (#19734) * placeholder files exist * APPEALS-32385 the lever component should be singular * APPEALS-32385 fixed plurality in the content file * adds admin_case_distribution to features_config (#19745) * fix the json syntax error (#19781) Co-authored-by: SHarshain * Added a basic reducer for the Levers (#19790) - Allow intial state to be passed into the Lever Reducer - Add generator to Lever Reducer - Add functions for Lever Reducer - Fix test data array Co-authored-by: Christopher Detlef <> * ricky/APPEALS-32386 - Lever History (#19793) * Created LeverHistory Component and updated test data * Fixed name and title, resubmitted styling and testing --------- Co-authored-by: 631966 * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history --------- Co-authored-by: 631966 * Amycommits/appeals 37248 (#20310) * fixed linting errors * APPEALS-37248 progress on the lint errors * APPEALS-37248 took out custom lint fix command * mbeard/APPEALS-36896 (#20293) * updates reducer, modal, actiontypes, index * fixes words and ads asterisks * removes one asterisk * fixes margin * updates scss padding --------- Co-authored-by: 631966 * Ricky/appeals-34350-Error-and-Validation-Handling (#20288) * Updated LeverModal button and reducer to fix error handling * Implemented new error handling in DocketTimeGoals and BatchSize Lever groups * Updated error handling for lever inputs for affinity days * Fixed incorrect check and messages in CheckIsInRange function * Added first part of input validation for duplicate values * Removed leftover code * Updated logic to handle save button enabling if duplicate values are put in fields --------- Co-authored-by: 631966 * Ricky/appeals-34224 (#20316) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631966 * mbeard/APPEALS-36175 (#20285) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * adds url to controller * updates erb files * updates controller * APPEALS-36175 took out extraneous code in the lever modal * updates controller dropdowm menu --------- Co-authored-by: 631966 * Amycommits/appeals 37286 (#20322) * Ricky/appeals 34224 (#20321) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631068 * reverted changes to the caseflow distribution content page that were causing an error * reverted changes to the caseflow distribution content page that were causing an error --------- Co-authored-by: 631068 * APPEALS-36334 Seed Data for ACD Lever Testing (#20317) * APPEALS-36334 Seed Data for ACD Lever Testing * For testing * Re-add lever test seed data --------- Co-authored-by: Christopher Detlef <> * APPEALS-37279 reverted code changes based on feedback (#20318) * APPEALS-37279 reverted code changes based on feedback * APPEALS-37279. revert the api_status_alert lever item --------- Co-authored-by: SHarshain * APPEALS-34623. Created DB table and logged the data to acd-controls t… (#20193) * APPEALS-34623. Created DB table and logged the data to acd-controls test page * APPEALS-34623. Added model associations and spec * sharsha/APPEALS-34623. revert changes in schema to match the feature branch --------- Co-authored-by: SHarshain * APPEALS-37314 fixes X functionality (#20339) * APPEALS-37227. Sort the levers (#20319) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-37290. Refactor (#20340) * APPEALS-37290. Refactor * APPEALS-37290. Updated the integer and float levers and some refactor --------- Co-authored-by: SHarshain Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-36550 Queries for User Testing (#20311) * APPEALS-36550 set up the link so that a query can be downloaded as a CSV on the test page * APPEALS-36550 built out the link with the appropriate routes, and started the appeals ready for distribution query * Add dashboard to test/users Miscellaneous tab * Add navigation links * Update test.html.erb * get appeals ready for distribution for each docket * extract works * Update appeals_ready_for_distribution.rb * legacy appeals ready to distribute done * Update appeals_ready_for_distribution.rb * all ama distributed appeals * distributed legacy appeals * comments --------- Co-authored-by: 631966 * APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373) Co-authored-by: SHarshain Co-authored-by: Matt Roth * APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374) Co-authored-by: SHarshain * added lever_group column and updated seeds files (#20379) * mbeard/APPEALS-37248 (#20364) * corrects scss linting issues * updates scss linting issues * fixes linting issues in scss * fixes almost all linting issues * fixes furhter linting issues * updates linter styling issues * updates leverhistory linting issues * fixes scss linting issues * fixes disappearing save button * "updates styling for linting issues" * "updates styling and fixes leverhistory" * "final edits to styling" * "final final" * adds utiljs and imports function * "updates dockettimegoals" * renaming scss * fixes style issues * "fixes app/styles" --------- Co-authored-by: Matt Roth * Tmr/appeals 32252 refactor (#20376) * remove redundant checks and move url addition to within existing checks * Update case_distribution_levers_controller.rb * linting fixes * Update push_priority_appeals_to_judges_job.rb * Update push_priority_appeals_to_judges_job_spec.rb * Remove CaseDistributionAlgorithmLog * rubocop * Update routes.rb * Update seeds.rb * Update docket_coordinator_spec.rb * Update schema.rb * fix typos * Update application_controller.rb * move unit tests to client/test/ to match project standards * remove storybook files * revert unrelated changes to schema * Delete ToggleSwitch.stories.js * mbeard/APPEALS-36896 (#20391) * "fixes copy" * "updates COPY titles" * "TYPO" * APPEALS-36381 Replace ACD Lever variables with constants (#20398) Co-authored-by: Christopher Detlef <> * APPEALS-37582: Refactor: Audit table cleanup (#20403) * cleanup audit table * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * remove old fields * Update 20240103134452_update_case_distribution_audit_lever_entry.rb * add seed data * prop type validations * Adjust history rendering to account for new database table setup * unit test and remove console logs * update serializer to pass along lever fields for audit entries * Hun jer bah/appeals 32252 redux refactor (#20365) * created root reducer and refactored actions list * swapped Contants for ACTIONS * created place holder lever actions * created proof of concept action for redux store. * fixed action * fixed naming convention * created action to update affinity days * Fix Misc. Controller Linting Issues * created test route to load lever info in full * set up loadLever action to pull add data from new temp controller route * added lever grouping to controller * passed down organized levers to child components * rolled back schema before merging feature in * fixed merge conflict * Update application_controller.rb * cleaned up code for handoff to Kepler team * removed leftover comment * removed ApiUtil method of passing values and used index.html.erb * set up BatchSize to use hooks from store * cleaned up BatchSize props * updated docket time goals and affininty days (pass values to affinity day levers only) * Fix Misc. Issues - Fix levers not loading in BatchSize by moving loading logic to parent component constructor vs. running on component mount. - Fix DB migration issue with not-null column lacking a default. * Remove merge markers * cleaned up old use effects * Update case_distribution_levers_controller.rb * remove loadLevers from PropTypes * add initial state of levers to new store * Update InteractableLeversWrapper.jsx * update to use new store and refactor work * remove passing around of loadedLevers * Update BatchSize.jsx * cleanup --------- Co-authored-by: Alexander Smith Co-authored-by: Matthew Roth * APPEALS-37505: Create Case Distro Algorithm Control users in Demo (#20401) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * revert changes unrelated to work * Update case_distribution_levers_controller_spec.rb * APPEALS-37554 Refactor: Redux Load Levers: Fixes (#20422) * rename folder * rename folder * rename redux properties * fix dashboard * Rename from CaseflowDistribution to CaseDistribution (#20428) * move from caseflowDistribution to caseDistribution * update import statements * rename page * cleanup text strings * remaining instances of CaseflowDistribution * rename reducers/Levers to reducers/levers * pull updates in * rename Levers to levers * bad or missing imports * cleanup unused variable and imports * Update users.rb * Update users.rb * APPEALS-37582 Test Data page swap to css_id for Audit Entries table (#20436) * Update test.html.erb * rename files to match their functional components * Amycommits/appeals 37719 (#20444) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37719 fixed some of the linting and typos * APPEALS-37720 changed the variables in the reducer (#20445) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * Amycommits/appeals 37719.appeals 37720.appeals 37692 (#20446) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37692 fixed linting error * PPEALS-37692 merged the feature branch back in * Serializer was named incorrectly, renaming to match class and database table name (#20451) * Fix mispelled file name * fixed linting errors and warnings * APPEALS-37558 restructured the levers to store the backend lever valu… (#20447) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37558 restructured the levers to store the backend lever value and keep tabs of the actual value change. * mbeard/APPEALS-37526 (#20453) * "updates COPY and fixes some linting issues" * "updates COPY and moves sectiontitles to constantsjs" * "removes linting changes from reducer" * Amycommits/appeals 37767 (#20465) * APPEALS-37767 initial load works * APPEALS-37767 refactored how the admin permissions are stored * APPEALS-37767 updated exclusion table to use admin variable from redux * APPEALS-37767 cleaned up the usage of isAdmin * APPEALS-37767 fixed some linting issues * APPEALS-37767 removed the sectionTitle from the content page * APPEALS-37558 Refactor: Redux Confirm Save (#20452) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * Update case_distribution_audit_lever_entry_serializer_spec.rb * Update case_distribution_levers_controller.rb * rename route and method to update_levers * move lever updating logic into the model * priority distributions comment and affinity days case generation * Create case_distribution_lever_spec.rb * Update case_distribution_levers_controller.rb * Update case_distribution_levers_controller_spec.rb * move data_types constants into an object in ACD_LEVERS * Update case_distribution_lever.rb * Add validation for data_types * case_distribution_lever_spec * linter errors * remove passing around sectionTitles * move algorithm and lever_group strings into ACD_LEVERS * Update DocketTimeGoals.jsx * Update LeverSaveButton.jsx * Update leversSelector.js * create new actions * create individual actions for each data type * use new action in DocketTImeGoals * create SaveModal file * clean up around the different data type updates * show changed levers * show changed levers * Save works and success banner displays * cleanup and account for multiple levers being changed * error banner display * batch size saves * clean up Affinity Days and ensure order * Ensure BatchSize order * Fix DocketTimeGoals ordering * clear errors out when hiding banner * more cleanup * props cleanup * clean up from feature branch merge * linting errors * APPEALS-37558: Refactor: Redux Confirm Save (#20490) * Update ExclusionTable.jsx * update levers after save * update history and audit table to show css_id * Update leversReducer.js * APPEALS-37558 (#20498) * Fix error banner not displaying * Update case_distribution_levers_controller.rb * mbeard/APPEALS-37559 (#20494) * "updates lever cancel function" * "final updates to cancel button, updates controller" * "updated routes, method, and function" * "Unit test for cancel button" * "removed comments from test" * Amycommits/appeals 37508 (#20503) * APPEALS-37508 validation works * APPEALS-37508 added a check for lever errors to the save button. * APPEALS-37508 cleaned up some of the validation functions * github test (#20491) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers --------- Co-authored-by: Christopher Detlef <> * Chrisbdetlef/appeals 37692 (#20512) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers * Add constants and custom html for capybara tests --------- Co-authored-by: Christopher Detlef <> * APPEALS-37558 Fix issues found during QA testing (#20511) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * APPEALS-37558 Prevent bad audit entries (#20522) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * prevent invalid lever changes from getting audit entries * Update case_distribution_lever_spec.rb * APPEALS-37508 redoing the seeds (#20531) * Sharsha/appeals 37511 2 (#20521) * APPEALS-37511. ExclusionTable scss refactor * APPEALS-37511. Static levers scss refactor * APPEALS-37511. Lever History refactor scss * sharsha/APPEALS-37511. linting fixes * APPEALS-37511. Refactor Interactable Levers scss * APPEALS-37511. fix cancel and save button styling * APPEALS-37511. fixes * APPEALS-37511. Lint fixes * APPEALS-37511. updated the mock to use the updated scss files * APPEALS-37511. LeverButtonsWrapper css cleanup * APPEALS-37511. Exclusion table header styling --------- Co-authored-by: SHarshain * Demo VLJ and AVLJ users updates (#20540) * and _AVLJ to AVLJ names * Update case_distribution_test_data.rb * APPEALS-38398 Disabled levers are still showing focus on Admin UI (#20559) * disable tabbing to disable inputs * clean up ToggleSwitch css * Update _toggle_switch.scss * move import * Update _toggle_switch.scss * Update ToggleSwitch.jsx * Update _toggle_switch.scss * test that props are being passed in correctly * Ricky/appeals-37871 (#20534) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data --------- Co-authored-by: Matt Roth * add disabled to other NumberFields (#20564) * mbeard/APPEALS-38541 (#20553) * "makes too_many_cases error dynamic" * "updates controller method to be dynamic" * sharsha/APPEALS-37511_3. Added 30px right padding for table header (#20562) Co-authored-by: SHarshain * APPEALS-37525 Refactor ACD Levers Test Page (#20535) * APPEALS-37525 Refactor ACD Levers Test Page * Change Test Page to React component * Use lever history serializer in controller * Add all current attributes to the Lever Table * Add more attributes to Lever History Table * Update links from ruby to React * APPEALS-37525 moved the lever_history to the model because it's being… (#20538) * APPEALS-37525 moved the lever_history to the model because it's being used in multiple places * APPEALS-37525 changed the options to only display values * Fix unit test --------- Co-authored-by: Christopher Detlef <> * Fix Option Values column * DRY out the history unit test --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-37794 (#20532) * "updates copy issue and radiofield" * "updates accessibility labels" * "attempt to update label" * "updates accessibility vioce over" * "moves logic from radiofield to exclusiontable" * "Updated fixes from comments" * "removes last thing from TextField component" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-37832. Test data seed spec for case distribution (#20561) * APPEALS-37832. Test data seed spec for case distribution * APPEALS-37832. more changes * APPEALS-37832. Added CaseDistributionlevers count --------- Co-authored-by: SHarshain * Ricky/appeals-37556 (#20502) * Updated LeverHistory component, formatting and storage in redux * Updated Jest testing for LeverHistory * Code cleanup and address comments. Reverted save_levers changes * Feature test outline and class names added * Updated feature tests * Fixed linting error with SaveModal * Updated testing for LeverHistory and fixed css id from showing * Created individual lever history action, updated reducer, updated testing * Removed unneeded data in jest test * Cleaned up formatTimestamp function --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-38556 (#20574) * Initial testing for BatchSize and lever data for testing. * Updated BatchSize Testing and additional testing data. * Updated tests to get full testing coverage * APPEALS-37508 resetting the errors when the cancel button is clicked (#20589) * APPEALS-37511. Fix exclusion table member view (#20595) Co-authored-by: SHarshain * Ricky/appeals-37871 (#20596) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data * Updated spacing between value and unit for static lever, updated testing * Updated static lever to separate value and unit using css --------- Co-authored-by: Matt Roth * APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613) Co-authored-by: SHarshain * APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614) Co-authored-by: SHarshain * APPEALS-38570. Improve the test coverage (#20584) * APPEALS-38570. Improve the test coverage * APPEALS-38570. Dead code cleanup * APPEALS-38570. test coverage to address the exception --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38764 Add Batch Size Lever feautre tests (#20618) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-38561 (#20622) * "initial commit, adds test and save button export" * "adds leversavebutton unit test" * APPEALS-38789 Added error message validation to feature test for Docket Goals (#20625) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * fix merge conflict error * APPEALS-38787 Add Affinity Days levers feature tests (#20619) Co-authored-by: Christopher Detlef <> * APPEALS-38903 Add Inactive Data Elements lever feature tests (#20621) Co-authored-by: Christopher Detlef <> * APPEALS-38555. Affinity Days jest test (#20633) Co-authored-by: SHarshain * Ricky/appeals-38557 (#20634) * Began work on DocketTimeGoal testing, updated toSorted to sort * Updated unit tests to improve coverage on DocketTimeGoals * Updated unit tests to begin working on testing toggleLever * rebuild PR (#20617) * rebuild PR * Update LeverHistory.jsx * Cleaned up DocketTimeGoals test --------- Co-authored-by: Matt Roth * APPEALS-38904 Add Feature Test for Audit Lever History (#20637) * Initial pass * APPEALS-38904 Add Feature Test for Audit Lever History --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * mbeard/APPEALS-38558 (#20630) * "initial commit, created test, updated wrapper" * "adds test cases for save and cancel buttons" * "updates revertLevers to resetLevers for clarity" * "removes problematic test case" --------- Co-authored-by: Matt Roth * APPEALS-38526. 100% test coverage for Case distribution test data seed (#20638) * APPEALS-38526. 100% test coverage for Case distribution test data seed * APPEALS-38526. Fix the typo * APPEALS-38526. Fix the typo in class and related spec --------- Co-authored-by: SHarshain * Ricky/appeals-38567 (#20642) * Updated caseDistributionApp test file and added additional test lever data * Updated test for CaseDistributionApp * Updated rootreducer test for full coverage (#20653) * APPEALS-38555. Added the test coverage to verify the text input (#20654) Co-authored-by: SHarshain * Update to audit lever history time entries to display leading 0s for hours, minutes, and seconds (#20652) * APPEALS-38558 amended test to cover the remaining thee lines of code (#20643) * APPEALS-38790 Add Lever Button feature tests (#20662) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-39284 (#20663) * "initial commit with updates controller, actions, reducer" * "updates leversActions error message" * "updates case dist levers controller spec" * "removes redundant line from update_levers method" * pull changes from hotfix branch (#20667) * APPEALS-38542 got rid of code that is not being used (#20673) * APPEALS-38542 got rid of code that is not being used * APPEALS-38542. Remove unused constant from actions list * APPEALS-38542. remove deadcode spec --------- Co-authored-by: SHarshain * APPEALS-38562./ Removes the unused component (#20697) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "Created jest for leversactions" (#20701) * Chrisbdetlef/appeals 38966 (#20700) * APPEALS-38966 Add dynamic * generation for lever labels/titles * Remove file * Refactor to use a single utility method --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * Ricky/appeals-38569 (#20681) * Pushed changes to LeversReducer Test * Updated unit tests for additional coverage * Pushed up changes to have eyes on async tests * Pulled in Amy's changes and moved data to adminCaseDistributionLevers * Updated test data naming for mocks and tests * Updated testing to fix issues and improve coverage * Updated unit tests, added comments on unfinished work * APPEALS-38569 updated the reducer to give the expected information in the jest tests --------- Co-authored-by: 631966 * mbeard/APPEALS-37794 (#20685) * APPEALS-37794 made changes to the shared number and text components so that we have more control over what the aria-label is * "Updates arialabeltext for batchsize, jests for batchsize and docket time goals" * "updates admin jest aria text query" --------- Co-authored-by: 631966 * revert changes that are causing the Unable to load banner to appear to quick (#20712) * APPEALS-32252 fixed a few rspec tests (#20738) * added the judge list all and attorney list all to help with caching issues * APPEALS-39893 CaseDistributionLever swap over to method_missing (#20744) * remove find_float and find_float, swap to method_missing * codeclimate updates * Update case_distribution_lever.rb * Update case_distribution_lever.rb * APPEALS-39660 Correct ACD Lever Seeds (#20747) Co-authored-by: Christopher Detlef <> * APPEALS-39889 CodeClimate issues (#20740) * move to story branch * Update .codeclimate.yml * pull in dev-support/APPEALS-39031 * Update case_distribution_lever.rb * Update .codeclimate.yml * disable DataClump for db seeds * lint fixes * Update affinity_days_levers_spec.rb * Update case_distribution_lever.rb * Update .codeclimate.yml * pull over other changes * Update case_distribution_lever.rb * Update case_distribution_lever.rb * fix codeclimate issues * fix more issues * rubocop auto fixes * Update test.jsx * mbeard/APPEALS-39895 (#20746) * "updates value in test method and adds new contexts" * "put everything back" * "updates seed value for Dockt weight" * "verifies seed data is correct" (#20754) * APPEALS-39897. Ambiguous id match removed from the component and matched the parent css element (#20745) * APPEALS-39897. Ambiguous id match removed from the component and matched to parent css element * APPEALS-39897. Refactored spec * APPEALS-39897. rubocop fixes * APPEALS-39897. Lint fix --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update leversActions.js (#20760) * APPEALS-39899. Spec fix (#20758) Co-authored-by: SHarshain * revert and move new code to correct file (#20766) * APPEALS-39889 Code Climate issues part 2 (#20759) * swap over to using USWDS colors * more rubocop fixes * add extra lines, remove spaces * Update affinity_days_levers_spec.rb * cleanup unit tests * Update audit_lever_history_table_spec.rb * Update inactive_data_elements_levers_spec.rb * Update _interactable_levers.scss * refactor duplicate code * Update _lever_history.scss * Update affinity_days_levers_spec.rb --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-39984 Update test to match css fix (#20768) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40085 Update ACD lever count (#20769) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40092. Fix negative rspec matcher (#20772) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "fixed spelling and updated spec to include two new users" (#20777) Co-authored-by: Matt Roth * mbeard/APPEALS-38563 (#20577) * "creates savemodal test by adding save button" * "updates and deleted and recreated file" * "latest update to mockstore" * "adds export to save button and updates test" * "current updaates to the test" * "Updates the confirm button to mock confirm button" * Updated testing data and SaveModal tests * "updates logic in utils and updates test" * "adds changedLevers constant mocked data and renders corrrectly" * "adds affinity days to test, and close modal" * "updates test data, adds new cases, adds ids to table" --------- Co-authored-by: 631068 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: 631966 * APPEALS-40134. Add missing traits in factories (#20789) Co-authored-by: SHarshain * APPEALS-40131. Fix case_distribution_levers seed spec (#20786) Co-authored-by: SHarshain * APPEALS-39980. Mock the value in the spec (#20784) Co-authored-by: SHarshain * "updates control group and rsec to never recieve tasks" (#20790) * Updated constants from by docket date to static docket date (#20796) * APPEALS-39892 Unit test fixes (#20798) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * merge issue * Update case_docket.rb (#20782) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * ricky/APPEALS-40090 (#20803) * APPEALS-39892 fixed one file for rubocop issues * Updated jest unit tests to fix issues * Updated leversReducer unit tests * Added export back to LeverSaveButton --------- Co-authored-by: 631966 * APPEALS-39892 Unit tests fixes (#20810) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update case_docket.rb * APPEALS-39987 updated failing snapshots (#20751) * Updated jest config to ignore test.jsx files (#20826) * APPEALS-40136 Bring test data back into range of displayed data (#20824) Co-authored-by: Christopher Detlef <> * Updated By Docket Date to Docket Date (#20827) * APPEALS-39899. docket_coordinator_spec fix (#20829) Co-authored-by: SHarshain * APPEALS-39980. Fix the timestamp failure in the spec (#20836) Co-authored-by: SHarshain * move to new feature branch (#20889) * move to new feature branch (#20890) * APPEALS-38967 Update Implementation of Affinity Days in Admin UI (#20656) * bring over fix for ordering * suggested change * Create 20240130152058_update_case_distribution_levers_is_toggle_active.rb * Update schema.rb * Updates to enable levers that are being tested and for null values in is_toggle_active for n/a levers * Update test.jsx * Update test.jsx * updates for Combination levers, missing updates to allow saving of them * Save combination levers * Update SaveModal.jsx * swap over to methods focused on updating a specific attribute of a lever * change radio to not have value in value * for radio levers set selectedOption when loading levers * Update case_distribution_lever.rb * Update AffinityDays.jsx * Update case_distribution_lever.rb * updates to account for is_toggle_active being nullable * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * fix validation error messages, Radio levers update redux store correctly * changing radio enables Save and displays in Save Modal correctly * fix max values to be 999 * Can save Radio levers successfully * history entries match frontend * Update AffinityDays.jsx * cleanup and comments * Update case_distribution_lever.rb * Update LeverHistory.jsx * Revert "Update LeverHistory.jsx" This reverts commit 6eca84730cac808e5d25b467d370dd21a34013d1. * APPEALS-26750 auto_texts was created as a part of master * Update case_distribution_lever.rb (#20946) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38967 Remove units showing when not needed (#20975) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: 631966 * APPEALS-38744 Update AMA Hearing Case Affinity Days Lever (#20956) * APPEALS-38744 added checks for ama hearing case affinity days lever * APPEALS-38744 refactored logic for ama hearing case affinity days lever * APPEALS-38744 update method name * APPEALS-41456 made changes to the affinity days test data and jest tests to conform to new data changes (#20991) * Tmr/appeals 38967 4 (#21034) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: Matthew Roth * Ricky/appeals-35179 (#20988) * "adds ama aod original appeals method to scopes" * "adds conditional to only_genpop_appeals" * "removes unnecessary copied code" * "adds comment" * "Updates to formatting for shovel methods" * "updates conditional to include correct function, changes scope chain" * "Updates and adds scope for infinite, test passes" * "adds infinite method to scopes" * "created new test scenarios" * "moves line up" * "updates distribution scope methods" * "updates methods" * "updates rspec to update attribute" * "updates def and values" * "updates rspec to new methods" --------- Co-authored-by: Michael Beard * APPEALS-38967 made sure that the lever history displays properly (#21041) * APPEALS-37024 Create Seeds For ACD Demo (#21038) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-38744 (#21039) * "init commit for updating not_genpop_appeals" * "adds new context and updates top ama" * "updates methods on scopes, adds new appeals, updates specs" * Updated logic and rspec tests * APPEALS-38744 rearranged the not_genpop_appeals to only run the not_genpop_appeals query once * APPEALS-38744 took out puts * APPEALS-38744 the queries work through binding.pry the tests are failing due to setup issues * APPEALS-38744 update with new pattern * APPEALS-38744 added a conditional to make affinity days chained correctly * APPEALS-38744 more fiddling * Fix code issues for query structures * Make returns uniformly arrays of arrays * flagged error * "updates hearing docket method to if else" * "fixes ish respecs adding with_no_held_hearings to the array" * "cleanup brush brush brush" --------- Co-authored-by: 631068 Co-authored-by: 631966 Co-authored-by: Christopher Detlef <> * APPEALS-42090 Add newly enabled levers to capybara test (#21117) Co-authored-by: Christopher Detlef <> * APPEALS-26750 updating the kepler feature with the combined branch so that there isn't 200 changed files * mbeard/APPEALS-42093 (#21114) * "updates jest to reflect code changes and updates selector logic" * "updates savemodal jest" * "Updates leversActions test, removes redundancies" * "Updates infinite, omit, and updated value tests" * APPEALS-42010 Rework affinity lever tests (#21079) * APPEALS-42010 fix rspecs * APPEALS-42010 update specs and address pr suggestions --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Ricky/appeals-42088 (#21126) * Updated seed data * Updated seed data for days_before_goal_due_for_distribution lever * Reworked solution and renamed lever to be correct * Updated tests (#21135) * Feature/appeals 26750 revert affinity (#21137) * APPEALS-26750 commenting out method that was failing in seeds * APPEALS-26750 added logic for unique veteran too * APPEALS-26750 updating the seeds to get the params properly * APPEALS-26750 enabled the call to create_case_ready_for_more_than_hearing_affinity_days(judge) * increase the number of digits in the css_id sequence (#21139) * increase the number of digits in the css_id sequence * modify generated CSS_IDs and sequence to shorten to 12 characters * ensures that the veteran id is unique, even though it always ought to be unique (#21143) * Fixed errors caused by rounding issues in rspec (#21148) --------- Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: 631068 Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> Co-authored-by: Matt Roth Co-authored-by: Alexander Smith Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: Michael Beard Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> * Fixed Seed Data (#21161) * placeholder files exist (#19734) * placeholder files exist * APPEALS-32385 the lever component should be singular * APPEALS-32385 fixed plurality in the content file * adds admin_case_distribution to features_config (#19745) * fix the json syntax error (#19781) Co-authored-by: SHarshain * Added a basic reducer for the Levers (#19790) - Allow intial state to be passed into the Lever Reducer - Add generator to Lever Reducer - Add functions for Lever Reducer - Fix test data array Co-authored-by: Christopher Detlef <> * ricky/APPEALS-32386 - Lever History (#19793) * Created LeverHistory Component and updated test data * Fixed name and title, resubmitted styling and testing --------- Co-authored-by: 631966 * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history --------- Co-authored-by: 631966 * Amycommits/appeals 37248 (#20310) * fixed linting errors * APPEALS-37248 progress on the lint errors * APPEALS-37248 took out custom lint fix command * mbeard/APPEALS-36896 (#20293) * updates reducer, modal, actiontypes, index * fixes words and ads asterisks * removes one asterisk * fixes margin * updates scss padding --------- Co-authored-by: 631966 * Ricky/appeals-34350-Error-and-Validation-Handling (#20288) * Updated LeverModal button and reducer to fix error handling * Implemented new error handling in DocketTimeGoals and BatchSize Lever groups * Updated error handling for lever inputs for affinity days * Fixed incorrect check and messages in CheckIsInRange function * Added first part of input validation for duplicate values * Removed leftover code * Updated logic to handle save button enabling if duplicate values are put in fields --------- Co-authored-by: 631966 * Ricky/appeals-34224 (#20316) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631966 * mbeard/APPEALS-36175 (#20285) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * adds url to controller * updates erb files * updates controller * APPEALS-36175 took out extraneous code in the lever modal * updates controller dropdowm menu --------- Co-authored-by: 631966 * Amycommits/appeals 37286 (#20322) * Ricky/appeals 34224 (#20321) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631068 * reverted changes to the caseflow distribution content page that were causing an error * reverted changes to the caseflow distribution content page that were causing an error --------- Co-authored-by: 631068 * APPEALS-36334 Seed Data for ACD Lever Testing (#20317) * APPEALS-36334 Seed Data for ACD Lever Testing * For testing * Re-add lever test seed data --------- Co-authored-by: Christopher Detlef <> * APPEALS-37279 reverted code changes based on feedback (#20318) * APPEALS-37279 reverted code changes based on feedback * APPEALS-37279. revert the api_status_alert lever item --------- Co-authored-by: SHarshain * APPEALS-34623. Created DB table and logged the data to acd-controls t… (#20193) * APPEALS-34623. Created DB table and logged the data to acd-controls test page * APPEALS-34623. Added model associations and spec * sharsha/APPEALS-34623. revert changes in schema to match the feature branch --------- Co-authored-by: SHarshain * APPEALS-37314 fixes X functionality (#20339) * APPEALS-37227. Sort the levers (#20319) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-37290. Refactor (#20340) * APPEALS-37290. Refactor * APPEALS-37290. Updated the integer and float levers and some refactor --------- Co-authored-by: SHarshain Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-36550 Queries for User Testing (#20311) * APPEALS-36550 set up the link so that a query can be downloaded as a CSV on the test page * APPEALS-36550 built out the link with the appropriate routes, and started the appeals ready for distribution query * Add dashboard to test/users Miscellaneous tab * Add navigation links * Update test.html.erb * get appeals ready for distribution for each docket * extract works * Update appeals_ready_for_distribution.rb * legacy appeals ready to distribute done * Update appeals_ready_for_distribution.rb * all ama distributed appeals * distributed legacy appeals * comments --------- Co-authored-by: 631966 * APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373) Co-authored-by: SHarshain Co-authored-by: Matt Roth * APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374) Co-authored-by: SHarshain * added lever_group column and updated seeds files (#20379) * mbeard/APPEALS-37248 (#20364) * corrects scss linting issues * updates scss linting issues * fixes linting issues in scss * fixes almost all linting issues * fixes furhter linting issues * updates linter styling issues * updates leverhistory linting issues * fixes scss linting issues * fixes disappearing save button * "updates styling for linting issues" * "updates styling and fixes leverhistory" * "final edits to styling" * "final final" * adds utiljs and imports function * "updates dockettimegoals" * renaming scss * fixes style issues * "fixes app/styles" --------- Co-authored-by: Matt Roth * Tmr/appeals 32252 refactor (#20376) * remove redundant checks and move url addition to within existing checks * Update case_distribution_levers_controller.rb * linting fixes * Update push_priority_appeals_to_judges_job.rb * Update push_priority_appeals_to_judges_job_spec.rb * Remove CaseDistributionAlgorithmLog * rubocop * Update routes.rb * Update seeds.rb * Update docket_coordinator_spec.rb * Update schema.rb * fix typos * Update application_controller.rb * move unit tests to client/test/ to match project standards * remove storybook files * revert unrelated changes to schema * Delete ToggleSwitch.stories.js * mbeard/APPEALS-36896 (#20391) * "fixes copy" * "updates COPY titles" * "TYPO" * APPEALS-36381 Replace ACD Lever variables with constants (#20398) Co-authored-by: Christopher Detlef <> * APPEALS-37582: Refactor: Audit table cleanup (#20403) * cleanup audit table * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * remove old fields * Update 20240103134452_update_case_distribution_audit_lever_entry.rb * add seed data * prop type validations * Adjust history rendering to account for new database table setup * unit test and remove console logs * update serializer to pass along lever fields for audit entries * Hun jer bah/appeals 32252 redux refactor (#20365) * created root reducer and refactored actions list * swapped Contants for ACTIONS * created place holder lever actions * created proof of concept action for redux store. * fixed action * fixed naming convention * created action to update affinity days * Fix Misc. Controller Linting Issues * created test route to load lever info in full * set up loadLever action to pull add data from new temp controller route * added lever grouping to controller * passed down organized levers to child components * rolled back schema before merging feature in * fixed merge conflict * Update application_controller.rb * cleaned up code for handoff to Kepler team * removed leftover comment * removed ApiUtil method of passing values and used index.html.erb * set up BatchSize to use hooks from store * cleaned up BatchSize props * updated docket time goals and affininty days (pass values to affinity day levers only) * Fix Misc. Issues - Fix levers not loading in BatchSize by moving loading logic to parent component constructor vs. running on component mount. - Fix DB migration issue with not-null column lacking a default. * Remove merge markers * cleaned up old use effects * Update case_distribution_levers_controller.rb * remove loadLevers from PropTypes * add initial state of levers to new store * Update InteractableLeversWrapper.jsx * update to use new store and refactor work * remove passing around of loadedLevers * Update BatchSize.jsx * cleanup --------- Co-authored-by: Alexander Smith Co-authored-by: Matthew Roth * APPEALS-37505: Create Case Distro Algorithm Control users in Demo (#20401) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * revert changes unrelated to work * Update case_distribution_levers_controller_spec.rb * APPEALS-37554 Refactor: Redux Load Levers: Fixes (#20422) * rename folder * rename folder * rename redux properties * fix dashboard * Rename from CaseflowDistribution to CaseDistribution (#20428) * move from caseflowDistribution to caseDistribution * update import statements * rename page * cleanup text strings * remaining instances of CaseflowDistribution * rename reducers/Levers to reducers/levers * pull updates in * rename Levers to levers * bad or missing imports * cleanup unused variable and imports * Update users.rb * Update users.rb * APPEALS-37582 Test Data page swap to css_id for Audit Entries table (#20436) * Update test.html.erb * rename files to match their functional components * Amycommits/appeals 37719 (#20444) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37719 fixed some of the linting and typos * APPEALS-37720 changed the variables in the reducer (#20445) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * Amycommits/appeals 37719.appeals 37720.appeals 37692 (#20446) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37692 fixed linting error * PPEALS-37692 merged the feature branch back in * Serializer was named incorrectly, renaming to match class and database table name (#20451) * Fix mispelled file name * fixed linting errors and warnings * APPEALS-37558 restructured the levers to store the backend lever valu… (#20447) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37558 restructured the levers to store the backend lever value and keep tabs of the actual value change. * mbeard/APPEALS-37526 (#20453) * "updates COPY and fixes some linting issues" * "updates COPY and moves sectiontitles to constantsjs" * "removes linting changes from reducer" * Amycommits/appeals 37767 (#20465) * APPEALS-37767 initial load works * APPEALS-37767 refactored how the admin permissions are stored * APPEALS-37767 updated exclusion table to use admin variable from redux * APPEALS-37767 cleaned up the usage of isAdmin * APPEALS-37767 fixed some linting issues * APPEALS-37767 removed the sectionTitle from the content page * APPEALS-37558 Refactor: Redux Confirm Save (#20452) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * Update case_distribution_audit_lever_entry_serializer_spec.rb * Update case_distribution_levers_controller.rb * rename route and method to update_levers * move lever updating logic into the model * priority distributions comment and affinity days case generation * Create case_distribution_lever_spec.rb * Update case_distribution_levers_controller.rb * Update case_distribution_levers_controller_spec.rb * move data_types constants into an object in ACD_LEVERS * Update case_distribution_lever.rb * Add validation for data_types * case_distribution_lever_spec * linter errors * remove passing around sectionTitles * move algorithm and lever_group strings into ACD_LEVERS * Update DocketTimeGoals.jsx * Update LeverSaveButton.jsx * Update leversSelector.js * create new actions * create individual actions for each data type * use new action in DocketTImeGoals * create SaveModal file * clean up around the different data type updates * show changed levers * show changed levers * Save works and success banner displays * cleanup and account for multiple levers being changed * error banner display * batch size saves * clean up Affinity Days and ensure order * Ensure BatchSize order * Fix DocketTimeGoals ordering * clear errors out when hiding banner * more cleanup * props cleanup * clean up from feature branch merge * linting errors * APPEALS-37558: Refactor: Redux Confirm Save (#20490) * Update ExclusionTable.jsx * update levers after save * update history and audit table to show css_id * Update leversReducer.js * APPEALS-37558 (#20498) * Fix error banner not displaying * Update case_distribution_levers_controller.rb * mbeard/APPEALS-37559 (#20494) * "updates lever cancel function" * "final updates to cancel button, updates controller" * "updated routes, method, and function" * "Unit test for cancel button" * "removed comments from test" * Amycommits/appeals 37508 (#20503) * APPEALS-37508 validation works * APPEALS-37508 added a check for lever errors to the save button. * APPEALS-37508 cleaned up some of the validation functions * github test (#20491) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers --------- Co-authored-by: Christopher Detlef <> * Chrisbdetlef/appeals 37692 (#20512) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers * Add constants and custom html for capybara tests --------- Co-authored-by: Christopher Detlef <> * APPEALS-37558 Fix issues found during QA testing (#20511) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * APPEALS-37558 Prevent bad audit entries (#20522) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * prevent invalid lever changes from getting audit entries * Update case_distribution_lever_spec.rb * APPEALS-37508 redoing the seeds (#20531) * Sharsha/appeals 37511 2 (#20521) * APPEALS-37511. ExclusionTable scss refactor * APPEALS-37511. Static levers scss refactor * APPEALS-37511. Lever History refactor scss * sharsha/APPEALS-37511. linting fixes * APPEALS-37511. Refactor Interactable Levers scss * APPEALS-37511. fix cancel and save button styling * APPEALS-37511. fixes * APPEALS-37511. Lint fixes * APPEALS-37511. updated the mock to use the updated scss files * APPEALS-37511. LeverButtonsWrapper css cleanup * APPEALS-37511. Exclusion table header styling --------- Co-authored-by: SHarshain * Demo VLJ and AVLJ users updates (#20540) * and _AVLJ to AVLJ names * Update case_distribution_test_data.rb * APPEALS-38398 Disabled levers are still showing focus on Admin UI (#20559) * disable tabbing to disable inputs * clean up ToggleSwitch css * Update _toggle_switch.scss * move import * Update _toggle_switch.scss * Update ToggleSwitch.jsx * Update _toggle_switch.scss * test that props are being passed in correctly * Ricky/appeals-37871 (#20534) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data --------- Co-authored-by: Matt Roth * add disabled to other NumberFields (#20564) * mbeard/APPEALS-38541 (#20553) * "makes too_many_cases error dynamic" * "updates controller method to be dynamic" * sharsha/APPEALS-37511_3. Added 30px right padding for table header (#20562) Co-authored-by: SHarshain * APPEALS-37525 Refactor ACD Levers Test Page (#20535) * APPEALS-37525 Refactor ACD Levers Test Page * Change Test Page to React component * Use lever history serializer in controller * Add all current attributes to the Lever Table * Add more attributes to Lever History Table * Update links from ruby to React * APPEALS-37525 moved the lever_history to the model because it's being… (#20538) * APPEALS-37525 moved the lever_history to the model because it's being used in multiple places * APPEALS-37525 changed the options to only display values * Fix unit test --------- Co-authored-by: Christopher Detlef <> * Fix Option Values column * DRY out the history unit test --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-37794 (#20532) * "updates copy issue and radiofield" * "updates accessibility labels" * "attempt to update label" * "updates accessibility vioce over" * "moves logic from radiofield to exclusiontable" * "Updated fixes from comments" * "removes last thing from TextField component" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-37832. Test data seed spec for case distribution (#20561) * APPEALS-37832. Test data seed spec for case distribution * APPEALS-37832. more changes * APPEALS-37832. Added CaseDistributionlevers count --------- Co-authored-by: SHarshain * Ricky/appeals-37556 (#20502) * Updated LeverHistory component, formatting and storage in redux * Updated Jest testing for LeverHistory * Code cleanup and address comments. Reverted save_levers changes * Feature test outline and class names added * Updated feature tests * Fixed linting error with SaveModal * Updated testing for LeverHistory and fixed css id from showing * Created individual lever history action, updated reducer, updated testing * Removed unneeded data in jest test * Cleaned up formatTimestamp function --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-38556 (#20574) * Initial testing for BatchSize and lever data for testing. * Updated BatchSize Testing and additional testing data. * Updated tests to get full testing coverage * APPEALS-37508 resetting the errors when the cancel button is clicked (#20589) * APPEALS-37511. Fix exclusion table member view (#20595) Co-authored-by: SHarshain * Ricky/appeals-37871 (#20596) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data * Updated spacing between value and unit for static lever, updated testing * Updated static lever to separate value and unit using css --------- Co-authored-by: Matt Roth * APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613) Co-authored-by: SHarshain * APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614) Co-authored-by: SHarshain * APPEALS-38570. Improve the test coverage (#20584) * APPEALS-38570. Improve the test coverage * APPEALS-38570. Dead code cleanup * APPEALS-38570. test coverage to address the exception --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38764 Add Batch Size Lever feautre tests (#20618) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-38561 (#20622) * "initial commit, adds test and save button export" * "adds leversavebutton unit test" * APPEALS-38789 Added error message validation to feature test for Docket Goals (#20625) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * fix merge conflict error * APPEALS-38787 Add Affinity Days levers feature tests (#20619) Co-authored-by: Christopher Detlef <> * APPEALS-38903 Add Inactive Data Elements lever feature tests (#20621) Co-authored-by: Christopher Detlef <> * APPEALS-38555. Affinity Days jest test (#20633) Co-authored-by: SHarshain * Ricky/appeals-38557 (#20634) * Began work on DocketTimeGoal testing, updated toSorted to sort * Updated unit tests to improve coverage on DocketTimeGoals * Updated unit tests to begin working on testing toggleLever * rebuild PR (#20617) * rebuild PR * Update LeverHistory.jsx * Cleaned up DocketTimeGoals test --------- Co-authored-by: Matt Roth * APPEALS-38904 Add Feature Test for Audit Lever History (#20637) * Initial pass * APPEALS-38904 Add Feature Test for Audit Lever History --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * mbeard/APPEALS-38558 (#20630) * "initial commit, created test, updated wrapper" * "adds test cases for save and cancel buttons" * "updates revertLevers to resetLevers for clarity" * "removes problematic test case" --------- Co-authored-by: Matt Roth * APPEALS-38526. 100% test coverage for Case distribution test data seed (#20638) * APPEALS-38526. 100% test coverage for Case distribution test data seed * APPEALS-38526. Fix the typo * APPEALS-38526. Fix the typo in class and related spec --------- Co-authored-by: SHarshain * Ricky/appeals-38567 (#20642) * Updated caseDistributionApp test file and added additional test lever data * Updated test for CaseDistributionApp * Updated rootreducer test for full coverage (#20653) * APPEALS-38555. Added the test coverage to verify the text input (#20654) Co-authored-by: SHarshain * Update to audit lever history time entries to display leading 0s for hours, minutes, and seconds (#20652) * APPEALS-38558 amended test to cover the remaining thee lines of code (#20643) * APPEALS-38790 Add Lever Button feature tests (#20662) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-39284 (#20663) * "initial commit with updates controller, actions, reducer" * "updates leversActions error message" * "updates case dist levers controller spec" * "removes redundant line from update_levers method" * Isaiah/appeals 38453 migrations (#20661) * APPEALS-38453: ac1-2-added migration to add col. for org. * APPEALS-38453: AC3-update org serialize method * APPEALS-38453: AC1-2 update to caseflow migration * APPEALS-38453: AC1/2-updated syntax * APPEALS-38453: AC1/2 added not null constraint * APPEALS-38453: added etl migration * removed AC3 * pull changes from hotfix branch (#20667) * APPEALS-38542 got rid of code that is not being used (#20673) * APPEALS-38542 got rid of code that is not being used * APPEALS-38542. Remove unused constant from actions list * APPEALS-38542. remove deadcode spec --------- Co-authored-by: SHarshain * APPEALS-38562./ Removes the unused component (#20697) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "Created jest for leversactions" (#20701) * Chrisbdetlef/appeals 38966 (#20700) * APPEALS-38966 Add dynamic * generation for lever labels/titles * Remove file * Refactor to use a single utility method --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * Ricky/appeals-38569 (#20681) * Pushed changes to LeversReducer Test * Updated unit tests for additional coverage * Pushed up changes to have eyes on async tests * Pulled in Amy's changes and moved data to adminCaseDistributionLevers * Updated test data naming for mocks and tests * Updated testing to fix issues and improve coverage * Updated unit tests, added comments on unfinished work * APPEALS-38569 updated the reducer to give the expected information in the jest tests --------- Co-authored-by: 631966 * mbeard/APPEALS-37794 (#20685) * APPEALS-37794 made changes to the shared number and text components so that we have more control over what the aria-label is * "Updates arialabeltext for batchsize, jests for batchsize and docket time goals" * "updates admin jest aria text query" --------- Co-authored-by: 631966 * Isaiah/appeals 38453 (#20650) * APPEALS-38453: ac1-2-added migration to add col. for org. * APPEALS-38453: AC3-update org serialize method * APPEALS-38453: AC1-2 update to caseflow migration * APPEALS-38453: AC1/2-updated syntax * APPEALS-38453: AC1/2 added not null constraint * APPEALS-38453: added etl migration * APPEALS-38453: ac4-add class method to judge_team * APPEALS-38453: ac4 revised into class method * APPEALS-38453: AC5-added rspec setup * added testing + migration * added inactive judge team to testing --------- Co-authored-by: Calvin Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> * Exclude Work (#20647) * Exclude Work * fixed button * fixed colspan for button * styling + rubocop fixes * added border between sections to match wireframe * updated button styling * fixed lingering border bottom * backend implemented + fixed more css issues * updated snapshot * Changing cases to appeals in label * updated team management spec to ensure org is updated correctly * feature test * added description to feature tests * revert changes that are causing the Unable to load banner to appear to quick (#20712) * APPEALS-32252 fixed a few rspec tests (#20738) * added the judge list all and attorney list all to help with caching issues * Craig/appeals 37330 (#20713) * add seed for affinity, add to seeds.rb * revert change to hearing day factory to fix tests * fix seed to run from command line instead of only rails console * fix issue with seed file causing failure when doing make reset * APPEALS-39893 CaseDistributionLever swap over to method_missing (#20744) * remove find_float and find_float, swap to method_missing * codeclimate updates * Update case_distribution_lever.rb * Update case_distribution_lever.rb * APPEALS-39660 Correct ACD Lever Seeds (#20747) Co-authored-by: Christopher Detlef <> * APPEALS-39889 CodeClimate issues (#20740) * move to story branch * Update .codeclimate.yml * pull in dev-support/APPEALS-39031 * Update case_distribution_lever.rb * Update .codeclimate.yml * disable DataClump for db seeds * lint fixes * Update affinity_days_levers_spec.rb * Update case_distribution_lever.rb * Update .codeclimate.yml * pull over other changes * Update case_distribution_lever.rb * Update case_distribution_lever.rb * fix codeclimate issues * fix more issues * rubocop auto fixes * Update test.jsx * mbeard/APPEALS-39895 (#20746) * "updates value in test method and adds new contexts" * "put everything back" * "updates seed value for Dockt weight" * "verifies seed data is correct" (#20754) * APPEALS-39897. Ambiguous id match removed from the component and matched the parent css element (#20745) * APPEALS-39897. Ambiguous id match removed from the component and matched to parent css element * APPEALS-39897. Refactored spec * APPEALS-39897. rubocop fixes * APPEALS-39897. Lint fix --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update leversActions.js (#20760) * APPEALS-39899. Spec fix (#20758) Co-authored-by: SHarshain * revert and move new code to correct file (#20766) * APPEALS-39889 Code Climate issues part 2 (#20759) * swap over to using USWDS colors * more rubocop fixes * add extra lines, remove spaces * Update affinity_days_levers_spec.rb * cleanup unit tests * Update audit_lever_history_table_spec.rb * Update inactive_data_elements_levers_spec.rb * Update _interactable_levers.scss * refactor duplicate code * Update _lever_history.scss * Update affinity_days_levers_spec.rb --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-39984 Update test to match css fix (#20768) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40085 Update ACD lever count (#20769) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40092. Fix negative rspec matcher (#20772) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "fixed spelling and updated spec to include two new users" (#20777) Co-authored-by: Matt Roth * mbeard/APPEALS-38563 (#20577) * "creates savemodal test by adding save button" * "updates and deleted and recreated file" * "latest update to mockstore" * "adds export to save button and updates test" * "current updaates to the test" * "Updates the confirm button to mock confirm button" * Updated testing data and SaveModal tests * "updates logic in utils and updates test" * "adds changedLevers constant mocked data and renders corrrectly" * "adds affinity days to test, and close modal" * "updates test data, adds new cases, adds ids to table" --------- Co-authored-by: 631068 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: 631966 * APPEALS-40134. Add missing traits in factories (#20789) Co-authored-by: SHarshain * APPEALS-40131. Fix case_distribution_levers seed spec (#20786) Co-authored-by: SHarshain * APPEALS-39980. Mock the value in the spec (#20784) Co-authored-by: SHarshain * "updates control group and rsec to never recieve tasks" (#20790) * Updated constants from by docket date to static docket date (#20796) * APPEALS-39892 Unit test fixes (#20798) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Sean/appeals 37339 (#20731) * apply affinity exclusions logic to the docket * added adjust_for_affinity * cleaned up parameters * Added safe navigation * added feature toggle * added spec for acd_exclude_from_affinity when toggle is enable * include query fix --------- Co-authored-by: Sean Parker Co-authored-by: samasudhirreddy * merge issue * Update case_docket.rb (#20782) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * ricky/APPEALS-40090 (#20803) * APPEALS-39892 fixed one file for rubocop issues * Updated jest unit tests to fix issues * Updated leversReducer unit tests * Added export back to LeverSaveButton --------- Co-authored-by: 631966 * APPEALS-39892 Unit tests fixes (#20810) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update case_docket.rb * APPEALS-39987 updated failing snapshots (#20751) * Updated jest config to ignore test.jsx files (#20826) * APPEALS-40136 Bring test data back into range of displayed data (#20824) Co-authored-by: Christopher Detlef <> * Updated By Docket Date to Docket Date (#20827) * APPEALS-39899. docket_coordinator_spec fix (#20829) Co-authored-by: SHarshain * APPEALS-39980. Fix the timestamp failure in the spec (#20836) Co-authored-by: SHarshain * move to new feature branch (#20889) * move to new feature branch (#20890) * [APPEALS-37338]Modify Hearings Docket SQL for Named Judge Affinity Ex… (#20807) * [APPEALS-37338]Modify Hearings Docket SQL for Named Judge Affinity Exclusions * added feature toggle to only genpop appeals method * added new route for acd_exclude_from_affinity query * added non_genpop_appeals to hearing query * removes comment * Updated test case when feature toggle enable and judge present --------- Co-authored-by: Calvin * move scopes from dockets to distribution_scopes (#20816) * move scopes from dockets to distribution_scopes * add comment, add rubocop disable * APPEALS-38967 Update Implementation of Affinity Days in Admin UI (#20656) * bring over fix for ordering * suggested change * Create 20240130152058_update_case_distribution_levers_is_toggle_active.rb * Update schema.rb * Updates to enable levers that are being tested and for null values in is_toggle_active for n/a levers * Update test.jsx * Update test.jsx * updates for Combination levers, missing updates to allow saving of them * Save combination levers * Update SaveModal.jsx * swap over to methods focused on updating a specific attribute of a lever * change radio to not have value in value * for radio levers set selectedOption when loading levers * Update case_distribution_lever.rb * Update AffinityDays.jsx * Update case_distribution_lever.rb * updates to account for is_toggle_active being nullable * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * fix validation error messages, Radio levers update redux store correctly * changing radio enables Save and displays in Save Modal correctly * fix max values to be 999 * Can save Radio levers successfully * history entries match frontend * Update AffinityDays.jsx * cleanup and comments * Feature/appeals 26750 int (#20933) * placeholder files exist (#19734) * placeholder files exist * APPEALS-32385 the lever component should be singular * APPEALS-32385 fixed plurality in the content file * adds admin_case_distribution to features_config (#19745) * fix the json syntax error (#19781) Co-authored-by: SHarshain * Added a basic reducer for the Levers (#19790) - Allow intial state to be passed into the Lever Reducer - Add generator to Lever Reducer - Add functions for Lever Reducer - Fix test data array Co-authored-by: Christopher Detlef <> * ricky/APPEALS-32386 - Lever History (#19793) * Created LeverHistory Component and updated test data * Fixed name and title, resubmitted styling and testing --------- Co-authored-by: 631966 * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Creat… * Feature/appeals 26750 20 mar (#21211) * placeholder files exist (#19734) * placeholder files exist * APPEALS-32385 the lever component should be singular * APPEALS-32385 fixed plurality in the content file * adds admin_case_distribution to features_config (#19745) * fix the json syntax error (#19781) Co-authored-by: SHarshain * Added a basic reducer for the Levers (#19790) - Allow intial state to be passed into the Lever Reducer - Add generator to Lever Reducer - Add functions for Lever Reducer - Fix test data array Co-authored-by: Christopher Detlef <> * ricky/APPEALS-32386 - Lever History (#19793) * Created LeverHistory Component and updated test data * Fixed name and title, resubmitted styling and testing --------- Co-authored-by: 631966 * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history --------- Co-authored-by: 631966 * Amycommits/appeals 37248 (#20310) * fixed linting errors * APPEALS-37248 progress on the lint errors * APPEALS-37248 took out custom lint fix command * mbeard/APPEALS-36896 (#20293) * updates reducer, modal, actiontypes, index * fixes words and ads asterisks * removes one asterisk * fixes margin * updates scss padding --------- Co-authored-by: 631966 * Ricky/appeals-34350-Error-and-Validation-Handling (#20288) * Updated LeverModal button and reducer to fix error handling * Implemented new error handling in DocketTimeGoals and BatchSize Lever groups * Updated error handling for lever inputs for affinity days * Fixed incorrect check and messages in CheckIsInRange function * Added first part of input validation for duplicate values * Removed leftover code * Updated logic to handle save button enabling if duplicate values are put in fields --------- Co-authored-by: 631966 * Ricky/appeals-34224 (#20316) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631966 * mbeard/APPEALS-36175 (#20285) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * adds url to controller * updates erb files * updates controller * APPEALS-36175 took out extraneous code in the lever modal * updates controller dropdowm menu --------- Co-authored-by: 631966 * Amycommits/appeals 37286 (#20322) * Ricky/appeals 34224 (#20321) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631068 * reverted changes to the caseflow distribution content page that were causing an error * reverted changes to the caseflow distribution content page that were causing an error --------- Co-authored-by: 631068 * APPEALS-36334 Seed Data for ACD Lever Testing (#20317) * APPEALS-36334 Seed Data for ACD Lever Testing * For testing * Re-add lever test seed data --------- Co-authored-by: Christopher Detlef <> * APPEALS-37279 reverted code changes based on feedback (#20318) * APPEALS-37279 reverted code changes based on feedback * APPEALS-37279. revert the api_status_alert lever item --------- Co-authored-by: SHarshain * APPEALS-34623. Created DB table and logged the data to acd-controls t… (#20193) * APPEALS-34623. Created DB table and logged the data to acd-controls test page * APPEALS-34623. Added model associations and spec * sharsha/APPEALS-34623. revert changes in schema to match the feature branch --------- Co-authored-by: SHarshain * APPEALS-37314 fixes X functionality (#20339) * APPEALS-37227. Sort the levers (#20319) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-37290. Refactor (#20340) * APPEALS-37290. Refactor * APPEALS-37290. Updated the integer and float levers and some refactor --------- Co-authored-by: SHarshain Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-36550 Queries for User Testing (#20311) * APPEALS-36550 set up the link so that a query can be downloaded as a CSV on the test page * APPEALS-36550 built out the link with the appropriate routes, and started the appeals ready for distribution query * Add dashboard to test/users Miscellaneous tab * Add navigation links * Update test.html.erb * get appeals ready for distribution for each docket * extract works * Update appeals_ready_for_distribution.rb * legacy appeals ready to distribute done * Update appeals_ready_for_distribution.rb * all ama distributed appeals * distributed legacy appeals * comments --------- Co-authored-by: 631966 * APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373) Co-authored-by: SHarshain Co-authored-by: Matt Roth * APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374) Co-authored-by: SHarshain * added lever_group column and updated seeds files (#20379) * mbeard/APPEALS-37248 (#20364) * corrects scss linting issues * updates scss linting issues * fixes linting issues in scss * fixes almost all linting issues * fixes furhter linting issues * updates linter styling issues * updates leverhistory linting issues * fixes scss linting issues * fixes disappearing save button * "updates styling for linting issues" * "updates styling and fixes leverhistory" * "final edits to styling" * "final final" * adds utiljs and imports function * "updates dockettimegoals" * renaming scss * fixes style issues * "fixes app/styles" --------- Co-authored-by: Matt Roth * Tmr/appeals 32252 refactor (#20376) * remove redundant checks and move url addition to within existing checks * Update case_distribution_levers_controller.rb * linting fixes * Update push_priority_appeals_to_judges_job.rb * Update push_priority_appeals_to_judges_job_spec.rb * Remove CaseDistributionAlgorithmLog * rubocop * Update routes.rb * Update seeds.rb * Update docket_coordinator_spec.rb * Update schema.rb * fix typos * Update application_controller.rb * move unit tests to client/test/ to match project standards * remove storybook files * revert unrelated changes to schema * Delete ToggleSwitch.stories.js * mbeard/APPEALS-36896 (#20391) * "fixes copy" * "updates COPY titles" * "TYPO" * APPEALS-36381 Replace ACD Lever variables with constants (#20398) Co-authored-by: Christopher Detlef <> * APPEALS-37582: Refactor: Audit table cleanup (#20403) * cleanup audit table * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * remove old fields * Update 20240103134452_update_case_distribution_audit_lever_entry.rb * add seed data * prop type validations * Adjust history rendering to account for new database table setup * unit test and remove console logs * update serializer to pass along lever fields for audit entries * Hun jer bah/appeals 32252 redux refactor (#20365) * created root reducer and refactored actions list * swapped Contants for ACTIONS * created place holder lever actions * created proof of concept action for redux store. * fixed action * fixed naming convention * created action to update affinity days * Fix Misc. Controller Linting Issues * created test route to load lever info in full * set up loadLever action to pull add data from new temp controller route * added lever grouping to controller * passed down organized levers to child components * rolled back schema before merging feature in * fixed merge conflict * Update application_controller.rb * cleaned up code for handoff to Kepler team * removed leftover comment * removed ApiUtil method of passing values and used index.html.erb * set up BatchSize to use hooks from store * cleaned up BatchSize props * updated docket time goals and affininty days (pass values to affinity day levers only) * Fix Misc. Issues - Fix levers not loading in BatchSize by moving loading logic to parent component constructor vs. running on component mount. - Fix DB migration issue with not-null column lacking a default. * Remove merge markers * cleaned up old use effects * Update case_distribution_levers_controller.rb * remove loadLevers from PropTypes * add initial state of levers to new store * Update InteractableLeversWrapper.jsx * update to use new store and refactor work * remove passing around of loadedLevers * Update BatchSize.jsx * cleanup --------- Co-authored-by: Alexander Smith Co-authored-by: Matthew Roth * APPEALS-37505: Create Case Distro Algorithm Control users in Demo (#20401) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * revert changes unrelated to work * Update case_distribution_levers_controller_spec.rb * APPEALS-37554 Refactor: Redux Load Levers: Fixes (#20422) * rename folder * rename folder * rename redux properties * fix dashboard * Rename from CaseflowDistribution to CaseDistribution (#20428) * move from caseflowDistribution to caseDistribution * update import statements * rename page * cleanup text strings * remaining instances of CaseflowDistribution * rename reducers/Levers to reducers/levers * pull updates in * rename Levers to levers * bad or missing imports * cleanup unused variable and imports * Update users.rb * Update users.rb * APPEALS-37582 Test Data page swap to css_id for Audit Entries table (#20436) * Update test.html.erb * rename files to match their functional components * Amycommits/appeals 37719 (#20444) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37719 fixed some of the linting and typos * APPEALS-37720 changed the variables in the reducer (#20445) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * Amycommits/appeals 37719.appeals 37720.appeals 37692 (#20446) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37692 fixed linting error * PPEALS-37692 merged the feature branch back in * Serializer was named incorrectly, renaming to match class and database table name (#20451) * Fix mispelled file name * fixed linting errors and warnings * APPEALS-37558 restructured the levers to store the backend lever valu… (#20447) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37558 restructured the levers to store the backend lever value and keep tabs of the actual value change. * mbeard/APPEALS-37526 (#20453) * "updates COPY and fixes some linting issues" * "updates COPY and moves sectiontitles to constantsjs" * "removes linting changes from reducer" * Amycommits/appeals 37767 (#20465) * APPEALS-37767 initial load works * APPEALS-37767 refactored how the admin permissions are stored * APPEALS-37767 updated exclusion table to use admin variable from redux * APPEALS-37767 cleaned up the usage of isAdmin * APPEALS-37767 fixed some linting issues * APPEALS-37767 removed the sectionTitle from the content page * APPEALS-37558 Refactor: Redux Confirm Save (#20452) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * Update case_distribution_audit_lever_entry_serializer_spec.rb * Update case_distribution_levers_controller.rb * rename route and method to update_levers * move lever updating logic into the model * priority distributions comment and affinity days case generation * Create case_distribution_lever_spec.rb * Update case_distribution_levers_controller.rb * Update case_distribution_levers_controller_spec.rb * move data_types constants into an object in ACD_LEVERS * Update case_distribution_lever.rb * Add validation for data_types * case_distribution_lever_spec * linter errors * remove passing around sectionTitles * move algorithm and lever_group strings into ACD_LEVERS * Update DocketTimeGoals.jsx * Update LeverSaveButton.jsx * Update leversSelector.js * create new actions * create individual actions for each data type * use new action in DocketTImeGoals * create SaveModal file * clean up around the different data type updates * show changed levers * show changed levers * Save works and success banner displays * cleanup and account for multiple levers being changed * error banner display * batch size saves * clean up Affinity Days and ensure order * Ensure BatchSize order * Fix DocketTimeGoals ordering * clear errors out when hiding banner * more cleanup * props cleanup * clean up from feature branch merge * linting errors * APPEALS-37558: Refactor: Redux Confirm Save (#20490) * Update ExclusionTable.jsx * update levers after save * update history and audit table to show css_id * Update leversReducer.js * APPEALS-37558 (#20498) * Fix error banner not displaying * Update case_distribution_levers_controller.rb * mbeard/APPEALS-37559 (#20494) * "updates lever cancel function" * "final updates to cancel button, updates controller" * "updated routes, method, and function" * "Unit test for cancel button" * "removed comments from test" * Amycommits/appeals 37508 (#20503) * APPEALS-37508 validation works * APPEALS-37508 added a check for lever errors to the save button. * APPEALS-37508 cleaned up some of the validation functions * github test (#20491) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers --------- Co-authored-by: Christopher Detlef <> * Chrisbdetlef/appeals 37692 (#20512) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers * Add constants and custom html for capybara tests --------- Co-authored-by: Christopher Detlef <> * APPEALS-37558 Fix issues found during QA testing (#20511) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * APPEALS-37558 Prevent bad audit entries (#20522) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * prevent invalid lever changes from getting audit entries * Update case_distribution_lever_spec.rb * APPEALS-37508 redoing the seeds (#20531) * Sharsha/appeals 37511 2 (#20521) * APPEALS-37511. ExclusionTable scss refactor * APPEALS-37511. Static levers scss refactor * APPEALS-37511. Lever History refactor scss * sharsha/APPEALS-37511. linting fixes * APPEALS-37511. Refactor Interactable Levers scss * APPEALS-37511. fix cancel and save button styling * APPEALS-37511. fixes * APPEALS-37511. Lint fixes * APPEALS-37511. updated the mock to use the updated scss files * APPEALS-37511. LeverButtonsWrapper css cleanup * APPEALS-37511. Exclusion table header styling --------- Co-authored-by: SHarshain * Demo VLJ and AVLJ users updates (#20540) * and _AVLJ to AVLJ names * Update case_distribution_test_data.rb * APPEALS-38398 Disabled levers are still showing focus on Admin UI (#20559) * disable tabbing to disable inputs * clean up ToggleSwitch css * Update _toggle_switch.scss * move import * Update _toggle_switch.scss * Update ToggleSwitch.jsx * Update _toggle_switch.scss * test that props are being passed in correctly * Ricky/appeals-37871 (#20534) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data --------- Co-authored-by: Matt Roth * add disabled to other NumberFields (#20564) * mbeard/APPEALS-38541 (#20553) * "makes too_many_cases error dynamic" * "updates controller method to be dynamic" * sharsha/APPEALS-37511_3. Added 30px right padding for table header (#20562) Co-authored-by: SHarshain * APPEALS-37525 Refactor ACD Levers Test Page (#20535) * APPEALS-37525 Refactor ACD Levers Test Page * Change Test Page to React component * Use lever history serializer in controller * Add all current attributes to the Lever Table * Add more attributes to Lever History Table * Update links from ruby to React * APPEALS-37525 moved the lever_history to the model because it's being… (#20538) * APPEALS-37525 moved the lever_history to the model because it's being used in multiple places * APPEALS-37525 changed the options to only display values * Fix unit test --------- Co-authored-by: Christopher Detlef <> * Fix Option Values column * DRY out the history unit test --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-37794 (#20532) * "updates copy issue and radiofield" * "updates accessibility labels" * "attempt to update label" * "updates accessibility vioce over" * "moves logic from radiofield to exclusiontable" * "Updated fixes from comments" * "removes last thing from TextField component" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-37832. Test data seed spec for case distribution (#20561) * APPEALS-37832. Test data seed spec for case distribution * APPEALS-37832. more changes * APPEALS-37832. Added CaseDistributionlevers count --------- Co-authored-by: SHarshain * Ricky/appeals-37556 (#20502) * Updated LeverHistory component, formatting and storage in redux * Updated Jest testing for LeverHistory * Code cleanup and address comments. Reverted save_levers changes * Feature test outline and class names added * Updated feature tests * Fixed linting error with SaveModal * Updated testing for LeverHistory and fixed css id from showing * Created individual lever history action, updated reducer, updated testing * Removed unneeded data in jest test * Cleaned up formatTimestamp function --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-38556 (#20574) * Initial testing for BatchSize and lever data for testing. * Updated BatchSize Testing and additional testing data. * Updated tests to get full testing coverage * APPEALS-37508 resetting the errors when the cancel button is clicked (#20589) * APPEALS-37511. Fix exclusion table member view (#20595) Co-authored-by: SHarshain * Ricky/appeals-37871 (#20596) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data * Updated spacing between value and unit for static lever, updated testing * Updated static lever to separate value and unit using css --------- Co-authored-by: Matt Roth * APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613) Co-authored-by: SHarshain * APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614) Co-authored-by: SHarshain * APPEALS-38570. Improve the test coverage (#20584) * APPEALS-38570. Improve the test coverage * APPEALS-38570. Dead code cleanup * APPEALS-38570. test coverage to address the exception --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38764 Add Batch Size Lever feautre tests (#20618) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-38561 (#20622) * "initial commit, adds test and save button export" * "adds leversavebutton unit test" * APPEALS-38789 Added error message validation to feature test for Docket Goals (#20625) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * fix merge conflict error * APPEALS-38787 Add Affinity Days levers feature tests (#20619) Co-authored-by: Christopher Detlef <> * APPEALS-38903 Add Inactive Data Elements lever feature tests (#20621) Co-authored-by: Christopher Detlef <> * APPEALS-38555. Affinity Days jest test (#20633) Co-authored-by: SHarshain * Ricky/appeals-38557 (#20634) * Began work on DocketTimeGoal testing, updated toSorted to sort * Updated unit tests to improve coverage on DocketTimeGoals * Updated unit tests to begin working on testing toggleLever * rebuild PR (#20617) * rebuild PR * Update LeverHistory.jsx * Cleaned up DocketTimeGoals test --------- Co-authored-by: Matt Roth * APPEALS-38904 Add Feature Test for Audit Lever History (#20637) * Initial pass * APPEALS-38904 Add Feature Test for Audit Lever History --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * mbeard/APPEALS-38558 (#20630) * "initial commit, created test, updated wrapper" * "adds test cases for save and cancel buttons" * "updates revertLevers to resetLevers for clarity" * "removes problematic test case" --------- Co-authored-by: Matt Roth * APPEALS-38526. 100% test coverage for Case distribution test data seed (#20638) * APPEALS-38526. 100% test coverage for Case distribution test data seed * APPEALS-38526. Fix the typo * APPEALS-38526. Fix the typo in class and related spec --------- Co-authored-by: SHarshain * Ricky/appeals-38567 (#20642) * Updated caseDistributionApp test file and added additional test lever data * Updated test for CaseDistributionApp * Updated rootreducer test for full coverage (#20653) * APPEALS-38555. Added the test coverage to verify the text input (#20654) Co-authored-by: SHarshain * Update to audit lever history time entries to display leading 0s for hours, minutes, and seconds (#20652) * APPEALS-38558 amended test to cover the remaining thee lines of code (#20643) * APPEALS-38790 Add Lever Button feature tests (#20662) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-39284 (#20663) * "initial commit with updates controller, actions, reducer" * "updates leversActions error message" * "updates case dist levers controller spec" * "removes redundant line from update_levers method" * pull changes from hotfix branch (#20667) * APPEALS-38542 got rid of code that is not being used (#20673) * APPEALS-38542 got rid of code that is not being used * APPEALS-38542. Remove unused constant from actions list * APPEALS-38542. remove deadcode spec --------- Co-authored-by: SHarshain * APPEALS-38562./ Removes the unused component (#20697) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "Created jest for leversactions" (#20701) * Chrisbdetlef/appeals 38966 (#20700) * APPEALS-38966 Add dynamic * generation for lever labels/titles * Remove file * Refactor to use a single utility method --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * Ricky/appeals-38569 (#20681) * Pushed changes to LeversReducer Test * Updated unit tests for additional coverage * Pushed up changes to have eyes on async tests * Pulled in Amy's changes and moved data to adminCaseDistributionLevers * Updated test data naming for mocks and tests * Updated testing to fix issues and improve coverage * Updated unit tests, added comments on unfinished work * APPEALS-38569 updated the reducer to give the expected information in the jest tests --------- Co-authored-by: 631966 * mbeard/APPEALS-37794 (#20685) * APPEALS-37794 made changes to the shared number and text components so that we have more control over what the aria-label is * "Updates arialabeltext for batchsize, jests for batchsize and docket time goals" * "updates admin jest aria text query" --------- Co-authored-by: 631966 * revert changes that are causing the Unable to load banner to appear to quick (#20712) * APPEALS-32252 fixed a few rspec tests (#20738) * added the judge list all and attorney list all to help with caching issues * APPEALS-39893 CaseDistributionLever swap over to method_missing (#20744) * remove find_float and find_float, swap to method_missing * codeclimate updates * Update case_distribution_lever.rb * Update case_distribution_lever.rb * APPEALS-39660 Correct ACD Lever Seeds (#20747) Co-authored-by: Christopher Detlef <> * APPEALS-39889 CodeClimate issues (#20740) * move to story branch * Update .codeclimate.yml * pull in dev-support/APPEALS-39031 * Update case_distribution_lever.rb * Update .codeclimate.yml * disable DataClump for db seeds * lint fixes * Update affinity_days_levers_spec.rb * Update case_distribution_lever.rb * Update .codeclimate.yml * pull over other changes * Update case_distribution_lever.rb * Update case_distribution_lever.rb * fix codeclimate issues * fix more issues * rubocop auto fixes * Update test.jsx * mbeard/APPEALS-39895 (#20746) * "updates value in test method and adds new contexts" * "put everything back" * "updates seed value for Dockt weight" * "verifies seed data is correct" (#20754) * APPEALS-39897. Ambiguous id match removed from the component and matched the parent css element (#20745) * APPEALS-39897. Ambiguous id match removed from the component and matched to parent css element * APPEALS-39897. Refactored spec * APPEALS-39897. rubocop fixes * APPEALS-39897. Lint fix --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update leversActions.js (#20760) * APPEALS-39899. Spec fix (#20758) Co-authored-by: SHarshain * revert and move new code to correct file (#20766) * APPEALS-39889 Code Climate issues part 2 (#20759) * swap over to using USWDS colors * more rubocop fixes * add extra lines, remove spaces * Update affinity_days_levers_spec.rb * cleanup unit tests * Update audit_lever_history_table_spec.rb * Update inactive_data_elements_levers_spec.rb * Update _interactable_levers.scss * refactor duplicate code * Update _lever_history.scss * Update affinity_days_levers_spec.rb --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-39984 Update test to match css fix (#20768) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40085 Update ACD lever count (#20769) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40092. Fix negative rspec matcher (#20772) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "fixed spelling and updated spec to include two new users" (#20777) Co-authored-by: Matt Roth * mbeard/APPEALS-38563 (#20577) * "creates savemodal test by adding save button" * "updates and deleted and recreated file" * "latest update to mockstore" * "adds export to save button and updates test" * "current updaates to the test" * "Updates the confirm button to mock confirm button" * Updated testing data and SaveModal tests * "updates logic in utils and updates test" * "adds changedLevers constant mocked data and renders corrrectly" * "adds affinity days to test, and close modal" * "updates test data, adds new cases, adds ids to table" --------- Co-authored-by: 631068 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: 631966 * APPEALS-40134. Add missing traits in factories (#20789) Co-authored-by: SHarshain * APPEALS-40131. Fix case_distribution_levers seed spec (#20786) Co-authored-by: SHarshain * APPEALS-39980. Mock the value in the spec (#20784) Co-authored-by: SHarshain * "updates control group and rsec to never recieve tasks" (#20790) * Updated constants from by docket date to static docket date (#20796) * APPEALS-39892 Unit test fixes (#20798) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * merge issue * Update case_docket.rb (#20782) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * ricky/APPEALS-40090 (#20803) * APPEALS-39892 fixed one file for rubocop issues * Updated jest unit tests to fix issues * Updated leversReducer unit tests * Added export back to LeverSaveButton --------- Co-authored-by: 631966 * APPEALS-39892 Unit tests fixes (#20810) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update case_docket.rb * APPEALS-39987 updated failing snapshots (#20751) * Updated jest config to ignore test.jsx files (#20826) * APPEALS-40136 Bring test data back into range of displayed data (#20824) Co-authored-by: Christopher Detlef <> * Updated By Docket Date to Docket Date (#20827) * APPEALS-39899. docket_coordinator_spec fix (#20829) Co-authored-by: SHarshain * APPEALS-39980. Fix the timestamp failure in the spec (#20836) Co-authored-by: SHarshain * move to new feature branch (#20889) * move to new feature branch (#20890) * APPEALS-38967 Update Implementation of Affinity Days in Admin UI (#20656) * bring over fix for ordering * suggested change * Create 20240130152058_update_case_distribution_levers_is_toggle_active.rb * Update schema.rb * Updates to enable levers that are being tested and for null values in is_toggle_active for n/a levers * Update test.jsx * Update test.jsx * updates for Combination levers, missing updates to allow saving of them * Save combination levers * Update SaveModal.jsx * swap over to methods focused on updating a specific attribute of a lever * change radio to not have value in value * for radio levers set selectedOption when loading levers * Update case_distribution_lever.rb * Update AffinityDays.jsx * Update case_distribution_lever.rb * updates to account for is_toggle_active being nullable * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * fix validation error messages, Radio levers update redux store correctly * changing radio enables Save and displays in Save Modal correctly * fix max values to be 999 * Can save Radio levers successfully * history entries match frontend * Update AffinityDays.jsx * cleanup and comments * Update case_distribution_lever.rb * Update LeverHistory.jsx * Revert "Update LeverHistory.jsx" This reverts commit 6eca84730cac808e5d25b467d370dd21a34013d1. * APPEALS-26750 auto_texts was created as a part of master * Update case_distribution_lever.rb (#20946) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38967 Remove units showing when not needed (#20975) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: 631966 * APPEALS-38744 Update AMA Hearing Case Affinity Days Lever (#20956) * APPEALS-38744 added checks for ama hearing case affinity days lever * APPEALS-38744 refactored logic for ama hearing case affinity days lever * APPEALS-38744 update method name * APPEALS-41456 made changes to the affinity days test data and jest tests to conform to new data changes (#20991) * Tmr/appeals 38967 4 (#21034) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: Matthew Roth * Ricky/appeals-35179 (#20988) * "adds ama aod original appeals method to scopes" * "adds conditional to only_genpop_appeals" * "removes unnecessary copied code" * "adds comment" * "Updates to formatting for shovel methods" * "updates conditional to include correct function, changes scope chain" * "Updates and adds scope for infinite, test passes" * "adds infinite method to scopes" * "created new test scenarios" * "moves line up" * "updates distribution scope methods" * "updates methods" * "updates rspec to update attribute" * "updates def and values" * "updates rspec to new methods" --------- Co-authored-by: Michael Beard * APPEALS-38967 made sure that the lever history displays properly (#21041) * APPEALS-37024 Create Seeds For ACD Demo (#21038) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-38744 (#21039) * "init commit for updating not_genpop_appeals" * "adds new context and updates top ama" * "updates methods on scopes, adds new appeals, updates specs" * Updated logic and rspec tests * APPEALS-38744 rearranged the not_genpop_appeals to only run the not_genpop_appeals query once * APPEALS-38744 took out puts * APPEALS-38744 the queries work through binding.pry the tests are failing due to setup issues * APPEALS-38744 update with new pattern * APPEALS-38744 added a conditional to make affinity days chained correctly * APPEALS-38744 more fiddling * Fix code issues for query structures * Make returns uniformly arrays of arrays * flagged error * "updates hearing docket method to if else" * "fixes ish respecs adding with_no_held_hearings to the array" * "cleanup brush brush brush" --------- Co-authored-by: 631068 Co-authored-by: 631966 Co-authored-by: Christopher Detlef <> * APPEALS-42090 Add newly enabled levers to capybara test (#21117) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-42093 (#21114) * "updates jest to reflect code changes and updates selector logic" * "updates savemodal jest" * "Updates leversActions test, removes redundancies" * "Updates infinite, omit, and updated value tests" * APPEALS-42010 Rework affinity lever tests (#21079) * APPEALS-42010 fix rspecs * APPEALS-42010 update specs and address pr suggestions --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Ricky/appeals-42088 (#21126) * Updated seed data * Updated seed data for days_before_goal_due_for_distribution lever * Reworked solution and renamed lever to be correct * Updated tests (#21135) * Feature/appeals 26750 revert affinity (#21137) * APPEALS-26750 commenting out method that was failing in seeds * APPEALS-26750 added logic for unique veteran too * APPEALS-26750 updating the seeds to get the params properly * APPEALS-26750 enabled the call to create_case_ready_for_more_than_hearing_affinity_days(judge) * increase the number of digits in the css_id sequence (#21139) * increase the number of digits in the css_id sequence * modify generated CSS_IDs and sequence to shorten to 12 characters * ensures that the veteran id is unique, even though it always ought to be unique (#21143) * Fixed errors caused by rounding issues in rspec (#21148) * Chrisbdetlef/appeals 35179 post rewrite (#21169) * factory updates, new file created, some tests written * finished genpop_priority_count * add limit appeals class methods tests * framework and some tests for distribute_appeals * added tests for hearing aod lever * add ineligible and excluded judge tests * fix issues with aod test setup * add second test for changing numeric values * APPEALS-35179 Fix code after rspec test corrections * Rework of scopes * Tests and code are fixed * Still need to add CAVC tests * Extra code in scopes needs to be cleaned up * add last spec * fix cavc test * fix base relation cavc stuff * Refactor and prune code to improve readability * remove comments * Added new test and code fix * Remove comments * add hearings not tied to any judge to only genpop call * removed is_toggle_active spec test as its no longer needed * remove compact from hearing case distributor, add comments to failing specs, fix spec data setup * modify query, tests passing * deletes old hearings docket rspec and renames the rewrite * change magic strings to existing constants, rename method, restore seed file logging * fix issue in hrdq, update magic strings in test file --------- Co-authored-by: Craig Reese Co-authored-by: Christopher Detlef <> Co-authored-by: Calvin * mbeard/APPEALS-42094 (#21141) * "cleaned up linter issues" * "updates dist scopes" * "all linting error fixes for dockets and specs" * "adds missing end to context" * "fixes all spacing issues and alignment" * "put it all back, disable rubocop for trouble lines" * "last linting issue" * "disables double quote linter issue" * "adds ._to_s back to case distro lever" * "removed linter disable comments and updated code to remove linter issues" * "fixes spacing and alignment linting issues" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: 631966 Co-authored-by: 631068 Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> Co-authored-by: Matt Roth Co-authored-by: Alexander Smith Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: Michael Beard Co-authored-by: Calvin * Feature/appeals 26750 kepler (#21224) * placeholder files exist (#19734) * placeholder files exist * APPEALS-32385 the lever component should be singular * APPEALS-32385 fixed plurality in the content file * adds admin_case_distribution to features_config (#19745) * fix the json syntax error (#19781) Co-authored-by: SHarshain * Added a basic reducer for the Levers (#19790) - Allow intial state to be passed into the Lever Reducer - Add generator to Lever Reducer - Add functions for Lever Reducer - Fix test data array Co-authored-by: Christopher Detlef <> * ricky/APPEALS-32386 - Lever History (#19793) * Created LeverHistory Component and updated test data * Fixed name and title, resubmitted styling and testing --------- Co-authored-by: 631966 * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history --------- Co-authored-by: 631966 * Amycommits/appeals 37248 (#20310) * fixed linting errors * APPEALS-37248 progress on the lint errors * APPEALS-37248 took out custom lint fix command * mbeard/APPEALS-36896 (#20293) * updates reducer, modal, actiontypes, index * fixes words and ads asterisks * removes one asterisk * fixes margin * updates scss padding --------- Co-authored-by: 631966 * Ricky/appeals-34350-Error-and-Validation-Handling (#20288) * Updated LeverModal button and reducer to fix error handling * Implemented new error handling in DocketTimeGoals and BatchSize Lever groups * Updated error handling for lever inputs for affinity days * Fixed incorrect check and messages in CheckIsInRange function * Added first part of input validation for duplicate values * Removed leftover code * Updated logic to handle save button enabling if duplicate values are put in fields --------- Co-authored-by: 631966 * Ricky/appeals-34224 (#20316) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631966 * mbeard/APPEALS-36175 (#20285) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * adds url to controller * updates erb files * updates controller * APPEALS-36175 took out extraneous code in the lever modal * updates controller dropdowm menu --------- Co-authored-by: 631966 * Amycommits/appeals 37286 (#20322) * Ricky/appeals 34224 (#20321) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631068 * reverted changes to the caseflow distribution content page that were causing an error * reverted changes to the caseflow distribution content page that were causing an error --------- Co-authored-by: 631068 * APPEALS-36334 Seed Data for ACD Lever Testing (#20317) * APPEALS-36334 Seed Data for ACD Lever Testing * For testing * Re-add lever test seed data --------- Co-authored-by: Christopher Detlef <> * APPEALS-37279 reverted code changes based on feedback (#20318) * APPEALS-37279 reverted code changes based on feedback * APPEALS-37279. revert the api_status_alert lever item --------- Co-authored-by: SHarshain * APPEALS-34623. Created DB table and logged the data to acd-controls t… (#20193) * APPEALS-34623. Created DB table and logged the data to acd-controls test page * APPEALS-34623. Added model associations and spec * sharsha/APPEALS-34623. revert changes in schema to match the feature branch --------- Co-authored-by: SHarshain * APPEALS-37314 fixes X functionality (#20339) * APPEALS-37227. Sort the levers (#20319) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-37290. Refactor (#20340) * APPEALS-37290. Refactor * APPEALS-37290. Updated the integer and float levers and some refactor --------- Co-authored-by: SHarshain Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-36550 Queries for User Testing (#20311) * APPEALS-36550 set up the link so that a query can be downloaded as a CSV on the test page * APPEALS-36550 built out the link with the appropriate routes, and started the appeals ready for distribution query * Add dashboard to test/users Miscellaneous tab * Add navigation links * Update test.html.erb * get appeals ready for distribution for each docket * extract works * Update appeals_ready_for_distribution.rb * legacy appeals ready to distribute done * Update appeals_ready_for_distribution.rb * all ama distributed appeals * distributed legacy appeals * comments --------- Co-authored-by: 631966 * APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373) Co-authored-by: SHarshain Co-authored-by: Matt Roth * APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374) Co-authored-by: SHarshain * added lever_group column and updated seeds files (#20379) * mbeard/APPEALS-37248 (#20364) * corrects scss linting issues * updates scss linting issues * fixes linting issues in scss * fixes almost all linting issues * fixes furhter linting issues * updates linter styling issues * updates leverhistory linting issues * fixes scss linting issues * fixes disappearing save button * "updates styling for linting issues" * "updates styling and fixes leverhistory" * "final edits to styling" * "final final" * adds utiljs and imports function * "updates dockettimegoals" * renaming scss * fixes style issues * "fixes app/styles" --------- Co-authored-by: Matt Roth * Tmr/appeals 32252 refactor (#20376) * remove redundant checks and move url addition to within existing checks * Update case_distribution_levers_controller.rb * linting fixes * Update push_priority_appeals_to_judges_job.rb * Update push_priority_appeals_to_judges_job_spec.rb * Remove CaseDistributionAlgorithmLog * rubocop * Update routes.rb * Update seeds.rb * Update docket_coordinator_spec.rb * Update schema.rb * fix typos * Update application_controller.rb * move unit tests to client/test/ to match project standards * remove storybook files * revert unrelated changes to schema * Delete ToggleSwitch.stories.js * mbeard/APPEALS-36896 (#20391) * "fixes copy" * "updates COPY titles" * "TYPO" * APPEALS-36381 Replace ACD Lever variables with constants (#20398) Co-authored-by: Christopher Detlef <> * APPEALS-37582: Refactor: Audit table cleanup (#20403) * cleanup audit table * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * remove old fields * Update 20240103134452_update_case_distribution_audit_lever_entry.rb * add seed data * prop type validations * Adjust history rendering to account for new database table setup * unit test and remove console logs * update serializer to pass along lever fields for audit entries * Hun jer bah/appeals 32252 redux refactor (#20365) * created root reducer and refactored actions list * swapped Contants for ACTIONS * created place holder lever actions * created proof of concept action for redux store. * fixed action * fixed naming convention * created action to update affinity days * Fix Misc. Controller Linting Issues * created test route to load lever info in full * set up loadLever action to pull add data from new temp controller route * added lever grouping to controller * passed down organized levers to child components * rolled back schema before merging feature in * fixed merge conflict * Update application_controller.rb * cleaned up code for handoff to Kepler team * removed leftover comment * removed ApiUtil method of passing values and used index.html.erb * set up BatchSize to use hooks from store * cleaned up BatchSize props * updated docket time goals and affininty days (pass values to affinity day levers only) * Fix Misc. Issues - Fix levers not loading in BatchSize by moving loading logic to parent component constructor vs. running on component mount. - Fix DB migration issue with not-null column lacking a default. * Remove merge markers * cleaned up old use effects * Update case_distribution_levers_controller.rb * remove loadLevers from PropTypes * add initial state of levers to new store * Update InteractableLeversWrapper.jsx * update to use new store and refactor work * remove passing around of loadedLevers * Update BatchSize.jsx * cleanup --------- Co-authored-by: Alexander Smith Co-authored-by: Matthew Roth * APPEALS-37505: Create Case Distro Algorithm Control users in Demo (#20401) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * revert changes unrelated to work * Update case_distribution_levers_controller_spec.rb * APPEALS-37554 Refactor: Redux Load Levers: Fixes (#20422) * rename folder * rename folder * rename redux properties * fix dashboard * Rename from CaseflowDistribution to CaseDistribution (#20428) * move from caseflowDistribution to caseDistribution * update import statements * rename page * cleanup text strings * remaining instances of CaseflowDistribution * rename reducers/Levers to reducers/levers * pull updates in * rename Levers to levers * bad or missing imports * cleanup unused variable and imports * Update users.rb * Update users.rb * APPEALS-37582 Test Data page swap to css_id for Audit Entries table (#20436) * Update test.html.erb * rename files to match their functional components * Amycommits/appeals 37719 (#20444) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37719 fixed some of the linting and typos * APPEALS-37720 changed the variables in the reducer (#20445) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * Amycommits/appeals 37719.appeals 37720.appeals 37692 (#20446) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37692 fixed linting error * PPEALS-37692 merged the feature branch back in * Serializer was named incorrectly, renaming to match class and database table name (#20451) * Fix mispelled file name * fixed linting errors and warnings * APPEALS-37558 restructured the levers to store the backend lever valu… (#20447) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37558 restructured the levers to store the backend lever value and keep tabs of the actual value change. * mbeard/APPEALS-37526 (#20453) * "updates COPY and fixes some linting issues" * "updates COPY and moves sectiontitles to constantsjs" * "removes linting changes from reducer" * Amycommits/appeals 37767 (#20465) * APPEALS-37767 initial load works * APPEALS-37767 refactored how the admin permissions are stored * APPEALS-37767 updated exclusion table to use admin variable from redux * APPEALS-37767 cleaned up the usage of isAdmin * APPEALS-37767 fixed some linting issues * APPEALS-37767 removed the sectionTitle from the content page * APPEALS-37558 Refactor: Redux Confirm Save (#20452) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * Update case_distribution_audit_lever_entry_serializer_spec.rb * Update case_distribution_levers_controller.rb * rename route and method to update_levers * move lever updating logic into the model * priority distributions comment and affinity days case generation * Create case_distribution_lever_spec.rb * Update case_distribution_levers_controller.rb * Update case_distribution_levers_controller_spec.rb * move data_types constants into an object in ACD_LEVERS * Update case_distribution_lever.rb * Add validation for data_types * case_distribution_lever_spec * linter errors * remove passing around sectionTitles * move algorithm and lever_group strings into ACD_LEVERS * Update DocketTimeGoals.jsx * Update LeverSaveButton.jsx * Update leversSelector.js * create new actions * create individual actions for each data type * use new action in DocketTImeGoals * create SaveModal file * clean up around the different data type updates * show changed levers * show changed levers * Save works and success banner displays * cleanup and account for multiple levers being changed * error banner display * batch size saves * clean up Affinity Days and ensure order * Ensure BatchSize order * Fix DocketTimeGoals ordering * clear errors out when hiding banner * more cleanup * props cleanup * clean up from feature branch merge * linting errors * APPEALS-37558: Refactor: Redux Confirm Save (#20490) * Update ExclusionTable.jsx * update levers after save * update history and audit table to show css_id * Update leversReducer.js * APPEALS-37558 (#20498) * Fix error banner not displaying * Update case_distribution_levers_controller.rb * mbeard/APPEALS-37559 (#20494) * "updates lever cancel function" * "final updates to cancel button, updates controller" * "updated routes, method, and function" * "Unit test for cancel button" * "removed comments from test" * Amycommits/appeals 37508 (#20503) * APPEALS-37508 validation works * APPEALS-37508 added a check for lever errors to the save button. * APPEALS-37508 cleaned up some of the validation functions * github test (#20491) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers --------- Co-authored-by: Christopher Detlef <> * Chrisbdetlef/appeals 37692 (#20512) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers * Add constants and custom html for capybara tests --------- Co-authored-by: Christopher Detlef <> * APPEALS-37558 Fix issues found during QA testing (#20511) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * APPEALS-37558 Prevent bad audit entries (#20522) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * prevent invalid lever changes from getting audit entries * Update case_distribution_lever_spec.rb * APPEALS-37508 redoing the seeds (#20531) * Sharsha/appeals 37511 2 (#20521) * APPEALS-37511. ExclusionTable scss refactor * APPEALS-37511. Static levers scss refactor * APPEALS-37511. Lever History refactor scss * sharsha/APPEALS-37511. linting fixes * APPEALS-37511. Refactor Interactable Levers scss * APPEALS-37511. fix cancel and save button styling * APPEALS-37511. fixes * APPEALS-37511. Lint fixes * APPEALS-37511. updated the mock to use the updated scss files * APPEALS-37511. LeverButtonsWrapper css cleanup * APPEALS-37511. Exclusion table header styling --------- Co-authored-by: SHarshain * Demo VLJ and AVLJ users updates (#20540) * and _AVLJ to AVLJ names * Update case_distribution_test_data.rb * APPEALS-38398 Disabled levers are still showing focus on Admin UI (#20559) * disable tabbing to disable inputs * clean up ToggleSwitch css * Update _toggle_switch.scss * move import * Update _toggle_switch.scss * Update ToggleSwitch.jsx * Update _toggle_switch.scss * test that props are being passed in correctly * Ricky/appeals-37871 (#20534) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data --------- Co-authored-by: Matt Roth * add disabled to other NumberFields (#20564) * mbeard/APPEALS-38541 (#20553) * "makes too_many_cases error dynamic" * "updates controller method to be dynamic" * sharsha/APPEALS-37511_3. Added 30px right padding for table header (#20562) Co-authored-by: SHarshain * APPEALS-37525 Refactor ACD Levers Test Page (#20535) * APPEALS-37525 Refactor ACD Levers Test Page * Change Test Page to React component * Use lever history serializer in controller * Add all current attributes to the Lever Table * Add more attributes to Lever History Table * Update links from ruby to React * APPEALS-37525 moved the lever_history to the model because it's being… (#20538) * APPEALS-37525 moved the lever_history to the model because it's being used in multiple places * APPEALS-37525 changed the options to only display values * Fix unit test --------- Co-authored-by: Christopher Detlef <> * Fix Option Values column * DRY out the history unit test --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-37794 (#20532) * "updates copy issue and radiofield" * "updates accessibility labels" * "attempt to update label" * "updates accessibility vioce over" * "moves logic from radiofield to exclusiontable" * "Updated fixes from comments" * "removes last thing from TextField component" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-37832. Test data seed spec for case distribution (#20561) * APPEALS-37832. Test data seed spec for case distribution * APPEALS-37832. more changes * APPEALS-37832. Added CaseDistributionlevers count --------- Co-authored-by: SHarshain * Ricky/appeals-37556 (#20502) * Updated LeverHistory component, formatting and storage in redux * Updated Jest testing for LeverHistory * Code cleanup and address comments. Reverted save_levers changes * Feature test outline and class names added * Updated feature tests * Fixed linting error with SaveModal * Updated testing for LeverHistory and fixed css id from showing * Created individual lever history action, updated reducer, updated testing * Removed unneeded data in jest test * Cleaned up formatTimestamp function --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-38556 (#20574) * Initial testing for BatchSize and lever data for testing. * Updated BatchSize Testing and additional testing data. * Updated tests to get full testing coverage * APPEALS-37508 resetting the errors when the cancel button is clicked (#20589) * APPEALS-37511. Fix exclusion table member view (#20595) Co-authored-by: SHarshain * Ricky/appeals-37871 (#20596) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data * Updated spacing between value and unit for static lever, updated testing * Updated static lever to separate value and unit using css --------- Co-authored-by: Matt Roth * APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613) Co-authored-by: SHarshain * APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614) Co-authored-by: SHarshain * APPEALS-38570. Improve the test coverage (#20584) * APPEALS-38570. Improve the test coverage * APPEALS-38570. Dead code cleanup * APPEALS-38570. test coverage to address the exception --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38764 Add Batch Size Lever feautre tests (#20618) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-38561 (#20622) * "initial commit, adds test and save button export" * "adds leversavebutton unit test" * APPEALS-38789 Added error message validation to feature test for Docket Goals (#20625) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * fix merge conflict error * APPEALS-38787 Add Affinity Days levers feature tests (#20619) Co-authored-by: Christopher Detlef <> * APPEALS-38903 Add Inactive Data Elements lever feature tests (#20621) Co-authored-by: Christopher Detlef <> * APPEALS-38555. Affinity Days jest test (#20633) Co-authored-by: SHarshain * Ricky/appeals-38557 (#20634) * Began work on DocketTimeGoal testing, updated toSorted to sort * Updated unit tests to improve coverage on DocketTimeGoals * Updated unit tests to begin working on testing toggleLever * rebuild PR (#20617) * rebuild PR * Update LeverHistory.jsx * Cleaned up DocketTimeGoals test --------- Co-authored-by: Matt Roth * APPEALS-38904 Add Feature Test for Audit Lever History (#20637) * Initial pass * APPEALS-38904 Add Feature Test for Audit Lever History --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * mbeard/APPEALS-38558 (#20630) * "initial commit, created test, updated wrapper" * "adds test cases for save and cancel buttons" * "updates revertLevers to resetLevers for clarity" * "removes problematic test case" --------- Co-authored-by: Matt Roth * APPEALS-38526. 100% test coverage for Case distribution test data seed (#20638) * APPEALS-38526. 100% test coverage for Case distribution test data seed * APPEALS-38526. Fix the typo * APPEALS-38526. Fix the typo in class and related spec --------- Co-authored-by: SHarshain * Ricky/appeals-38567 (#20642) * Updated caseDistributionApp test file and added additional test lever data * Updated test for CaseDistributionApp * Updated rootreducer test for full coverage (#20653) * APPEALS-38555. Added the test coverage to verify the text input (#20654) Co-authored-by: SHarshain * Update to audit lever history time entries to display leading 0s for hours, minutes, and seconds (#20652) * APPEALS-38558 amended test to cover the remaining thee lines of code (#20643) * APPEALS-38790 Add Lever Button feature tests (#20662) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-39284 (#20663) * "initial commit with updates controller, actions, reducer" * "updates leversActions error message" * "updates case dist levers controller spec" * "removes redundant line from update_levers method" * pull changes from hotfix branch (#20667) * APPEALS-38542 got rid of code that is not being used (#20673) * APPEALS-38542 got rid of code that is not being used * APPEALS-38542. Remove unused constant from actions list * APPEALS-38542. remove deadcode spec --------- Co-authored-by: SHarshain * APPEALS-38562./ Removes the unused component (#20697) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "Created jest for leversactions" (#20701) * Chrisbdetlef/appeals 38966 (#20700) * APPEALS-38966 Add dynamic * generation for lever labels/titles * Remove file * Refactor to use a single utility method --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * Ricky/appeals-38569 (#20681) * Pushed changes to LeversReducer Test * Updated unit tests for additional coverage * Pushed up changes to have eyes on async tests * Pulled in Amy's changes and moved data to adminCaseDistributionLevers * Updated test data naming for mocks and tests * Updated testing to fix issues and improve coverage * Updated unit tests, added comments on unfinished work * APPEALS-38569 updated the reducer to give the expected information in the jest tests --------- Co-authored-by: 631966 * mbeard/APPEALS-37794 (#20685) * APPEALS-37794 made changes to the shared number and text components so that we have more control over what the aria-label is * "Updates arialabeltext for batchsize, jests for batchsize and docket time goals" * "updates admin jest aria text query" --------- Co-authored-by: 631966 * revert changes that are causing the Unable to load banner to appear to quick (#20712) * APPEALS-32252 fixed a few rspec tests (#20738) * added the judge list all and attorney list all to help with caching issues * APPEALS-39893 CaseDistributionLever swap over to method_missing (#20744) * remove find_float and find_float, swap to method_missing * codeclimate updates * Update case_distribution_lever.rb * Update case_distribution_lever.rb * APPEALS-39660 Correct ACD Lever Seeds (#20747) Co-authored-by: Christopher Detlef <> * APPEALS-39889 CodeClimate issues (#20740) * move to story branch * Update .codeclimate.yml * pull in dev-support/APPEALS-39031 * Update case_distribution_lever.rb * Update .codeclimate.yml * disable DataClump for db seeds * lint fixes * Update affinity_days_levers_spec.rb * Update case_distribution_lever.rb * Update .codeclimate.yml * pull over other changes * Update case_distribution_lever.rb * Update case_distribution_lever.rb * fix codeclimate issues * fix more issues * rubocop auto fixes * Update test.jsx * mbeard/APPEALS-39895 (#20746) * "updates value in test method and adds new contexts" * "put everything back" * "updates seed value for Dockt weight" * "verifies seed data is correct" (#20754) * APPEALS-39897. Ambiguous id match removed from the component and matched the parent css element (#20745) * APPEALS-39897. Ambiguous id match removed from the component and matched to parent css element * APPEALS-39897. Refactored spec * APPEALS-39897. rubocop fixes * APPEALS-39897. Lint fix --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update leversActions.js (#20760) * APPEALS-39899. Spec fix (#20758) Co-authored-by: SHarshain * revert and move new code to correct file (#20766) * APPEALS-39889 Code Climate issues part 2 (#20759) * swap over to using USWDS colors * more rubocop fixes * add extra lines, remove spaces * Update affinity_days_levers_spec.rb * cleanup unit tests * Update audit_lever_history_table_spec.rb * Update inactive_data_elements_levers_spec.rb * Update _interactable_levers.scss * refactor duplicate code * Update _lever_history.scss * Update affinity_days_levers_spec.rb --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-39984 Update test to match css fix (#20768) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40085 Update ACD lever count (#20769) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40092. Fix negative rspec matcher (#20772) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "fixed spelling and updated spec to include two new users" (#20777) Co-authored-by: Matt Roth * mbeard/APPEALS-38563 (#20577) * "creates savemodal test by adding save button" * "updates and deleted and recreated file" * "latest update to mockstore" * "adds export to save button and updates test" * "current updaates to the test" * "Updates the confirm button to mock confirm button" * Updated testing data and SaveModal tests * "updates logic in utils and updates test" * "adds changedLevers constant mocked data and renders corrrectly" * "adds affinity days to test, and close modal" * "updates test data, adds new cases, adds ids to table" --------- Co-authored-by: 631068 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: 631966 * APPEALS-40134. Add missing traits in factories (#20789) Co-authored-by: SHarshain * APPEALS-40131. Fix case_distribution_levers seed spec (#20786) Co-authored-by: SHarshain * APPEALS-39980. Mock the value in the spec (#20784) Co-authored-by: SHarshain * "updates control group and rsec to never recieve tasks" (#20790) * Updated constants from by docket date to static docket date (#20796) * APPEALS-39892 Unit test fixes (#20798) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * merge issue * Update case_docket.rb (#20782) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * ricky/APPEALS-40090 (#20803) * APPEALS-39892 fixed one file for rubocop issues * Updated jest unit tests to fix issues * Updated leversReducer unit tests * Added export back to LeverSaveButton --------- Co-authored-by: 631966 * APPEALS-39892 Unit tests fixes (#20810) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update case_docket.rb * APPEALS-39987 updated failing snapshots (#20751) * Updated jest config to ignore test.jsx files (#20826) * APPEALS-40136 Bring test data back into range of displayed data (#20824) Co-authored-by: Christopher Detlef <> * Updated By Docket Date to Docket Date (#20827) * APPEALS-39899. docket_coordinator_spec fix (#20829) Co-authored-by: SHarshain * APPEALS-39980. Fix the timestamp failure in the spec (#20836) Co-authored-by: SHarshain * move to new feature branch (#20889) * move to new feature branch (#20890) * APPEALS-38967 Update Implementation of Affinity Days in Admin UI (#20656) * bring over fix for ordering * suggested change * Create 20240130152058_update_case_distribution_levers_is_toggle_active.rb * Update schema.rb * Updates to enable levers that are being tested and for null values in is_toggle_active for n/a levers * Update test.jsx * Update test.jsx * updates for Combination levers, missing updates to allow saving of them * Save combination levers * Update SaveModal.jsx * swap over to methods focused on updating a specific attribute of a lever * change radio to not have value in value * for radio levers set selectedOption when loading levers * Update case_distribution_lever.rb * Update AffinityDays.jsx * Update case_distribution_lever.rb * updates to account for is_toggle_active being nullable * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * fix validation error messages, Radio levers update redux store correctly * changing radio enables Save and displays in Save Modal correctly * fix max values to be 999 * Can save Radio levers successfully * history entries match frontend * Update AffinityDays.jsx * cleanup and comments * Update case_distribution_lever.rb * Update LeverHistory.jsx * Revert "Update LeverHistory.jsx" This reverts commit 6eca84730cac808e5d25b467d370dd21a34013d1. * APPEALS-26750 auto_texts was created as a part of master * Update case_distribution_lever.rb (#20946) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38967 Remove units showing when not needed (#20975) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: 631966 * APPEALS-38744 Update AMA Hearing Case Affinity Days Lever (#20956) * APPEALS-38744 added checks for ama hearing case affinity days lever * APPEALS-38744 refactored logic for ama hearing case affinity days lever * APPEALS-38744 update method name * APPEALS-41456 made changes to the affinity days test data and jest tests to conform to new data changes (#20991) * Tmr/appeals 38967 4 (#21034) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: Matthew Roth * Ricky/appeals-35179 (#20988) * "adds ama aod original appeals method to scopes" * "adds conditional to only_genpop_appeals" * "removes unnecessary copied code" * "adds comment" * "Updates to formatting for shovel methods" * "updates conditional to include correct function, changes scope chain" * "Updates and adds scope for infinite, test passes" * "adds infinite method to scopes" * "created new test scenarios" * "moves line up" * "updates distribution scope methods" * "updates methods" * "updates rspec to update attribute" * "updates def and values" * "updates rspec to new methods" --------- Co-authored-by: Michael Beard * APPEALS-38967 made sure that the lever history displays properly (#21041) * APPEALS-37024 Create Seeds For ACD Demo (#21038) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-38744 (#21039) * "init commit for updating not_genpop_appeals" * "adds new context and updates top ama" * "updates methods on scopes, adds new appeals, updates specs" * Updated logic and rspec tests * APPEALS-38744 rearranged the not_genpop_appeals to only run the not_genpop_appeals query once * APPEALS-38744 took out puts * APPEALS-38744 the queries work through binding.pry the tests are failing due to setup issues * APPEALS-38744 update with new pattern * APPEALS-38744 added a conditional to make affinity days chained correctly * APPEALS-38744 more fiddling * Fix code issues for query structures * Make returns uniformly arrays of arrays * flagged error * "updates hearing docket method to if else" * "fixes ish respecs adding with_no_held_hearings to the array" * "cleanup brush brush brush" --------- Co-authored-by: 631068 Co-authored-by: 631966 Co-authored-by: Christopher Detlef <> * APPEALS-42090 Add newly enabled levers to capybara test (#21117) Co-authored-by: Christopher Detlef <> * APPEALS-26750 updating the kepler feature with the combined branch so that there isn't 200 changed files * mbeard/APPEALS-42093 (#21114) * "updates jest to reflect code changes and updates selector logic" * "updates savemodal jest" * "Updates leversActions test, removes redundancies" * "Updates infinite, omit, and updated value tests" * APPEALS-42010 Rework affinity lever tests (#21079) * APPEALS-42010 fix rspecs * APPEALS-42010 update specs and address pr suggestions --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Ricky/appeals-42088 (#21126) * Updated seed data * Updated seed data for days_before_goal_due_for_distribution lever * Reworked solution and renamed lever to be correct * Updated tests (#21135) * Feature/appeals 26750 revert affinity (#21137) * APPEALS-26750 commenting out method that was failing in seeds * APPEALS-26750 added logic for unique veteran too * APPEALS-26750 updating the seeds to get the params properly * APPEALS-26750 enabled the call to create_case_ready_for_more_than_hearing_affinity_days(judge) * increase the number of digits in the css_id sequence (#21139) * increase the number of digits in the css_id sequence * modify generated CSS_IDs and sequence to shorten to 12 characters * ensures that the veteran id is unique, even though it always ought to be unique (#21143) * Fixed errors caused by rounding issues in rspec (#21148) * Chrisbdetlef/appeals 35179 post rewrite (#21169) * factory updates, new file created, some tests written * finished genpop_priority_count * add limit appeals class methods tests * framework and some tests for distribute_appeals * added tests for hearing aod lever * add ineligible and excluded judge tests * fix issues with aod test setup * add second test for changing numeric values * APPEALS-35179 Fix code after rspec test corrections * Rework of scopes * Tests and code are fixed * Still need to add CAVC tests * Extra code in scopes needs to be cleaned up * add last spec * fix cavc test * fix base relation cavc stuff * Refactor and prune code to improve readability * remove comments * Added new test and code fix * Remove comments * add hearings not tied to any judge to only genpop call * removed is_toggle_active spec test as its no longer needed * remove compact from hearing case distributor, add comments to failing specs, fix spec data setup * modify query, tests passing * deletes old hearings docket rspec and renames the rewrite * change magic strings to existing constants, rename method, restore seed file logging * fix issue in hrdq, update magic strings in test file --------- Co-authored-by: Craig Reese Co-authored-by: Christopher Detlef <> Co-authored-by: Calvin * mbeard/APPEALS-42094 (#21141) * "cleaned up linter issues" * "updates dist scopes" * "all linting error fixes for dockets and specs" * "adds missing end to context" * "fixes all spacing issues and alignment" * "put it all back, disable rubocop for trouble lines" * "last linting issue" * "disables double quote linter issue" * "adds ._to_s back to case distro lever" * "removed linter disable comments and updated code to remove linter issues" * "fixes spacing and alignment linting issues" * APPEALS-37024 Fix Demo Seed Data (#21221) * APPEALS-37024 Fix Demo Seed Data * APPEALS-37024 disable appeals that were made as the core seeds --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 --------- Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: 631068 Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> Co-authored-by: Matt Roth Co-authored-by: Alexander Smith Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: Michael Beard Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> Co-authored-by: Craig Reese Co-authored-by: Calvin * Added a status to the BVAAppealStatus class to reflect an appeal that has been distributed to the SpecialtyCaseTeam queue, but has no yet been assigned to an attorney. (#21222) * Feature/appeals 26750 kepler (#21234) * Add toggle switch component (#19794) * Add toggle switch component * Added toggle fuctions for ON,OFF and Disable states * Clean up --------- Co-authored-by: SHarshain * * Refactor Lever Reducer (#19816) * Add Lever Reducer test Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> * adds staticlever, test, story components to caseflow distribution (#19818) * Lint Fix for toggle (#19817) * Lint Fix for toggle * Add actions to the toggle --------- Co-authored-by: SHarshain * APPEALS-32391 implemented the static levers wrapper (#19838) * APPEALS-32412 Add Save and Cancel Lever Buttons (#19844) * Add Lever Buttons * Add Lever Buttons wrapper * Add Lever Buttons story and test * Update Lever Reducer to no longer use lodash * Update test data * Add comments for future funtionality Co-authored-by: Christopher Detlef <> * Sharsha/appeals 32338 (#19772) * fix the syntax in test data * added new line EOF to fix parse error * added AdminTabs story to access the InteractableLever * WIP: nested and toggle. Completed Boolean and field component scenarios * Uppercase the unit to match the wireframe * WIP * Removed the new line * refactor and move the Scenarios into seperate component * updated the test data levers * fixed Id violation * fix indentation * match with the feature branch * add styling for the headers and fixed Header violation * code cleanup * Add the label for number * refactor * Move the components into a seperate stories, added reducers, additional filters to the lever list --------- Co-authored-by: SHarshain * * Add styling to save adn cancel buttons (#19848) * Add functions and function shells for save and cancel buttons Co-authored-by: Christopher Detlef <> * ricky/Appeals-32388 (#19829) * Created Distribution Content Area and updated history for implementation. * Created Distribution Content Area and updated history for implementation. * Updated test data and static lever implementation. * Static lever and lever history updates, declared text constants * Fixed and implementated Static Levers, Updated styling and storybook * Fixed and added buttons, fixes for static lever wrapper, updated history. * Implemented interactive levers, updated test data, created jest test * Updated data for disabled states * APPEALS-32388 made changes to the affinity days so that the default s… (#19851) * APPEALS-32388 made changes to the affinity days so that the default selected option is shown and the text box is always shown * APPEALS-32388 used a ternary statement to make the radio button always display the expected selected value * Added Exclusion Table, added notes, jest test, styling * Test Data Fix for history --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update Lever Reducer tests (#19860) * Make tests more robust Co-authored-by: Christopher Detlef <> * error validation for the Number Field and Accessibility violations fix (#19855) * error validation for the Number Field and Accessibility violations fix * Altered the validation message on affinity days component * added test cases for AffinityDays, BatchSize and DocketTimeGoals components * Added Dom ID element for the toggle * fix the lint errors in the component --------- Co-authored-by: SHarshain * Appeals-32140. Added Database table to store ACD lever information (#19889) Co-authored-by: SHarshain * Created case distribution audit lever entries (#19893) Co-authored-by: SHarshain * mbeard/APPEALS-34066 (#19891) * adds case_distribution_lever.rb file * removes id column from model * removes migration files * APPEALS-34066 re-added the case distribution levers migration --------- Co-authored-by: 631966 * adds model for case distribution audit levers (#19900) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file (#19898) * adds modal to case dist contect, adds COPY, moves save button to modal, updates leverbuttons (#19919) * APPEALS-32253. Seeding the case distribution levers table (#19906) * APPEALS-32253. Seeding the case distribution levers table * APPEALS-32253. Updated the levers data according the requirements * updated some values in the case distribution levers. * conditional model validation for new lever object and cleanup --------- Co-authored-by: SHarshain Co-authored-by: 631966 * Second draft (#19922) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * Ricky/APPEALS-33936 (#19918) * Moved Caseflow Distribution work to new directory, fixed imports, created CaseflowDistributionApp file * Removed AdminTabs, and AffinityDays, BatchSize updates. * Caseflow Distribution cleanup and Implementing LeversWrapper. * Component and CSS Updates * Updated stories and styling * More styling formatting and moved scss files. * Further CSS Updates and clean up * Updated Tests, and Test Data --------- Co-authored-by: 631966 * Chrisbdetlef/appeals 34018 (#19954) * Second draft * APPEALS-34018 Create CDLever Controller and Routing --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-34347 (#19952) * adds levermodal update * adds levermodal story, adds return state in table * updates logic to parse/compare json, styling, story * Updated modal styling * adds jest test for levermodal * Updated LeverModal Test --------- Co-authored-by: 631068 * Chrisbdetlef/appeals 34018 (#19971) * APPEALS-34018 Create CDLever Controller and Routing * Second draft * APPEALS-34018 Add alpha of Lever page and update controller spec --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-34344 (#20036) * Passed props from backend to frontend, fixed index and CaseflowDistributionApp * Connected frontend and backend, corrected page styling * APPEALS-35221. Updated the lever titles (#20051) Co-authored-by: SHarshain * APPEALS-32139 Add Case Distribution Admin Control Group Organization (#20019) * APPEALS-32139 Add Case Distribution Admin Control Group Organization * APPEALS-35161 Add test page for case distribution levers --------- Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348 (#20000) * updates save button comparison functionality * updates functionality plus troubleshooting * updates save button, leevrreducer, batchsize, adds logic to confirm button * updates logic for redundancy in wrapper, and adds new logic to affinitydays * updates logic to fix radio buttons --------- Co-authored-by: 631966 * Remove development test code from controller (#20071) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Add more funtionality to the acd lever test page (#20084) Co-authored-by: Christopher Detlef <> * APPEALS-35161 Lever user functionality and test page (#20093) Co-authored-by: Christopher Detlef <> * ricky/APPEALS-33558 (#20087) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * APPEALS-36197. Adjust the seeds for access to levers (#20116) * APPEALS-36197. Adjust the seeds for access to levers * APPEALS-36197. Revert ama_evidence_submission and fix ama_direct_review --------- Co-authored-by: SHarshain * Refine how authorization for levers works (#20097) Co-authored-by: Christopher Detlef <> * Bug Fixes for Lever Controller and Spec (#20123) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-34348.2 (#20106) * updates levermodal route and data * verifies save button functionality and saves to db * APPEALS-36197. Enable request_more_cases_minimum lever (#20124) Co-authored-by: SHarshain * mbeard/APPEALS-34346 (#20094) * adds success banner when confirm is clicked * updates styling for interactablelevers * changes position to fixed * adds new leveralertbanner component * updates styling for new component * updates alert styling * adds new listener for banner * updates all styling, levermodal functions, casedistcontent componenet, leverreducer * APPEALS-34353. Utilize the values from levers (#20056) * APPEALS-34353. Utilize the values from levers * APPEALS-34353. fix the typecast and load the date from seed in rspecs * APPEALS-34353- Spec fixes * APPEALS-34353. Cavc affinity days spec fix and case distribution levers controller count fix * revert the changes as Chris has a different to handle the omit * APPEALS-34353. Import the count json * sharsha/APPEALS-34353. Fix --------- Co-authored-by: SHarshain * updates levermodal and banner, fixes reducer (#20160) * Ricky/appeals-35515 (#20161) * Refactored Docket Time Goals to include 2 levers, updated stories, and seeds * Fixed Unprocessable Entity Error and refactored error generation * APPEALS-35822 Rename CDA Group Organization (#20125) Co-authored-by: Christopher Detlef <> * APPEALS-36172 added the new route (#20173) * APPEALS-36172 added the new route * APPEALS-36172 the test routes should only be available in certain environments as well * Updated text values in seeds and case distribution page. (#20180) * APPEALS-35731 Refine Lever Combination and Radio buttons (#20164) Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * took out seeds from merge conflict with master whose files don't exist * updated the pathe for the lever attributes constants" * Revert "Updated text values in seeds and case distribution page. (#20180)" This reverts commit 88ade0aec60bdcf53d92f7e6a06dd7d7d866b24d. * last known working feature commit * APPEALS-34353. fixed controller specs (#20217) Co-authored-by: SHarshain * mbeard/APPEALS-35726.3 (#20202) * initiates affinity days updates * updates seeds file for affinity levers * updates logic for affinitydays, reducer * updates affinitydays, levermodal, levers.rb * updates modal * fixes affinitydays issues, updates levermodal display * Updated text values in seeds and case distribution page. (#20224) * Ricky/appeals-33558 (#20223) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * APPEALS-36174 Add options display to test page table (#20232) Co-authored-by: Christopher Detlef <> * APPEALS-34224 Controller and Reducer Updates (#20237) Co-authored-by: Christopher Detlef <> * APPEALS-34353. Fixes for Docket spec (#20241) Co-authored-by: SHarshain * Mbeard/appeals 34346.4 (#20239) * updates reducer, modal, actiontypes, index * APPEALS-34346 this should be the reducer * APPEALS-34346 banner is showing in the right location in the app * updates bannerdisplay, leveralertbanner, levermodal, and index.js files --------- Co-authored-by: 631966 * Updated seeds to disable distribution prior and select time goal levers (#20251) * APPEALS-35822 took the group out of the name (#20265) * mbeard/APPEALS-35565 (#20263) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * Ricky/appeals-33558 (#20271) * Created Member View Page for Case Distribution * Fixed issues and merge conflicts * Removed extra header tag * Updated Memberview CSS to match wireframe * Further update styling to match wireframes and connected styling to timeGoals * Fixed affinity days to display proper units on member view, fixed minor code smells * Ricky/appeals-36733-updated (#20261) * Updated seeds to disable distribution prior and select time goal levers * Updated Exclusion Table to correct labeling * Ricky/appeals-34224-controller-changes (#20274) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * APPEALS-37186 took out the success banner from the lever modal (#20283) * Ricky/appeals-34224 (#20289) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history --------- Co-authored-by: 631966 * Amycommits/appeals 37248 (#20310) * fixed linting errors * APPEALS-37248 progress on the lint errors * APPEALS-37248 took out custom lint fix command * mbeard/APPEALS-36896 (#20293) * updates reducer, modal, actiontypes, index * fixes words and ads asterisks * removes one asterisk * fixes margin * updates scss padding --------- Co-authored-by: 631966 * Ricky/appeals-34350-Error-and-Validation-Handling (#20288) * Updated LeverModal button and reducer to fix error handling * Implemented new error handling in DocketTimeGoals and BatchSize Lever groups * Updated error handling for lever inputs for affinity days * Fixed incorrect check and messages in CheckIsInRange function * Added first part of input validation for duplicate values * Removed leftover code * Updated logic to handle save button enabling if duplicate values are put in fields --------- Co-authored-by: 631966 * Ricky/appeals-34224 (#20316) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631966 * mbeard/APPEALS-36175 (#20285) * updates reducer, modal, actiontypes, index * updates numberfield and textfields * updates styling to improve accessibility * updates styling to improve accessibility * adds url to controller * updates erb files * updates controller * APPEALS-36175 took out extraneous code in the lever modal * updates controller dropdowm menu --------- Co-authored-by: 631966 * Amycommits/appeals 37286 (#20322) * Ricky/appeals 34224 (#20321) * Created functions to handle history generation * WIP fixing the history db entry on save * Set up lever history component to not error on newly sent data. * Updated to display correct data on main page * Commented out code that created bug displaying wrong units for affinity days lever history * Updated formatting of time in lever history * Added initial key seeding to update --------- Co-authored-by: 631068 * reverted changes to the caseflow distribution content page that were causing an error * reverted changes to the caseflow distribution content page that were causing an error --------- Co-authored-by: 631068 * APPEALS-36334 Seed Data for ACD Lever Testing (#20317) * APPEALS-36334 Seed Data for ACD Lever Testing * For testing * Re-add lever test seed data --------- Co-authored-by: Christopher Detlef <> * APPEALS-37279 reverted code changes based on feedback (#20318) * APPEALS-37279 reverted code changes based on feedback * APPEALS-37279. revert the api_status_alert lever item --------- Co-authored-by: SHarshain * APPEALS-34623. Created DB table and logged the data to acd-controls t… (#20193) * APPEALS-34623. Created DB table and logged the data to acd-controls test page * APPEALS-34623. Added model associations and spec * sharsha/APPEALS-34623. revert changes in schema to match the feature branch --------- Co-authored-by: SHarshain * APPEALS-37314 fixes X functionality (#20339) * APPEALS-37227. Sort the levers (#20319) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-37290. Refactor (#20340) * APPEALS-37290. Refactor * APPEALS-37290. Updated the integer and float levers and some refactor --------- Co-authored-by: SHarshain Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> * APPEALS-36550 Queries for User Testing (#20311) * APPEALS-36550 set up the link so that a query can be downloaded as a CSV on the test page * APPEALS-36550 built out the link with the appropriate routes, and started the appeals ready for distribution query * Add dashboard to test/users Miscellaneous tab * Add navigation links * Update test.html.erb * get appeals ready for distribution for each docket * extract works * Update appeals_ready_for_distribution.rb * legacy appeals ready to distribute done * Update appeals_ready_for_distribution.rb * all ama distributed appeals * distributed legacy appeals * comments --------- Co-authored-by: 631966 * APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373) Co-authored-by: SHarshain Co-authored-by: Matt Roth * APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374) Co-authored-by: SHarshain * added lever_group column and updated seeds files (#20379) * mbeard/APPEALS-37248 (#20364) * corrects scss linting issues * updates scss linting issues * fixes linting issues in scss * fixes almost all linting issues * fixes furhter linting issues * updates linter styling issues * updates leverhistory linting issues * fixes scss linting issues * fixes disappearing save button * "updates styling for linting issues" * "updates styling and fixes leverhistory" * "final edits to styling" * "final final" * adds utiljs and imports function * "updates dockettimegoals" * renaming scss * fixes style issues * "fixes app/styles" --------- Co-authored-by: Matt Roth * Tmr/appeals 32252 refactor (#20376) * remove redundant checks and move url addition to within existing checks * Update case_distribution_levers_controller.rb * linting fixes * Update push_priority_appeals_to_judges_job.rb * Update push_priority_appeals_to_judges_job_spec.rb * Remove CaseDistributionAlgorithmLog * rubocop * Update routes.rb * Update seeds.rb * Update docket_coordinator_spec.rb * Update schema.rb * fix typos * Update application_controller.rb * move unit tests to client/test/ to match project standards * remove storybook files * revert unrelated changes to schema * Delete ToggleSwitch.stories.js * mbeard/APPEALS-36896 (#20391) * "fixes copy" * "updates COPY titles" * "TYPO" * APPEALS-36381 Replace ACD Lever variables with constants (#20398) Co-authored-by: Christopher Detlef <> * APPEALS-37582: Refactor: Audit table cleanup (#20403) * cleanup audit table * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * Update schema.rb * remove old fields * Update 20240103134452_update_case_distribution_audit_lever_entry.rb * add seed data * prop type validations * Adjust history rendering to account for new database table setup * unit test and remove console logs * update serializer to pass along lever fields for audit entries * Hun jer bah/appeals 32252 redux refactor (#20365) * created root reducer and refactored actions list * swapped Contants for ACTIONS * created place holder lever actions * created proof of concept action for redux store. * fixed action * fixed naming convention * created action to update affinity days * Fix Misc. Controller Linting Issues * created test route to load lever info in full * set up loadLever action to pull add data from new temp controller route * added lever grouping to controller * passed down organized levers to child components * rolled back schema before merging feature in * fixed merge conflict * Update application_controller.rb * cleaned up code for handoff to Kepler team * removed leftover comment * removed ApiUtil method of passing values and used index.html.erb * set up BatchSize to use hooks from store * cleaned up BatchSize props * updated docket time goals and affininty days (pass values to affinity day levers only) * Fix Misc. Issues - Fix levers not loading in BatchSize by moving loading logic to parent component constructor vs. running on component mount. - Fix DB migration issue with not-null column lacking a default. * Remove merge markers * cleaned up old use effects * Update case_distribution_levers_controller.rb * remove loadLevers from PropTypes * add initial state of levers to new store * Update InteractableLeversWrapper.jsx * update to use new store and refactor work * remove passing around of loadedLevers * Update BatchSize.jsx * cleanup --------- Co-authored-by: Alexander Smith Co-authored-by: Matthew Roth * APPEALS-37505: Create Case Distro Algorithm Control users in Demo (#20401) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * revert changes unrelated to work * Update case_distribution_levers_controller_spec.rb * APPEALS-37554 Refactor: Redux Load Levers: Fixes (#20422) * rename folder * rename folder * rename redux properties * fix dashboard * Rename from CaseflowDistribution to CaseDistribution (#20428) * move from caseflowDistribution to caseDistribution * update import statements * rename page * cleanup text strings * remaining instances of CaseflowDistribution * rename reducers/Levers to reducers/levers * pull updates in * rename Levers to levers * bad or missing imports * cleanup unused variable and imports * Update users.rb * Update users.rb * APPEALS-37582 Test Data page swap to css_id for Audit Entries table (#20436) * Update test.html.erb * rename files to match their functional components * Amycommits/appeals 37719 (#20444) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37719 fixed some of the linting and typos * APPEALS-37720 changed the variables in the reducer (#20445) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * Amycommits/appeals 37719.appeals 37720.appeals 37692 (#20446) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37692 fixed linting error * PPEALS-37692 merged the feature branch back in * Serializer was named incorrectly, renaming to match class and database table name (#20451) * Fix mispelled file name * fixed linting errors and warnings * APPEALS-37558 restructured the levers to store the backend lever valu… (#20447) * APPEALS-37719 added a migration to change the column names to be more specific, and changed everywhere in the code that had references to the old names. * made changes to the seed data so that the migration would run * amycommits/APPEALS-37719 * APPEALS-37720 changed the variables in the reducer * APPEALS-37692 started to convert DockettimeGoal * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 progress made in refactoring the update lever * APPEALS-37692 converted Docket time goals to update the lever and use a selector. There is still some code cleanup that needs to be done. * APPEALS-37558 restructured the levers to store the backend lever value and keep tabs of the actual value change. * mbeard/APPEALS-37526 (#20453) * "updates COPY and fixes some linting issues" * "updates COPY and moves sectiontitles to constantsjs" * "removes linting changes from reducer" * Amycommits/appeals 37767 (#20465) * APPEALS-37767 initial load works * APPEALS-37767 refactored how the admin permissions are stored * APPEALS-37767 updated exclusion table to use admin variable from redux * APPEALS-37767 cleaned up the usage of isAdmin * APPEALS-37767 fixed some linting issues * APPEALS-37767 removed the sectionTitle from the content page * APPEALS-37558 Refactor: Redux Confirm Save (#20452) * add demo users * move methods to under private * Update case_distribution_levers_controller_spec.rb * clean up post method * add requested users to CDA * Update case_distribution_audit_lever_entry_serializer_spec.rb * Update case_distribution_levers_controller.rb * rename route and method to update_levers * move lever updating logic into the model * priority distributions comment and affinity days case generation * Create case_distribution_lever_spec.rb * Update case_distribution_levers_controller.rb * Update case_distribution_levers_controller_spec.rb * move data_types constants into an object in ACD_LEVERS * Update case_distribution_lever.rb * Add validation for data_types * case_distribution_lever_spec * linter errors * remove passing around sectionTitles * move algorithm and lever_group strings into ACD_LEVERS * Update DocketTimeGoals.jsx * Update LeverSaveButton.jsx * Update leversSelector.js * create new actions * create individual actions for each data type * use new action in DocketTImeGoals * create SaveModal file * clean up around the different data type updates * show changed levers * show changed levers * Save works and success banner displays * cleanup and account for multiple levers being changed * error banner display * batch size saves * clean up Affinity Days and ensure order * Ensure BatchSize order * Fix DocketTimeGoals ordering * clear errors out when hiding banner * more cleanup * props cleanup * clean up from feature branch merge * linting errors * APPEALS-37558: Refactor: Redux Confirm Save (#20490) * Update ExclusionTable.jsx * update levers after save * update history and audit table to show css_id * Update leversReducer.js * APPEALS-37558 (#20498) * Fix error banner not displaying * Update case_distribution_levers_controller.rb * mbeard/APPEALS-37559 (#20494) * "updates lever cancel function" * "final updates to cancel button, updates controller" * "updated routes, method, and function" * "Unit test for cancel button" * "removed comments from test" * Amycommits/appeals 37508 (#20503) * APPEALS-37508 validation works * APPEALS-37508 added a check for lever errors to the save button. * APPEALS-37508 cleaned up some of the validation functions * github test (#20491) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers --------- Co-authored-by: Christopher Detlef <> * Chrisbdetlef/appeals 37692 (#20512) * github test * APPEALS-37825 Create Capybara Test for AMA Non-Priority DIstribution Goal Levers * Add constants and custom html for capybara tests --------- Co-authored-by: Christopher Detlef <> * APPEALS-37558 Fix issues found during QA testing (#20511) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * APPEALS-37558 Prevent bad audit entries (#20522) * AMA Evidence Submission Appeals * Data Element * wrap variable in curly brackets, fix browser warning * linting errors * split SAVE_LEVERS dispatch * prevent invalid lever changes from getting audit entries * Update case_distribution_lever_spec.rb * APPEALS-37508 redoing the seeds (#20531) * Sharsha/appeals 37511 2 (#20521) * APPEALS-37511. ExclusionTable scss refactor * APPEALS-37511. Static levers scss refactor * APPEALS-37511. Lever History refactor scss * sharsha/APPEALS-37511. linting fixes * APPEALS-37511. Refactor Interactable Levers scss * APPEALS-37511. fix cancel and save button styling * APPEALS-37511. fixes * APPEALS-37511. Lint fixes * APPEALS-37511. updated the mock to use the updated scss files * APPEALS-37511. LeverButtonsWrapper css cleanup * APPEALS-37511. Exclusion table header styling --------- Co-authored-by: SHarshain * Demo VLJ and AVLJ users updates (#20540) * and _AVLJ to AVLJ names * Update case_distribution_test_data.rb * APPEALS-38398 Disabled levers are still showing focus on Admin UI (#20559) * disable tabbing to disable inputs * clean up ToggleSwitch css * Update _toggle_switch.scss * move import * Update _toggle_switch.scss * Update ToggleSwitch.jsx * Update _toggle_switch.scss * test that props are being passed in correctly * Ricky/appeals-37871 (#20534) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data --------- Co-authored-by: Matt Roth * add disabled to other NumberFields (#20564) * mbeard/APPEALS-38541 (#20553) * "makes too_many_cases error dynamic" * "updates controller method to be dynamic" * sharsha/APPEALS-37511_3. Added 30px right padding for table header (#20562) Co-authored-by: SHarshain * APPEALS-37525 Refactor ACD Levers Test Page (#20535) * APPEALS-37525 Refactor ACD Levers Test Page * Change Test Page to React component * Use lever history serializer in controller * Add all current attributes to the Lever Table * Add more attributes to Lever History Table * Update links from ruby to React * APPEALS-37525 moved the lever_history to the model because it's being… (#20538) * APPEALS-37525 moved the lever_history to the model because it's being used in multiple places * APPEALS-37525 changed the options to only display values * Fix unit test --------- Co-authored-by: Christopher Detlef <> * Fix Option Values column * DRY out the history unit test --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-37794 (#20532) * "updates copy issue and radiofield" * "updates accessibility labels" * "attempt to update label" * "updates accessibility vioce over" * "moves logic from radiofield to exclusiontable" * "Updated fixes from comments" * "removes last thing from TextField component" --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-37832. Test data seed spec for case distribution (#20561) * APPEALS-37832. Test data seed spec for case distribution * APPEALS-37832. more changes * APPEALS-37832. Added CaseDistributionlevers count --------- Co-authored-by: SHarshain * Ricky/appeals-37556 (#20502) * Updated LeverHistory component, formatting and storage in redux * Updated Jest testing for LeverHistory * Code cleanup and address comments. Reverted save_levers changes * Feature test outline and class names added * Updated feature tests * Fixed linting error with SaveModal * Updated testing for LeverHistory and fixed css id from showing * Created individual lever history action, updated reducer, updated testing * Removed unneeded data in jest test * Cleaned up formatTimestamp function --------- Co-authored-by: Christopher Detlef <> * Ricky/appeals-38556 (#20574) * Initial testing for BatchSize and lever data for testing. * Updated BatchSize Testing and additional testing data. * Updated tests to get full testing coverage * APPEALS-37508 resetting the errors when the cancel button is clicked (#20589) * APPEALS-37511. Fix exclusion table member view (#20595) Co-authored-by: SHarshain * Ricky/appeals-37871 (#20596) * Refactored static levers to properly interact with redux * Updated seed data and added formatting to static data values on display * Updates to static levers and static levers wrapper and updates to their unit tests * Removed unneeded import in Static Lever tests. * Cleaned up static lever code and improved testing to include established test data * Updated spacing between value and unit for static lever, updated testing * Updated static lever to separate value and unit using css --------- Co-authored-by: Matt Roth * APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613) Co-authored-by: SHarshain * APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614) Co-authored-by: SHarshain * APPEALS-38570. Improve the test coverage (#20584) * APPEALS-38570. Improve the test coverage * APPEALS-38570. Dead code cleanup * APPEALS-38570. test coverage to address the exception --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38764 Add Batch Size Lever feautre tests (#20618) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-38561 (#20622) * "initial commit, adds test and save button export" * "adds leversavebutton unit test" * APPEALS-38789 Added error message validation to feature test for Docket Goals (#20625) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * fix merge conflict error * APPEALS-38787 Add Affinity Days levers feature tests (#20619) Co-authored-by: Christopher Detlef <> * APPEALS-38903 Add Inactive Data Elements lever feature tests (#20621) Co-authored-by: Christopher Detlef <> * APPEALS-38555. Affinity Days jest test (#20633) Co-authored-by: SHarshain * Ricky/appeals-38557 (#20634) * Began work on DocketTimeGoal testing, updated toSorted to sort * Updated unit tests to improve coverage on DocketTimeGoals * Updated unit tests to begin working on testing toggleLever * rebuild PR (#20617) * rebuild PR * Update LeverHistory.jsx * Cleaned up DocketTimeGoals test --------- Co-authored-by: Matt Roth * APPEALS-38904 Add Feature Test for Audit Lever History (#20637) * Initial pass * APPEALS-38904 Add Feature Test for Audit Lever History --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * mbeard/APPEALS-38558 (#20630) * "initial commit, created test, updated wrapper" * "adds test cases for save and cancel buttons" * "updates revertLevers to resetLevers for clarity" * "removes problematic test case" --------- Co-authored-by: Matt Roth * APPEALS-38526. 100% test coverage for Case distribution test data seed (#20638) * APPEALS-38526. 100% test coverage for Case distribution test data seed * APPEALS-38526. Fix the typo * APPEALS-38526. Fix the typo in class and related spec --------- Co-authored-by: SHarshain * Ricky/appeals-38567 (#20642) * Updated caseDistributionApp test file and added additional test lever data * Updated test for CaseDistributionApp * Updated rootreducer test for full coverage (#20653) * APPEALS-38555. Added the test coverage to verify the text input (#20654) Co-authored-by: SHarshain * Update to audit lever history time entries to display leading 0s for hours, minutes, and seconds (#20652) * APPEALS-38558 amended test to cover the remaining thee lines of code (#20643) * APPEALS-38790 Add Lever Button feature tests (#20662) Co-authored-by: Christopher Detlef <> * mbeard/APPEALS-39284 (#20663) * "initial commit with updates controller, actions, reducer" * "updates leversActions error message" * "updates case dist levers controller spec" * "removes redundant line from update_levers method" * pull changes from hotfix branch (#20667) * APPEALS-38542 got rid of code that is not being used (#20673) * APPEALS-38542 got rid of code that is not being used * APPEALS-38542. Remove unused constant from actions list * APPEALS-38542. remove deadcode spec --------- Co-authored-by: SHarshain * APPEALS-38562./ Removes the unused component (#20697) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "Created jest for leversactions" (#20701) * Chrisbdetlef/appeals 38966 (#20700) * APPEALS-38966 Add dynamic * generation for lever labels/titles * Remove file * Refactor to use a single utility method --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * Ricky/appeals-38569 (#20681) * Pushed changes to LeversReducer Test * Updated unit tests for additional coverage * Pushed up changes to have eyes on async tests * Pulled in Amy's changes and moved data to adminCaseDistributionLevers * Updated test data naming for mocks and tests * Updated testing to fix issues and improve coverage * Updated unit tests, added comments on unfinished work * APPEALS-38569 updated the reducer to give the expected information in the jest tests --------- Co-authored-by: 631966 * mbeard/APPEALS-37794 (#20685) * APPEALS-37794 made changes to the shared number and text components so that we have more control over what the aria-label is * "Updates arialabeltext for batchsize, jests for batchsize and docket time goals" * "updates admin jest aria text query" --------- Co-authored-by: 631966 * revert changes that are causing the Unable to load banner to appear to quick (#20712) * APPEALS-32252 fixed a few rspec tests (#20738) * added the judge list all and attorney list all to help with caching issues * APPEALS-39893 CaseDistributionLever swap over to method_missing (#20744) * remove find_float and find_float, swap to method_missing * codeclimate updates * Update case_distribution_lever.rb * Update case_distribution_lever.rb * APPEALS-39660 Correct ACD Lever Seeds (#20747) Co-authored-by: Christopher Detlef <> * APPEALS-39889 CodeClimate issues (#20740) * move to story branch * Update .codeclimate.yml * pull in dev-support/APPEALS-39031 * Update case_distribution_lever.rb * Update .codeclimate.yml * disable DataClump for db seeds * lint fixes * Update affinity_days_levers_spec.rb * Update case_distribution_lever.rb * Update .codeclimate.yml * pull over other changes * Update case_distribution_lever.rb * Update case_distribution_lever.rb * fix codeclimate issues * fix more issues * rubocop auto fixes * Update test.jsx * mbeard/APPEALS-39895 (#20746) * "updates value in test method and adds new contexts" * "put everything back" * "updates seed value for Dockt weight" * "verifies seed data is correct" (#20754) * APPEALS-39897. Ambiguous id match removed from the component and matched the parent css element (#20745) * APPEALS-39897. Ambiguous id match removed from the component and matched to parent css element * APPEALS-39897. Refactored spec * APPEALS-39897. rubocop fixes * APPEALS-39897. Lint fix --------- Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Update leversActions.js (#20760) * APPEALS-39899. Spec fix (#20758) Co-authored-by: SHarshain * revert and move new code to correct file (#20766) * APPEALS-39889 Code Climate issues part 2 (#20759) * swap over to using USWDS colors * more rubocop fixes * add extra lines, remove spaces * Update affinity_days_levers_spec.rb * cleanup unit tests * Update audit_lever_history_table_spec.rb * Update inactive_data_elements_levers_spec.rb * Update _interactable_levers.scss * refactor duplicate code * Update _lever_history.scss * Update affinity_days_levers_spec.rb --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-39984 Update test to match css fix (#20768) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40085 Update ACD lever count (#20769) Co-authored-by: Christopher Detlef <> Co-authored-by: Matt Roth * APPEALS-40092. Fix negative rspec matcher (#20772) Co-authored-by: SHarshain Co-authored-by: Matt Roth * "fixed spelling and updated spec to include two new users" (#20777) Co-authored-by: Matt Roth * mbeard/APPEALS-38563 (#20577) * "creates savemodal test by adding save button" * "updates and deleted and recreated file" * "latest update to mockstore" * "adds export to save button and updates test" * "current updaates to the test" * "Updates the confirm button to mock confirm button" * Updated testing data and SaveModal tests * "updates logic in utils and updates test" * "adds changedLevers constant mocked data and renders corrrectly" * "adds affinity days to test, and close modal" * "updates test data, adds new cases, adds ids to table" --------- Co-authored-by: 631068 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: 631966 * APPEALS-40134. Add missing traits in factories (#20789) Co-authored-by: SHarshain * APPEALS-40131. Fix case_distribution_levers seed spec (#20786) Co-authored-by: SHarshain * APPEALS-39980. Mock the value in the spec (#20784) Co-authored-by: SHarshain * "updates control group and rsec to never recieve tasks" (#20790) * Updated constants from by docket date to static docket date (#20796) * APPEALS-39892 Unit test fixes (#20798) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * merge issue * Update case_docket.rb (#20782) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * ricky/APPEALS-40090 (#20803) * APPEALS-39892 fixed one file for rubocop issues * Updated jest unit tests to fix issues * Updated leversReducer unit tests * Added export back to LeverSaveButton --------- Co-authored-by: 631966 * APPEALS-39892 Unit tests fixes (#20810) * Update case_distribution_levers_controller_spec.rb * Update docket_coordinator_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update push_priority_appeals_to_judges_job_spec.rb * Update case_docket.rb * APPEALS-39987 updated failing snapshots (#20751) * Updated jest config to ignore test.jsx files (#20826) * APPEALS-40136 Bring test data back into range of displayed data (#20824) Co-authored-by: Christopher Detlef <> * Updated By Docket Date to Docket Date (#20827) * APPEALS-39899. docket_coordinator_spec fix (#20829) Co-authored-by: SHarshain * APPEALS-39980. Fix the timestamp failure in the spec (#20836) Co-authored-by: SHarshain * move to new feature branch (#20889) * move to new feature branch (#20890) * APPEALS-38967 Update Implementation of Affinity Days in Admin UI (#20656) * bring over fix for ordering * suggested change * Create 20240130152058_update_case_distribution_levers_is_toggle_active.rb * Update schema.rb * Updates to enable levers that are being tested and for null values in is_toggle_active for n/a levers * Update test.jsx * Update test.jsx * updates for Combination levers, missing updates to allow saving of them * Save combination levers * Update SaveModal.jsx * swap over to methods focused on updating a specific attribute of a lever * change radio to not have value in value * for radio levers set selectedOption when loading levers * Update case_distribution_lever.rb * Update AffinityDays.jsx * Update case_distribution_lever.rb * updates to account for is_toggle_active being nullable * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * Update case_distribution_levers.rb * fix validation error messages, Radio levers update redux store correctly * changing radio enables Save and displays in Save Modal correctly * fix max values to be 999 * Can save Radio levers successfully * history entries match frontend * Update AffinityDays.jsx * cleanup and comments * Update case_distribution_lever.rb * Update LeverHistory.jsx * Revert "Update LeverHistory.jsx" This reverts commit 6eca84730cac808e5d25b467d370dd21a34013d1. * APPEALS-26750 auto_texts was created as a part of master * Update case_distribution_lever.rb (#20946) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-38967 Remove units showing when not needed (#20975) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: 631966 * APPEALS-38744 Update AMA Hearing Case Affinity Days Lever (#20956) * APPEALS-38744 added checks for ama hearing case affinity days lever * APPEALS-38744 refactored logic for ama hearing case affinity days lever * APPEALS-38744 update method name * APPEALS-41456 made changes to the affinity days test data and jest tests to conform to new data changes (#20991) * Tmr/appeals 38967 4 (#21034) * fix units showing when not needed * Update schema.rb * APPEALS-38967 minor cleanup of ticket --------- Co-authored-by: Matthew Roth * Ricky/appeals-35179 (#20988) * "adds ama aod original appeals method to scopes" * "adds conditional to only_genpop_appeals" * "removes unnecessary copied code" * "adds comment" * "Updates to formatting for shovel methods" * "updates conditional to include correct function, changes scope chain" * "Updates and adds scope for infinite, test passes" * "adds infinite method to scopes" * "created new test scenarios" * "moves line up" * "updates distribution scope methods" * "updates methods" * "updates rspec to update attribute" * "updates def and values" * "updates rspec to new methods" --------- Co-authored-by: Michael Beard * APPEALS-38967 made sure that the lever history displays properly (#21041) * APPEALS-37024 Create Seeds For ACD Demo (#21038) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * mbeard/APPEALS-38744 (#21039) * "init commit for updating not_genpop_appeals" * "adds new context and updates top ama" * "updates methods on scopes, adds new appeals, updates specs" * Updated logic and rspec tests * APPEALS-38744 rearranged the not_genpop_appeals to only run the not_genpop_appeals query once * APPEALS-38744 took out puts * APPEALS-38744 the queries work through binding.pry the tests are failing due to setup issues * APPEALS-38744 update with new pattern * APPEALS-38744 added a conditional to make affinity days chained correctly * APPEALS-38744 more fiddling * Fix code issues for query structures * Make returns uniformly arrays of arrays * flagged error * "updates hearing docket method to if else" * "fixes ish respecs adding with_no_held_hearings to the array" * "cleanup brush brush brush" --------- Co-authored-by: 631068 Co-authored-by: 631966 Co-authored-by: Christopher Detlef <> * APPEALS-42090 Add newly enabled levers to capybara test (#21117) Co-authored-by: Christopher Detlef <> * APPEALS-26750 updating the kepler feature with the combined branch so that there isn't 200 changed files * mbeard/APPEALS-42093 (#21114) * "updates jest to reflect code changes and updates selector logic" * "updates savemodal jest" * "Updates leversActions test, removes redundancies" * "Updates infinite, omit, and updated value tests" * APPEALS-42010 Rework affinity lever tests (#21079) * APPEALS-42010 fix rspecs * APPEALS-42010 update specs and address pr suggestions --------- Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Ricky/appeals-42088 (#21126) * Updated seed data * Updated seed data for days_before_goal_due_for_distribution lever * Reworked solution and renamed lever to be correct * Updated tests (#21135) * Feature/appeals 26750 revert affinity (#21137) * APPEALS-26750 commenting out method that was failing in seeds * APPEALS-26750 added logic for unique veteran too * APPEALS-26750 updating the seeds to get the params properly * APPEALS-26750 enabled the call to create_case_ready_for_more_than_hearing_affinity_days(judge) * increase the number of digits in the css_id sequence (#21139) * increase the number of digits in the css_id sequence * modify generated CSS_IDs and sequence to shorten to 12 characters * ensures that the veteran id is unique, even though it always ought to be unique (#21143) * Fixed errors caused by rounding issues in rspec (#21148) * Chrisbdetlef/appeals 35179 post rewrite (#21169) * factory updates, new file created, some tests written * finished genpop_priority_count * add limit appeals class methods tests * framework and some tests for distribute_appeals * added tests for hearing aod lever * add ineligible and excluded judge tests * fix issues with aod test setup * add second test for changing numeric values * APPEALS-35179 Fix code after rspec test corrections * Rework of scopes * Tests and code are fixed * Still need to add CAVC tests * Extra code in scopes needs to be cleaned up * add last spec * fix cavc test * fix base relation cavc stuff * Refactor and prune code to improve readability * remove comments * Added new test and code fix * Remove comments * add hearings not tied to any judge to only genpop call * removed is_toggle_active spec test as its no longer needed * remove compact from hearing case distributor, add comments to failing specs, fix spec data setup * modify query, tests passing * deletes old hearings docket rspec and renames the rewrite * change magic strings to existing constants, rename method, restore seed file logging * fix issue in hrdq, update magic strings in test file --------- Co-authored-by: Craig Reese Co-authored-by: Christopher Detlef <> Co-authored-by: Calvin * mbeard/APPEALS-42094 (#21141) * "cleaned up linter issues" * "updates dist scopes" * "all linting error fixes for dockets and specs" * "adds missing end to context" * "fixes all spacing issues and alignment" * "put it all back, disable rubocop for trouble lines" * "last linting issue" * "disables double quote linter issue" * "adds ._to_s back to case distro lever" * "removed linter disable comments and updated code to remove linter issues" * "fixes spacing and alignment linting issues" * APPEALS-37024 Fix Demo Seed Data (#21221) * APPEALS-37024 Fix Demo Seed Data * APPEALS-37024 disable appeals that were made as the core seeds --------- Co-authored-by: Christopher Detlef <> Co-authored-by: 631966 * update naming of seed user (#21229) * APPEALS-41972 Simplify Error Message (#21213) * APPEALS-41972 Simplify Error Message * "fixes linting errors in utils.js" * "updates function to include minValue error message when there is no maxValue" * "updates actions in leversActions test from -1 to empty or null" --------- Co-authored-by: Christopher Detlef <> Co-authored-by: Michael Beard * added logic to account for if the judge exclusion work has to be deployed separately (#21233) * "updates the seeding buttons to make post api calls and spin while loading" (#21231) --------- Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: 631068 Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> Co-authored-by: Matt Roth Co-authored-by: Alexander Smith Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: Michael Beard Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> Co-authored-by: Craig Reese Co-authored-by: Calvin Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> * fix rubocop offenses * Minor improvements to VANotify jobs - Adds a new NotificationInitializationError class to handle SendNotificationJob failures when requisite information is absent. - Ensures the current_user is always set in the RequestStore for each SendNotificationJob execution. - Limits the maximum number of retries to 5 for SendNotificationJobs since anything past then causes an exception to be thrown due to excess delay time (>15 minutes). The exponential backoff algorithm Shoryuken uses surpasses 15 minutes at the 6th retry. * Update some specs to reflect new error classes * Fix linting issue * Fix a spelling error * modify query to combine no hearings and no held hearings (#21277) (#21279) * modify query to combine no hearings and no held hearings * fix rubocop warnings * add host to development.rb * Remove feature-specific testing commands from seeds.rb prior to release (#21304) * modify query to combine no hearings and no held hearings (#21277) * modify query to combine no hearings and no held hearings * fix rubocop warnings * APPEALS-26750 took out temporary fix for seeds --------- Co-authored-by: 631966 --------- Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com> Co-authored-by: Robert Travis Pierce Co-authored-by: Isaiah Saucedo Co-authored-by: Calvin Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com> Co-authored-by: Jonathan Hoang Co-authored-by: Sean Parker Co-authored-by: samasudhirreddy Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com> Co-authored-by: = Co-authored-by: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Co-authored-by: Robert Travis Pierce Co-authored-by: Matt Roth Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: 631966 Co-authored-by: 631068 Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> Co-authored-by: Alexander Smith Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com> Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: Michael Beard Co-authored-by: Matthew Thornton Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> --- app/controllers/appeals_controller.rb | 116 +- .../case_distribution_levers_controller.rb | 3 +- ...se_distribution_levers_tests_controller.rb | 14 + .../judge_assign_tasks_controller.rb | 4 + ...ialty_case_team_assign_tasks_controller.rb | 26 + app/controllers/split_appeal_controller.rb | 3 + app/controllers/team_management_controller.rb | 3 +- app/jobs/no_available_modifiers_fix_job.rb | 1 - app/models/appeal.rb | 25 +- app/models/case_distribution_lever.rb | 128 +- app/models/claim_review.rb | 4 + .../concerns/automatic_case_distribution.rb | 4 +- .../concerns/by_docket_date_distribution.rb | 13 +- app/models/concerns/case_distribution.rb | 10 +- app/models/concerns/distribution_concern.rb | 48 + app/models/concerns/distribution_scopes.rb | 171 +- app/models/decision_review.rb | 2 +- app/models/distributed_case.rb | 1 + app/models/distribution.rb | 46 +- app/models/distribution_stats.rb | 5 + app/models/docket.rb | 128 +- app/models/dockets/direct_review_docket.rb | 8 +- app/models/dockets/hearing_request_docket.rb | 43 +- app/models/legacy_appeal.rb | 4 + .../specialty_case_team_methods_mixin.rb | 40 + app/models/organization.rb | 7 +- app/models/organizations/cda_control_group.rb | 4 + app/models/organizations/judge_team.rb | 6 + .../organizations/specialty_case_team.rb | 47 + app/models/queue_tab.rb | 13 +- ...lty_case_team_action_required_tasks_tab.rb | 27 + ...specialty_case_team_completed_tasks_tab.rb | 27 + ...pecialty_case_team_unassigned_tasks_tab.rb | 36 + app/models/request_issue.rb | 4 + app/models/request_issues_update.rb | 32 + .../work_queue/appeal_serializer.rb | 2 + .../work_queue/task_column_serializer.rb | 13 +- .../serializers/work_queue/task_serializer.rb | 2 +- app/models/task.rb | 2 + app/models/tasks/attorney_task.rb | 41 +- .../tasks/specialty_case_team_assign_task.rb | 32 + app/models/user.rb | 20 +- .../hearing_request_distribution_query.rb | 219 +- app/repositories/task_action_repository.rb | 12 + app/services/bva_appeal_status.rb | 17 +- app/services/cached_appeal_service.rb | 7 +- app/views/appeals/edit.html.erb | 3 + .../case_distribution_levers/index.html.erb | 3 +- app/views/queue/index.html.erb | 4 +- app/workflows/attorney_task_creator.rb | 22 + .../hearing_request_case_distributor.rb | 40 +- ...specialty_case_team_assign_task_creator.rb | 64 + ...pecialty_case_team_split_appeal_handler.rb | 65 + client/COPY.json | 24 +- .../components/AffinityDays.jsx | 64 +- .../caseDistribution/components/BatchSize.jsx | 4 +- .../components/CaseDistributionContent.jsx | 14 + .../components/DocketTimeGoals.jsx | 29 +- .../components/LeverHistory.jsx | 19 +- .../caseDistribution/components/SaveModal.jsx | 50 +- client/app/caseDistribution/index.jsx | 1 + .../pages/CaseDistributionApp.jsx | 5 + .../reducers/levers/leversActionTypes.js | 7 +- .../reducers/levers/leversActions.js | 48 +- .../reducers/levers/leversReducer.js | 27 +- .../reducers/levers/leversSelector.js | 129 +- client/app/caseDistribution/test.jsx | 64 + client/app/caseDistribution/utils.js | 78 +- client/app/components/Button.jsx | 1 + client/app/intake/pages/ReviewAppealView.jsx | 37 +- .../app/intakeEdit/components/EditButtons.jsx | 80 +- .../components/SaveAlertConfirmModal.jsx | 9 +- client/app/intakeEdit/reducers/index.js | 11 +- client/app/nonComp/components/Alerts.jsx | 2 + .../app/queue/AssignToAttorneyModalView.jsx | 61 +- client/app/queue/CaseDetailsLoadingScreen.jsx | 7 +- client/app/queue/QueueActions.js | 78 +- client/app/queue/QueueApp.jsx | 23 +- client/app/queue/QueueLoadingScreen.jsx | 21 +- client/app/queue/QueueTableBuilder.jsx | 14 +- client/app/queue/TeamAssignTaskListView.jsx | 29 +- client/app/queue/UnassignedCasesPage.jsx | 65 +- .../app/queue/UnassignedCasesPage.stories.js | 66 +- .../components/AssignToAttorneyWidget.jsx | 83 +- .../app/queue/components/CancelTaskModal.jsx | 5 +- client/app/queue/selectors.js | 34 +- client/app/queue/teamManagement/OrgList.jsx | 25 +- client/app/queue/teamManagement/OrgRow.jsx | 39 +- .../app/queue/teamManagement/OrgSection.jsx | 6 +- .../queue/teamManagement/TeamManagement.jsx | 15 +- client/app/queue/uiReducer/uiActions.js | 5 + client/app/queue/uiReducer/uiConstants.js | 1 + client/app/queue/uiReducer/uiReducer.js | 5 + client/app/queue/utils.js | 1 + client/app/styles/_team_management.scss | 5 + client/app/util/ApiUtil.js | 5 +- client/constants/ACD_LEVERS.json | 2 +- client/constants/QUEUE_CONFIG.json | 3 + .../SPECIALTY_CASE_TEAM_BENEFIT_TYPES.json | 3 + client/constants/TASK_ACTIONS.json | 5 + client/constants/USER_ROLE_TYPES.json | 3 +- .../components/AffinityDays.test.js | 24 +- .../CaseDistributionContent.test.js | 45 +- .../components/SaveModal.test.js | 191 +- .../reducers/levers/LeversReducer.test.js | 28 +- .../reducers/levers/leversActions.test.js | 70 +- .../__snapshots__/OrgRow.test.js.snap | 59 +- .../test/data/adminCaseDistributionLevers.js | 29 +- client/test/data/sctAmaAppealsData.js | 287 ++ client/test/data/sctAmaTasksData.js | 1008 +++++++ client/test/data/sctQueueConfigData.js | 2592 +++++++++++++++++ client/webpack.config.js | 5 + config/routes.rb | 3 + ..._appeals_from_affinity_to_organizations.rb | 14 + db/etl/schema.rb | 3 +- ...025_add_sct_appeal_to_distributed_cases.rb | 5 + ..._appeals_from_affinity_to_organizations.rb | 14 + ...se_distribution_levers_is_toggle_active.rb | 7 + ...0240226135119_create_distribution_stats.rb | 10 + db/schema.rb | 153 +- db/seeds.rb | 1 + db/seeds/ama_affinity_cases.rb | 189 ++ db/seeds/case_distribution_levers.rb | 1288 ++++---- .../demo_aod_hearing_case_lever_test_data.rb | 332 +++ ...mo_non_aod_hearing_case_lever_test_data.rb | 333 +++ db/seeds/static_test_data.rb | 3 +- db/seeds/users.rb | 28 + db/seeds/veterans_health_administration.rb | 34 + .../judge_assign_tasks_controller_spec.rb | 9 +- .../post_decision_motions_controller_spec.rb | 3 +- ..._case_team_assign_tasks_controller_spec.rb | 80 + .../split_appeal_controller_spec.rb | 253 +- .../team_management_controller_spec.rb | 16 + spec/factories/appeal.rb | 28 + spec/factories/hearing.rb | 4 +- spec/factories/higher_level_review.rb | 2 +- spec/factories/sequences.rb | 4 +- spec/factories/supplemental_claim.rb | 2 +- spec/factories/task.rb | 81 + spec/factories/user.rb | 29 +- .../acd_levers/affinity_days_levers_spec.rb | 20 +- spec/feature/intake/appeal/edit_spec.rb | 470 ++- spec/feature/queue/ama_queue_spec.rb | 66 +- spec/feature/queue/attorney_queue_spec.rb | 37 + spec/feature/queue/judge_assignment_spec.rb | 10 +- .../queue/scm_judge_assignment_spec.rb | 15 +- .../specialty_case_team_bulk_assign_spec.rb | 110 + .../queue/specialty_case_team_queue_spec.rb | 123 + spec/feature/queue/team_management_spec.rb | 61 + .../feature/queue/vha_camo_assignment_spec.rb | 2 +- .../investigate_scm_cant_reassign_spec.rb | 2 +- ...ush_priority_appeals_to_judges_job_spec.rb | 13 +- spec/models/appeal_spec.rb | 56 + spec/models/case_distribution_lever_spec.rb | 31 +- spec/models/distribution_spec.rb | 10 +- spec/models/docket_coordinator_spec.rb | 2 +- spec/models/docket_spec.rb | 119 +- .../dockets/hearing_request_docket_spec.rb | 1196 ++++---- spec/models/organizations/judge_team_spec.rb | 44 + ...l_notification_letter_holding_task_spec.rb | 10 +- spec/models/queue_config_spec.rb | 65 +- spec/models/queue_tab_spec.rb | 11 +- spec/models/request_issue_spec.rb | 13 + spec/models/tasks/attorney_task_spec.rb | 45 +- .../schedule_hearing_colocated_task_spec.rb | 3 +- .../specialty_case_team_assign_task_spec.rb | 28 + spec/seeds/users_spec.rb | 4 +- .../veterans_health_administration_spec.rb | 4 + ...alty_case_team_assign_task_creator_spec.rb | 22 + 169 files changed, 10601 insertions(+), 2190 deletions(-) create mode 100644 app/controllers/specialty_case_team_assign_tasks_controller.rb create mode 100644 app/models/distribution_stats.rb create mode 100644 app/models/mixins/specialty_case_team_methods_mixin.rb create mode 100644 app/models/organizations/specialty_case_team.rb create mode 100644 app/models/queue_tabs/specialty_case_team_action_required_tasks_tab.rb create mode 100644 app/models/queue_tabs/specialty_case_team_completed_tasks_tab.rb create mode 100644 app/models/queue_tabs/specialty_case_team_unassigned_tasks_tab.rb create mode 100644 app/models/tasks/specialty_case_team_assign_task.rb create mode 100644 app/workflows/specialty_case_team_assign_task_creator.rb create mode 100644 app/workflows/specialty_case_team_split_appeal_handler.rb create mode 100644 client/constants/SPECIALTY_CASE_TEAM_BENEFIT_TYPES.json create mode 100644 client/test/data/sctAmaAppealsData.js create mode 100644 client/test/data/sctAmaTasksData.js create mode 100644 client/test/data/sctQueueConfigData.js create mode 100644 db/etl/migrate/20240129200527_add_exclude_appeals_from_affinity_to_organizations.rb create mode 100644 db/migrate/20240119153025_add_sct_appeal_to_distributed_cases.rb create mode 100644 db/migrate/20240129200527_add_exclude_appeals_from_affinity_to_organizations.rb create mode 100644 db/migrate/20240130152058_update_case_distribution_levers_is_toggle_active.rb create mode 100644 db/migrate/20240226135119_create_distribution_stats.rb create mode 100644 db/seeds/ama_affinity_cases.rb create mode 100644 db/seeds/demo_aod_hearing_case_lever_test_data.rb create mode 100644 db/seeds/demo_non_aod_hearing_case_lever_test_data.rb create mode 100644 spec/controllers/specialty_case_team_assign_tasks_controller_spec.rb create mode 100644 spec/feature/queue/specialty_case_team_bulk_assign_spec.rb create mode 100644 spec/feature/queue/specialty_case_team_queue_spec.rb create mode 100644 spec/models/tasks/specialty_case_team_assign_task_spec.rb create mode 100644 spec/workflows/specialty_case_team_assign_task_creator_spec.rb diff --git a/app/controllers/appeals_controller.rb b/app/controllers/appeals_controller.rb index c37bb43fd64..cdbb1a6e236 100644 --- a/app/controllers/appeals_controller.rb +++ b/app/controllers/appeals_controller.rb @@ -156,8 +156,7 @@ def show def edit # only AMA appeals may call /edit # this was removed for MST/PACT initiative to edit MST/PACT for legacy issues - return not_found if appeal.is_a?(LegacyAppeal) && - !FeatureToggle.enabled?(:legacy_mst_pact_identification, user: RequestStore[:current_user]) + return not_found if appeal.is_a?(LegacyAppeal) && !feature_enabled?(:legacy_mst_pact_identification) end helper_method :appeal, :url_appeal_uuid @@ -171,8 +170,8 @@ def url_appeal_uuid end def update - if appeal.is_a?(LegacyAppeal) && - FeatureToggle.enabled?(:legacy_mst_pact_identification, user: RequestStore[:current_user]) + if appeal.is_a?(LegacyAppeal) && feature_enabled?(:legacy_mst_pact_identification) + legacy_mst_pact_updates elsif request_issues_update.perform! set_flash_success_message @@ -192,7 +191,8 @@ def update def create_subtasks! # if cc appeal, create SendInitialNotificationLetterTask - if appeal.contested_claim? && FeatureToggle.enabled?(:cc_appeal_workflow) + if appeal.contested_claim? && feature_enabled?(:cc_appeal_workflow) + # check if an existing letter task is open existing_letter_task_open = appeal.tasks.any? do |task| task.class == SendInitialNotificationLetterTask && task.status == "assigned" @@ -328,6 +328,19 @@ def mst_and_pact_edited_issues message << create_mst_pact_message_for_new_and_removed_issues(new_issues, "added") unless new_issues.empty? message << create_mst_pact_message_for_new_and_removed_issues(removed_issues, "removed") unless removed_issues.empty? + # add in the Specialty Case Team messages, if any + if !appeal.is_legacy? && feature_enabled?(:specialty_case_team_distribution) && appeal.distributed? + if request_issues_update.before_issues.any?(&:sct_benefit_type?) && + (request_issues_update.after_issues - request_issues_update.withdrawn_issues).none?(&:sct_benefit_type?) && + appeal.specialty_case_team_assign_task? + message << move_to_distribution_success_message + end + + if appeal.sct_appeal? && request_issues_update.before_issues.none?(&:sct_benefit_type?) + message << move_to_specialty_case_team_success_message + end + end + message.flatten end # rubocop:enable Layout/LineLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength @@ -432,8 +445,6 @@ def create_params # rubocop:disable Metrics/AbcSize, Metrics/MethodLength # :reek:FeatureEnvy def create_legacy_issue_update_task(before_issue, current_issue) - user = RequestStore[:current_user] - # close out any tasks that might be open open_issue_task = Task.where( assigned_to: SpecialIssueEditTeam.singleton @@ -444,8 +455,8 @@ def create_legacy_issue_update_task(before_issue, current_issue) appeal: appeal, parent: appeal.root_task, assigned_to: SpecialIssueEditTeam.singleton, - assigned_by: user, - completed_by: user + assigned_by: current_user, + completed_by: current_user ) # format the task instructions and close out set = CaseTimelineInstructionSet.new( @@ -473,8 +484,8 @@ def create_legacy_issue_update_task(before_issue, current_issue) appeal_type: "LegacyAppeal", task_id: task.id, created_at: Time.zone.now.utc, - created_by_id: RequestStore[:current_user].id, - created_by_css_id: RequestStore[:current_user].css_id, + created_by_id: current_user.id, + created_by_css_id: current_user.css_id, original_mst_status: before_issue.mst_status, original_pact_status: before_issue.pact_status, updated_mst_status: current_issue[:mst_status], @@ -484,22 +495,79 @@ def create_legacy_issue_update_task(before_issue, current_issue) end # rubocop:enable Metrics/AbcSize, Metrics/MethodLength - # updated flash message to show mst/pact message if mst/pact changes (not to legacy) - # rubocop:disable Layout/LineLength + def set_flash_move_to_sct_success_message + # If original issues were not SCT related, then that means it will be moved to the SCT queue + if appeal.sct_appeal? && request_issues_update.before_issues.none?(&:sct_benefit_type?) && + appeal.distributed? && feature_enabled?(:specialty_case_team_distribution) + flash[:custom] = { + title: COPY::MOVE_TO_SCT_BANNER_TITLE, + message: move_to_specialty_case_team_success_message + } + end + end + + def set_flash_move_to_distribution_success_message + # If the before issues had an SCT issue but the after issues don't then the appeal is moving to distribution + if request_issues_update.before_issues.any?(&:sct_benefit_type?) && + (request_issues_update.after_issues - request_issues_update.withdrawn_issues).none?(&:sct_benefit_type?) && + appeal.distributed? && appeal.specialty_case_team_assign_task? && + feature_enabled?(:specialty_case_team_distribution) + flash[:custom] = { + title: COPY::MOVE_TO_SCT_BANNER_TITLE, + message: move_to_distribution_success_message + } + end + end + + def move_to_distribution_success_message + format( + COPY::MOVE_TO_GENERIC_BANNER_SUCCESS_MESSAGE, + appeal.veteran_full_name, + appeal.veteran_file_number, + "regular distribution pool" + ) + end + + def move_to_specialty_case_team_success_message + format( + COPY::MOVE_TO_GENERIC_BANNER_SUCCESS_MESSAGE, + appeal.veteran_full_name, + appeal.veteran_file_number, + "SCT queue" + ) + end + def set_flash_success_message - return set_flash_mst_edit_message if mst_pact_changes? && - (FeatureToggle.enabled?(:mst_identification, user: RequestStore[:current_user]) || - FeatureToggle.enabled?(:pact_identification, user: RequestStore[:current_user])) + # updated flash message to show mst/pact message if mst/pact changes (not to legacy) + return set_flash_mst_edit_message if mst_pact_changes? && (feature_enabled?(:mst_identification) || + feature_enabled?(:pact_identification)) - set_flash_edit_message + set_flash_specialty_case_team_message + + set_flash_edit_message unless flash[:custom] + end + + def set_flash_specialty_case_team_message + set_flash_move_to_sct_success_message + set_flash_move_to_distribution_success_message end - # rubocop:enable Layout/LineLength # create success message with added and removed issues def set_flash_mst_edit_message flash[:mst_pact_edited] = mst_and_pact_edited_issues end + def flash_move_to_sct_success + flash[:custom] = { + title: COPY::MOVE_TO_SCT_BANNER_TITLE, + message: format( + COPY::MOVE_TO_SCT_BANNER_MESSAGE, + request_issues_update.review.claimant.name, + request_issues_update.veteran.file_number + ) + } + end + def set_flash_edit_message flash[:edited] = if request_issues_update.after_issues.empty? review_removed_message @@ -528,19 +596,19 @@ def send_initial_notification_letter # depending on the docket type, create cooresponding task as parent task case appeal.docket_type when "evidence_submission" - parent_task = @appeal.tasks.find_by(type: "EvidenceSubmissionWindowTask") + parent_task = appeal.tasks.find_by(type: "EvidenceSubmissionWindowTask") when "hearing" - parent_task = @appeal.tasks.find_by(type: "ScheduleHearingTask") + parent_task = appeal.tasks.find_by(type: "ScheduleHearingTask") when "direct_review" - parent_task = @appeal.tasks.find_by(type: "DistributionTask") + parent_task = appeal.tasks.find_by(type: "DistributionTask") end unless parent_task.nil? - @send_initial_notification_letter ||= @appeal.tasks.open.find_by(type: :SendInitialNotificationLetterTask) || + @send_initial_notification_letter ||= appeal.tasks.open.find_by(type: :SendInitialNotificationLetterTask) || SendInitialNotificationLetterTask.create!( - appeal: @appeal, + appeal: appeal, parent: parent_task, assigned_to: Organization.find_by_url("clerk-of-the-board"), - assigned_by: RequestStore[:current_user] + assigned_by: current_user ) end end diff --git a/app/controllers/case_distribution_levers_controller.rb b/app/controllers/case_distribution_levers_controller.rb index 22f57b540d0..c576a495833 100644 --- a/app/controllers/case_distribution_levers_controller.rb +++ b/app/controllers/case_distribution_levers_controller.rb @@ -12,6 +12,7 @@ def acd_lever_index @acd_levers_for_store = grouped_levers @acd_history = CaseDistributionAuditLeverEntry.lever_history @user_is_an_acd_admin = CDAControlGroup.singleton.user_is_admin?(current_user) + @acd_exclude_from_affinity = FeatureToggle.enabled?(:acd_exclude_from_affinity) render "index" end @@ -46,7 +47,7 @@ def authorize_admin end def allowed_params - params.permit(current_levers: [:id, :value]) + params.permit(current_levers: [:id, :value, :is_toggle_active]) end def verify_access diff --git a/app/controllers/case_distribution_levers_tests_controller.rb b/app/controllers/case_distribution_levers_tests_controller.rb index 1590c161700..f9be94cfeb6 100644 --- a/app/controllers/case_distribution_levers_tests_controller.rb +++ b/app/controllers/case_distribution_levers_tests_controller.rb @@ -12,6 +12,20 @@ def acd_lever_index_test render "case_distribution_levers/test" end + def run_demo_non_aod_hearing_seeds + Rake::Task["db:seed:demo_non_aod_hearing_case_lever_test_data"].reenable + Rake::Task["db:seed:demo_non_aod_hearing_case_lever_test_data"].invoke + + head :ok + end + + def run_demo_aod_hearing_seeds + Rake::Task["db:seed:demo_aod_hearing_case_lever_test_data"].reenable + Rake::Task["db:seed:demo_aod_hearing_case_lever_test_data"].invoke + + head :ok + end + def appeals_ready_to_distribute csv_data = AppealsReadyForDistribution.process diff --git a/app/controllers/judge_assign_tasks_controller.rb b/app/controllers/judge_assign_tasks_controller.rb index 928cae44589..04dd49ad349 100644 --- a/app/controllers/judge_assign_tasks_controller.rb +++ b/app/controllers/judge_assign_tasks_controller.rb @@ -11,6 +11,10 @@ def create tasks_to_return = (tasks + queue_for_role.tasks).uniq render json: { tasks: json_tasks(tasks_to_return) } + rescue ActiveRecord::RecordInvalid => error + invalid_record_error(error.record) + rescue Caseflow::Error::MailRoutingError => error + render(error.serialize_response) end private diff --git a/app/controllers/specialty_case_team_assign_tasks_controller.rb b/app/controllers/specialty_case_team_assign_tasks_controller.rb new file mode 100644 index 00000000000..cb5434b7a60 --- /dev/null +++ b/app/controllers/specialty_case_team_assign_tasks_controller.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class SpecialtyCaseTeamAssignTasksController < TasksController + def create + parent_task = parent_tasks_from_params.first + if parent_task.closed? + fail Caseflow::Error::ClosedTaskError + end + + render json: { tasks: json_tasks(tasks.uniq) } + end + + private + + def tasks + @tasks ||= ActiveRecord::Base.transaction do + create_params.map do |create_param| + specialty_case_team_assign_task = SpecialtyCaseTeamAssignTask.find(create_param[:parent_id]) + + # Even though this class was intended to be used with a judge assign task, It will work same with a + # SpecialtyCaseTeamAssignTask since it essentially replaces the normal judge assign task + AttorneyTaskCreator.new(specialty_case_team_assign_task, create_param).create_attorney_tasks_from_sct_params + end.flatten + end + end +end diff --git a/app/controllers/split_appeal_controller.rb b/app/controllers/split_appeal_controller.rb index 3ed93edf31b..bf3b823688b 100644 --- a/app/controllers/split_appeal_controller.rb +++ b/app/controllers/split_appeal_controller.rb @@ -36,6 +36,9 @@ def process_split(params) appeal.appeal_split_process = false dup_appeal.reload appeal.reload + if FeatureToggle.enabled?(:specialty_case_team_distribution, user: current_user) + SpecialtyCaseTeamSplitAppealHandler.new(appeal, dup_appeal, current_user).handle_split_sct_appeals + end render json: { split_appeal: dup_appeal, original_appeal: appeal }, status: :created end diff --git a/app/controllers/team_management_controller.rb b/app/controllers/team_management_controller.rb index 9cabc00d940..ca378ca0b06 100644 --- a/app/controllers/team_management_controller.rb +++ b/app/controllers/team_management_controller.rb @@ -90,7 +90,8 @@ def fail_on_duplicate_participant_id def update_params params.require(:organization).permit( - :name, :participant_id, :url, :accepts_priority_pushed_cases, :ama_only_push, :ama_only_request + :name, :participant_id, :url, :accepts_priority_pushed_cases, :ama_only_push, :ama_only_request, + :exclude_appeals_from_affinity ) end diff --git a/app/jobs/no_available_modifiers_fix_job.rb b/app/jobs/no_available_modifiers_fix_job.rb index 6cbf4c65a50..cd2fe35bc32 100644 --- a/app/jobs/no_available_modifiers_fix_job.rb +++ b/app/jobs/no_available_modifiers_fix_job.rb @@ -50,7 +50,6 @@ def process_records(supp_claims, available_space) supp_claims.each do |sc| next if available_space <= 0 - # binding.pry @stuck_job_report_service.append_single_record(sc.class.name, sc.id) ActiveRecord::Base.transaction do DecisionReviewProcessJob.perform_now(sc) diff --git a/app/models/appeal.rb b/app/models/appeal.rb index b5aab845d65..7004353d377 100644 --- a/app/models/appeal.rb +++ b/app/models/appeal.rb @@ -17,6 +17,7 @@ class Appeal < DecisionReview include AppealAvailableHearingLocations include HearingRequestTypeConcern include AppealNotificationReportConcern + include SpecialtyCaseTeamMethodsMixin prepend AppealDocketed has_many :appeal_views, as: :appeal @@ -374,9 +375,9 @@ def clone_cavc_remand(parent_appeal, user_css_id) dup_remand&.save end + # Clone issues and request_issues that the user selected + # Also clone any decision_issues/decision_request_issues tied to the request issue # :reek:RepeatedConditionals - # clone issues clones request_issues the user selected - # and anydecision_issues/decision_request_issues tied to the request issue # rubocop:disable Metrics/AbcSize, Metrics/MethodLength def clone_issues(parent_appeal, payload_params) # set request store to the user that split the appeal @@ -445,9 +446,16 @@ def clone_aod(parent_appeal) ) end + # :reek:FeatureEnvy def clone_issue(issue) dup_issue = issue.amoeba_dup dup_issue.decision_review_id = id + + # If the original issue has a contention reference id, it has to be removed because it's a unique index + if issue.try(:contention_reference_id) + issue.update!(contention_reference_id: nil) + end + dup_issue.save dup_issue end @@ -549,7 +557,7 @@ def clone_task(original_task, user_css_id) dup_task.save # set the status to the correct status - dup_task.status = original_task.status + dup_task.update_column(:status, original_task.status) # set request store to the user that split the appeal RequestStore[:current_user] = User.find_by_css_id user_css_id @@ -570,8 +578,8 @@ def clone_task_w_parent(original_task, parent_task_id) # set the status to assigned as placeholder dup_task.status = "assigned" - # set the parent to the parent_task_id - dup_task.parent_id = parent_task_id + # set the parent to the nil to skip over callbacks for the original parent or new parent + dup_task.parent_id = nil # set the appeal split process to true for the task dup_task.appeal.appeal_split_process = true @@ -579,14 +587,11 @@ def clone_task_w_parent(original_task, parent_task_id) # save the task dup_task.save(validate: false) - # set the status to the correct status - dup_task.status = original_task.status - - dup_task.save(validate: false) + # Set the status and the parent id to the correct values without triggering callbacks + dup_task.update_columns(status: original_task.status, parent_id: parent_task_id) # if the status is cancelled, pull the original canceled ID if dup_task.status == "cancelled" && !original_task.cancelled_by_id.nil? - # set request store to original task canceller to handle verification RequestStore[:current_user] = User.find(original_task.cancelled_by_id) diff --git a/app/models/case_distribution_lever.rb b/app/models/case_distribution_lever.rb index c168c1089b5..b8d36733063 100644 --- a/app/models/case_distribution_lever.rb +++ b/app/models/case_distribution_lever.rb @@ -5,17 +5,19 @@ class CaseDistributionLever < ApplicationRecord validates :item, presence: true validates :title, presence: true validates :data_type, presence: true, inclusion: { in: Constants.ACD_LEVERS.data_types.to_h.values } - validates :is_toggle_active, inclusion: { in: [true, false] } + validates :is_toggle_active, inclusion: { in: [true, false, nil] } validates :is_disabled_in_ui, inclusion: { in: [true, false] } validate :value_matches_data_type + scope :enabled_in_ui, -> { where(is_disabled_in_ui: false) } + self.table_name = "case_distribution_levers" INTEGER_LEVERS = %W( #{Constants.DISTRIBUTION.ama_direct_review_docket_time_goals} #{Constants.DISTRIBUTION.request_more_cases_minimum} #{Constants.DISTRIBUTION.alternative_batch_size} #{Constants.DISTRIBUTION.batch_size_per_attorney} - #{Constants.DISTRIBUTION.days_before_goal_due_for_distribution} + #{Constants.DISTRIBUTION.ama_direct_review_start_distribution_prior_to_goals} #{Constants.DISTRIBUTION.ama_hearing_case_affinity_days} #{Constants.DISTRIBUTION.cavc_affinity_days} #{Constants.DISTRIBUTION.ama_evidence_submission_docket_time_goals} @@ -28,15 +30,36 @@ class CaseDistributionLever < ApplicationRecord #{Constants.DISTRIBUTION.nod_adjustment} ).freeze - def distribution_value - if data_type == Constants.ACD_LEVERS.data_types.radio - option = options.detect { |opt| opt["item"] == value } - option["value"] if option&.is_a?(Hash) + def history_value + if combination_lever? + combination_value + elsif radio_lever? + radio_value else value end end + def combination_lever? + data_type == Constants.ACD_LEVERS.data_types.combination + end + + def radio_lever? + data_type == Constants.ACD_LEVERS.data_types.radio + end + + def omit? + return false unless radio_lever? + + value == Constants.ACD_LEVERS.omit + end + + def infinite? + return false unless radio_lever? + + value == Constants.ACD_LEVERS.infinite + end + private def value_matches_data_type @@ -48,7 +71,7 @@ def value_matches_data_type when Constants.ACD_LEVERS.data_types.boolean validate_boolean_data_type when Constants.ACD_LEVERS.data_types.combination - validate_options + validate_combination_data_type end end @@ -71,6 +94,32 @@ def validate_boolean_data_type add_error_value_not_match_data_type if value&.match(/\A(t|true|f|false)\z/i).nil? end + def validate_combination_data_type + errors.add(:item, "is of #{data_type} and does not contain a valid is_toggle_active value") if is_toggle_active.nil? + validate_options + end + + # this matches what is displayed in frontend + # see client/app/caseDistribution/components/SaveModal.jsx + def combination_value + toggle_string = is_toggle_active ? "Active" : "Inactive" + "#{toggle_string} - #{value}" + end + + def option(item) + options&.find { |option| option["item"] == item } || {} + end + + # this matches what is displayed in frontend + # see client/app/caseDistribution/components/SaveModal.jsx + def radio_value + return option(value)["text"] if [Constants.ACD_LEVERS.omit, Constants.ACD_LEVERS.infinite].include?(value.to_s) + + selected_option = option(Constants.ACD_LEVERS.value) + + "#{selected_option['text']} #{value}" + end + class << self def respond_to_missing?(name, _include_private) Constants.DISTRIBUTION.to_h.key?(name) @@ -91,6 +140,15 @@ def update_acd_levers(current_levers, current_user) errors = [] levers = [] + # if lever is a radio update options object + grouped_levers.each_pair do |lever_id, lever| + previous_lever = previous_levers[lever_id] + next unless previous_lever.radio_lever? + + # update options + update_radio_options(lever, previous_lever.options) + end + ActiveRecord::Base.transaction do levers = CaseDistributionLever.update(grouped_levers.keys, grouped_levers.values) @@ -102,16 +160,34 @@ def update_acd_levers(current_levers, current_user) errors.concat(add_audit_lever_entries(previous_levers, levers, current_user)) end + # Map active levers (enabled in UI) into a hash object + # Hash object has better formatting than an array when looking values in rails console + def snapshot + snapshot_hash = {} + + CaseDistributionLever.all.each_with_object(snapshot_hash) do |lever, s_hash| + s_hash[lever.item] = { + value: lever.value, + is_toggle_active: lever.is_toggle_active + } + end + + snapshot_hash + end + private def method_missing_value(name) - lever = find_by_item(name).try(:distribution_value) - - if INTEGER_LEVERS.include?(name) - lever.to_i - elsif FLOAT_LEVERS.include?(name) - lever.to_f - else + lever = find_by_item(name).try(:value) + begin + if INTEGER_LEVERS.include?(name) + Integer(lever) + elsif FLOAT_LEVERS.include?(name) + Float(lever) + else + lever + end + rescue ArgumentError lever end end @@ -123,8 +199,8 @@ def add_audit_lever_entries(previous_levers, levers, current_user) entries.push({ user: current_user, case_distribution_lever: lever, - previous_value: previous_lever.value, - update_value: lever.value + previous_value: previous_lever.history_value, + update_value: lever.history_value }) end @@ -138,5 +214,25 @@ def add_audit_lever_entries(previous_levers, levers, current_user) [] end + + # Modified by reference the lever and options objects and then add + # lever["options"] so that CaseDistributionLever.update updates the options field + def update_radio_options(lever, options) + selected_option = if [Constants.ACD_LEVERS.omit, Constants.ACD_LEVERS.infinite].include?(lever["value"]) + lever["value"] + else + Constants.ACD_LEVERS.value + end + + options.each do |option| + option["selected"] = option["item"] == selected_option + + if option["selected"] && option["item"] == Constants.ACD_LEVERS.value + option["value"] = lever["value"].to_i + end + end + + lever["options"] = options + end end end diff --git a/app/models/claim_review.rb b/app/models/claim_review.rb index 952236380c3..261bc9c09f7 100644 --- a/app/models/claim_review.rb +++ b/app/models/claim_review.rb @@ -301,6 +301,10 @@ def cleared_nonrating_ep? processed? && cleared_end_products.any?(&:nonrating?) end + def sct_appeal? + false + end + private def cleared_end_products diff --git a/app/models/concerns/automatic_case_distribution.rb b/app/models/concerns/automatic_case_distribution.rb index 47c8dd28062..3f9a4cc191a 100644 --- a/app/models/concerns/automatic_case_distribution.rb +++ b/app/models/concerns/automatic_case_distribution.rb @@ -88,6 +88,7 @@ def distribute_limited_priority_appeals_from_all_dockets(limit, style: "push") end def ama_statistics + sct_appeals_counts = @appeals.count { |appeal| appeal.try(:sct_appeal) } { batch_size: @appeals.count, total_batch_size: total_batch_size, @@ -99,7 +100,8 @@ def ama_statistics evidence_submission_proportion: docket_proportions[:evidence_submission], hearing_proportion: docket_proportions[:hearing], nonpriority_iterations: @nonpriority_iterations, - algorithm: "proportions" + algorithm: "proportions", + sct_appeals: sct_appeals_counts } end diff --git a/app/models/concerns/by_docket_date_distribution.rb b/app/models/concerns/by_docket_date_distribution.rb index b908e1a3378..851858c133a 100644 --- a/app/models/concerns/by_docket_date_distribution.rb +++ b/app/models/concerns/by_docket_date_distribution.rb @@ -59,7 +59,7 @@ def distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(limit, style end end - # rubocop:disable Metrics/MethodLength + # rubocop:disable Metrics/MethodLength, Metrics/AbcSize def ama_statistics priority_counts = { count: priority_count } nonpriority_counts = { count: nonpriority_count } @@ -76,8 +76,14 @@ def ama_statistics nonpriority_counts[:iterations] = @nonpriority_iterations + sct_appeals_counts = @appeals.count { |appeal| appeal.try(:sct_appeal) } + settings = {} - feature_toggles = [:acd_disable_legacy_distributions, :acd_disable_nonpriority_distributions] + feature_toggles = [ + :acd_disable_legacy_distributions, + :acd_disable_nonpriority_distributions, + :specialty_case_team_distribution + ] feature_toggles.each do |sym| settings[sym] = FeatureToggle.enabled?(sym, user: RequestStore.store[:current_user]) end @@ -88,6 +94,7 @@ def ama_statistics priority_target: @push_priority_target || @request_priority_count, priority: priority_counts, nonpriority: nonpriority_counts, + sct_appeals: sct_appeals_counts, distributed_cases_tied_to_ineligible_judges: { ama: ama_distributed_cases_tied_to_ineligible_judges, legacy: distributed_cases_tied_to_ineligible_judges @@ -103,7 +110,7 @@ def ama_statistics #{error.class}: #{error.message}, #{error.backtrace.first}" } end - # rubocop:enable Metrics/MethodLength + # rubocop:enable Metrics/MethodLength, Metrics/AbcSize def ama_distributed_cases_tied_to_ineligible_judges @appeals.filter_map do |appeal| diff --git a/app/models/concerns/case_distribution.rb b/app/models/concerns/case_distribution.rb index 6e551876f46..e23e854ccb1 100644 --- a/app/models/concerns/case_distribution.rb +++ b/app/models/concerns/case_distribution.rb @@ -22,11 +22,19 @@ def docket_coordinator def collect_appeals appeals = yield appeals.compact! - @rem -= appeals.count + @rem -= calculate_reduction(appeals) @appeals += appeals appeals end + def calculate_reduction(appeals) + if FeatureToggle.enabled?(:specialty_case_team_distribution, user: RequestStore.store[:current_user]) + appeals.count { |appeal| !appeal.sct_appeal } + else + appeals.count + end + end + def priority_target proportion = [priority_count.to_f / total_batch_size, 1.0].reject(&:nan?).min (proportion * batch_size).ceil diff --git a/app/models/concerns/distribution_concern.rb b/app/models/concerns/distribution_concern.rb index 20b7a6f1935..a5ba87f1d1b 100644 --- a/app/models/concerns/distribution_concern.rb +++ b/app/models/concerns/distribution_concern.rb @@ -26,6 +26,17 @@ def assign_judge_tasks_for_appeals(appeals, judge) end end + def assign_sct_tasks_for_appeals(appeals) + appeals.map do |appeal| + next nil unless appeal.tasks.open.of_type(:DistributionTask).any? + + distribution_task_assignee_id = appeal.tasks.of_type(:DistributionTask).first.assigned_to_id + Rails.logger.info("Calling SpecialtyCaseTeamAssignTaskCreator for appeal #{appeal.id}") + SpecialtyCaseTeamAssignTaskCreator.new(appeal: appeal, + assigned_by_id: distribution_task_assignee_id).call + end + end + def cancel_previous_judge_assign_task(appeal, judge_id) appeal.tasks.of_type(:JudgeAssignTask).where.not(assigned_to_id: judge_id).update(status: :cancelled) end @@ -33,4 +44,41 @@ def cancel_previous_judge_assign_task(appeal, judge_id) def slack_url ENV["SLACK_DISPATCH_ALERT_URL"] end + + # rubocop:disable Metrics/MethodLength + # :reek:FeatureEnvy + def create_sct_appeals(appeals_args, limit) + appeals = appeals(appeals_args) + .limit(limit) + .includes(:request_issues) + + sct_appeals = if FeatureToggle.enabled?(:specialty_case_team_distribution, user: RequestStore.store[:current_user]) + sct_appeals = appeals.select(&:sct_appeal?) + appeals -= sct_appeals + sct_appeals + else + [] + end + + if sct_appeals.any? + loop do + inner_appeals = appeals(appeals_args) + .limit(limit - appeals.count) + .includes(:request_issues) + .where("appeals.id NOT IN (?)", appeals.pluck(:id) + sct_appeals.pluck(:id)) + + break unless inner_appeals.exists? + + inner_sct_appeals = inner_appeals.select(&:sct_appeal?) + inner_appeals -= inner_sct_appeals + appeals += inner_appeals + sct_appeals += inner_sct_appeals + + break if appeals.count >= limit + end + end + + [appeals, sct_appeals] + end + # rubocop:enable Metrics/MethodLength end diff --git a/app/models/concerns/distribution_scopes.rb b/app/models/concerns/distribution_scopes.rb index 59ab2fbfc68..b2067ba97d8 100644 --- a/app/models/concerns/distribution_scopes.rb +++ b/app/models/concerns/distribution_scopes.rb @@ -1,6 +1,11 @@ # frozen_string_literal: true -module DistributionScopes +# This class is used in the Distribution process to easily create and customize SQL queries generated by Rails +# by extending the Appeal class. +# Note: The words "Tied To" are used in this class to refer to Appeals which fall under the affinity rules as +# determined by the Board. There are currently no AMA appeals which have a legal requirement to go to a certain +# Judge. +module DistributionScopes # rubocop:disable Metrics/ModuleLength extend ActiveSupport::Concern def with_assigned_distribution_task_sql @@ -13,4 +18,168 @@ def with_assigned_distribution_task_sql AND distribution_task.status = 'assigned' SQL end + + # From docket.rb + + def priority + include_aod_motions + .where("advance_on_docket_motions.created_at > appeals.established_at") + .where("advance_on_docket_motions.granted = ?", true) + .or(include_aod_motions.where("people.date_of_birth <= ?", 75.years.ago)) + .or(include_aod_motions.where("appeals.stream_type = ?", Constants.AMA_STREAM_TYPES.court_remand)) + .group("appeals.id") + end + + def nonpriority + include_aod_motions + .where("people.date_of_birth > ? or people.date_of_birth is null", 75.years.ago) + .where.not("appeals.stream_type = ?", Constants.AMA_STREAM_TYPES.court_remand) + .group("appeals.id") + .having("count(case when advance_on_docket_motions.granted "\ + "\n and advance_on_docket_motions.created_at > appeals.established_at then 1 end) = ?", 0) + end + + def include_aod_motions + joins(:claimants) + .joins("LEFT OUTER JOIN people on people.participant_id = claimants.participant_id") + .joins("LEFT OUTER JOIN advance_on_docket_motions on advance_on_docket_motions.person_id = people.id") + end + + def ready_for_distribution + joins(:tasks) + .group("appeals.id") + .having("count(case when tasks.type = ? and tasks.status = ? then 1 end) >= ?", + DistributionTask.name, Constants.TASK_STATUSES.assigned, 1) + end + + def genpop + join_distribution_tasks + .with_original_appeal_and_judge_task + .where( + "appeals.stream_type != ? OR distribution_task.assigned_at <= ? OR original_judge_task.assigned_to_id in (?)", + Constants.AMA_STREAM_TYPES.court_remand, + CaseDistributionLever.cavc_affinity_days.days.ago, + JudgeTeam.judges_with_exclude_appeals_from_affinity + ) + end + + def ama_non_aod_hearing_appeals + where("advance_on_docket_motions.person_id IS NULL") + .where("people.date_of_birth > ?", 75.years.ago) + end + + def ama_aod_hearing_appeals + where("advance_on_docket_motions.person_id IS NOT NULL") + .or(where("people.date_of_birth <= ?", 75.years.ago)) + end + + def with_original_appeal_and_judge_task + joins("LEFT JOIN cavc_remands ON cavc_remands.remand_appeal_id = appeals.id") + .joins("LEFT JOIN appeals AS original_cavc_appeal ON original_cavc_appeal.id = cavc_remands.source_appeal_id") + .joins( + "LEFT JOIN tasks AS original_judge_task ON original_judge_task.appeal_id = original_cavc_appeal.id + AND original_judge_task.type = 'JudgeDecisionReviewTask' + AND original_judge_task.status = 'completed'" + ) + end + + # docket.rb + # Within the first 21 days, the appeal should be distributed only to the issuing judge. + def non_genpop_for_judge(judge) + join_distribution_tasks + .with_original_appeal_and_judge_task + .where("distribution_task.assigned_at > ?", CaseDistributionLever.cavc_affinity_days.days.ago) + .where(original_judge_task: { assigned_to_id: judge&.id }) + end + + def ordered_by_distribution_ready_date + joins(:tasks) + .group("appeals.id") + .order( + Arel.sql("max(case when tasks.type = 'DistributionTask' then tasks.assigned_at end)") + ) + end + + def non_ihp + joins(:tasks) + .group("appeals.id") + .having("count(case when tasks.type = ? then 1 end) = ?", + InformalHearingPresentationTask.name, 0) + end + + # From hearing_request_distribution_query.rb + + def most_recent_hearings + query = <<-SQL + INNER JOIN + (SELECT h.appeal_id, max(hd.scheduled_for) as latest_scheduled_for + FROM hearings h + JOIN hearing_days hd on h.hearing_day_id = hd.id + GROUP BY + h.appeal_id + ) as latest_date_by_appeal + ON appeals.id = latest_date_by_appeal.appeal_id + AND hearing_days.scheduled_for = latest_date_by_appeal.latest_scheduled_for + SQL + + joins(query, hearings: :hearing_day) + end + + def tied_to_distribution_judge(judge) + join_distribution_tasks + .where(hearings: { disposition: "held", judge_id: judge.id }) + end + + def tied_to_ineligible_judge + join_distribution_tasks + .where(hearings: { disposition: "held", judge_id: HearingRequestDistributionQuery.ineligible_judges_id_cache }) + end + + def tied_to_judges_with_exclude_appeals_from_affinity + join_distribution_tasks + .where(hearings: { disposition: "held", judge_id: JudgeTeam.judges_with_exclude_appeals_from_affinity }) + end + + # If an appeal has exceeded the affinity, it should be returned to genpop. + def expired_ama_affinity_cases(lever_days) + where(hearings: { disposition: "held" }) + .where("distribution_task.assigned_at <= ?", lever_days.to_i.days.ago) + end + + def affinitized_ama_affinity_cases(lever_days) + where("distribution_task.assigned_at > ?", lever_days.to_i.days.ago) + end + + def join_distribution_tasks + joins(with_assigned_distribution_task_sql) + end + + # Historical note: We formerly had not_tied_to_any_active_judge until CASEFLOW-1928, + # when that distinction became irrelevant because cases become genpop after 30 days anyway. + def not_tied_to_any_judge + join_distribution_tasks + .where(hearings: { disposition: "held", judge_id: nil }) + end + + def with_no_hearings + left_joins(:hearings).where(hearings: { id: nil }) + end + + def with_no_held_hearings + left_joins(:hearings).where.not(hearings: { disposition: "held" }) + end + + def with_held_hearings + where(hearings: { disposition: "held" }) + end + + def lever_omitted?(lever) + CaseDistributionLever.send(lever) == "omit" + end + + def case_affinity_days_lever_value_is_selected?(lever_value) + return false if lever_value == "omit" || lever_value == "infinite" + + true + end end diff --git a/app/models/decision_review.rb b/app/models/decision_review.rb index f7f7d155f75..988c1c49406 100644 --- a/app/models/decision_review.rb +++ b/app/models/decision_review.rb @@ -124,7 +124,7 @@ def veteran_full_name end def number_of_issues - request_issues.count + request_issues.active.count end def external_id diff --git a/app/models/distributed_case.rb b/app/models/distributed_case.rb index d1cca4c292d..d44f24ee181 100644 --- a/app/models/distributed_case.rb +++ b/app/models/distributed_case.rb @@ -10,6 +10,7 @@ class DistributedCase < CaseflowRecord validates :task_id, presence: true, if: :ama_docket validates :docket_index, presence: true, if: :legacy_nonpriority validates :priority, inclusion: [true, false] + validates :sct_appeal, inclusion: [true, false], if: :ama_docket def rename_for_redistribution! ymd = Time.zone.today.strftime("%F") diff --git a/app/models/distribution.rb b/app/models/distribution.rb index 3937a9ba85f..3066975042b 100644 --- a/app/models/distribution.rb +++ b/app/models/distribution.rb @@ -10,6 +10,7 @@ class Distribution < CaseflowRecord has_many :distributed_cases belongs_to :judge, class_name: "User" + has_one :distribution_stats validates :judge, presence: true validate :validate_user_is_judge, on: :create @@ -42,21 +43,21 @@ def distribute!(limit = nil) priority_push? ? priority_push_distribution(limit) : requested_distribution - update!(status: "completed", completed_at: Time.zone.now, statistics: ama_statistics) + ama_stats = ama_statistics + + # need to store batch_size in the statistics column for use within the PushPriorityAppealsToJudgesJob + update!(status: "completed", completed_at: Time.zone.now, statistics: completed_statistics(ama_stats)) + + record_distribution_stats(ama_stats) end rescue StandardError => error - # DO NOT use update! because we want to avoid validations and saving any cached associations. - # Prevent prod database from getting Stacktraces as this is debugging information - if Rails.deploy_env?(:prod) - update_columns(status: "error", errored_at: Time.zone.now) - else - update_columns(status: "error", errored_at: Time.zone.now, statistics: error_statistics(error)) - end + process_error(error) + raise error end def distributed_cases_count - (status == "completed") ? distributed_cases.count : 0 + (status == "completed") ? distributed_cases.count { |distributed_case| !distributed_case.sct_appeal } : 0 end private @@ -132,4 +133,31 @@ def error_statistics(error) error: error&.full_message } end + + def process_error(error) + # DO NOT use update! because we want to avoid validations and saving any cached associations. + # Prevent prod database from getting Stacktraces as this is debugging information + if Rails.deploy_env?(:prod) + update_columns(status: "error", errored_at: Time.zone.now) + record_distribution_stats({}) + else + update_columns(status: "error", errored_at: Time.zone.now, statistics: error_statistics(error)) + record_distribution_stats(error_statistics(error)) + end + end + + # need to store batch_size in the statistics column for use within the PushPriorityAppealsToJudgesJob + def completed_statistics(stats) + { + batch_size: stats[:batch_size], + info: "See related row in distribution_stats for additional stats" + } + end + + def record_distribution_stats(stats) + create_distribution_stats!( + statistics: stats, + levers: CaseDistributionLever.snapshot + ) + end end diff --git a/app/models/distribution_stats.rb b/app/models/distribution_stats.rb new file mode 100644 index 00000000000..a5ff28b595c --- /dev/null +++ b/app/models/distribution_stats.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class DistributionStats < CaseflowRecord + belongs_to :distribution +end diff --git a/app/models/docket.rb b/app/models/docket.rb index b7a4e7ff8e9..d56e7bc2a13 100644 --- a/app/models/docket.rb +++ b/app/models/docket.rb @@ -3,12 +3,13 @@ class Docket include ActiveModel::Model include DistributionConcern + include DistributionScopes def docket_type fail Caseflow::Error::MustImplementInSubclass end - # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity # :reek:LongParameterList def appeals(priority: nil, genpop: nil, ready: nil, judge: nil) fail "'ready for distribution' value cannot be false" if ready == false @@ -18,6 +19,7 @@ def appeals(priority: nil, genpop: nil, ready: nil, judge: nil) if ready scope = scope.ready_for_distribution scope = adjust_for_genpop(scope, genpop, judge) if judge.present? && !use_by_docket_date? + scope = adjust_for_affinity(scope, judge) if judge.present? && FeatureToggle.enabled?(:acd_exclude_from_affinity) end return scoped_for_priority(scope) if priority == true @@ -26,7 +28,7 @@ def appeals(priority: nil, genpop: nil, ready: nil, judge: nil) scope.order("appeals.receipt_date") end - # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def count(priority: nil, ready: nil) # The underlying scopes here all use `group_by` statements, so calling @@ -86,12 +88,21 @@ def ready_priority_appeal_ids appeals(priority: true, ready: true).pluck(:uuid) end - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Lint/UnusedMethodArgument + # rubocop:disable Metrics/MethodLength, Lint/UnusedMethodArgument, Metrics/PerceivedComplexity # :reek:FeatureEnvy def distribute_appeals(distribution, priority: false, genpop: nil, limit: 1, style: "push") - appeals = appeals(priority: priority, ready: true, genpop: genpop, judge: distribution.judge).limit(limit) + if sct_distribution_enabled? + query_args = { priority: priority, ready: true, genpop: genpop, judge: distribution.judge } + appeals, sct_appeals = create_sct_appeals(query_args, limit) + else + appeals = appeals(priority: priority, ready: true, genpop: genpop, judge: distribution.judge).limit(limit) + sct_appeals = [] + end + tasks = assign_judge_tasks_for_appeals(appeals, distribution.judge) - tasks.map do |task| + sct_tasks = assign_sct_tasks_for_appeals(sct_appeals) + tasks_array = tasks + sct_tasks + tasks_array.map do |task| next if task.nil? # If a distributed case already exists for this appeal, alter the existing distributed case's case id. @@ -100,28 +111,20 @@ def distribute_appeals(distribution, priority: false, genpop: nil, limit: 1, sty if distributed_case && task.appeal.can_redistribute_appeal? distributed_case.flag_redistribution(task) distributed_case.rename_for_redistribution! - new_dist_case = distribution.distributed_cases.create!(case_id: task.appeal.uuid, - docket: docket_type, - priority: priority, - ready_at: task.appeal.ready_for_distribution_at, - task: task) + new_dist_case = create_distribution_case_for_task(distribution, task, priority) # In a race condition for distributions, two JudgeAssignTasks will be created; this cancels the first one cancel_previous_judge_assign_task(task.appeal, distribution.judge.id) # Returns the new DistributedCase as expected by calling methods; case in elsif is implicitly returned new_dist_case elsif !distributed_case - distribution.distributed_cases.create!(case_id: task.appeal.uuid, - docket: docket_type, - priority: priority, - ready_at: task.appeal.ready_for_distribution_at, - task: task) + create_distribution_case_for_task(distribution, task, priority) end end end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Lint/UnusedMethodArgument + # rubocop:enable Metrics/MethodLength, Lint/UnusedMethodArgument, Metrics/PerceivedComplexity def self.nonpriority_decisions_per_year - Appeal.extending(Scopes).nonpriority + Appeal.extending(DistributionScopes).nonpriority .joins(:decision_documents) .where("decision_date > ?", 1.year.ago) .pluck(:id).size @@ -134,6 +137,10 @@ def adjust_for_genpop(scope, genpop, judge) (genpop == "not_genpop") ? scope.non_genpop_for_judge(judge) : scope.genpop end + def adjust_for_affinity(scope, judge) + scope.genpop.or(scope.non_genpop_for_judge(judge)) + end + def scoped_for_priority(scope) if use_by_docket_date? scope.priority.order("appeals.receipt_date") @@ -143,87 +150,24 @@ def scoped_for_priority(scope) end def docket_appeals - Appeal.where(docket_type: docket_type).extending(Scopes) + Appeal.where(docket_type: docket_type).extending(DistributionScopes) end def use_by_docket_date? FeatureToggle.enabled?(:acd_distribute_by_docket_date, user: RequestStore.store[:current_user]) end - module Scopes - include DistributionScopes - - def priority - include_aod_motions - .where("advance_on_docket_motions.created_at > appeals.established_at") - .where("advance_on_docket_motions.granted = ?", true) - .or(include_aod_motions.where("people.date_of_birth <= ?", 75.years.ago)) - .or(include_aod_motions.where("appeals.stream_type = ?", Constants.AMA_STREAM_TYPES.court_remand)) - .group("appeals.id") - end - - def nonpriority - include_aod_motions - .where("people.date_of_birth > ? or people.date_of_birth is null", 75.years.ago) - .where.not("appeals.stream_type = ?", Constants.AMA_STREAM_TYPES.court_remand) - .group("appeals.id") - .having("count(case when advance_on_docket_motions.granted "\ - "\n and advance_on_docket_motions.created_at > appeals.established_at then 1 end) = ?", 0) - end - - def include_aod_motions - joins(:claimants) - .joins("LEFT OUTER JOIN people on people.participant_id = claimants.participant_id") - .joins("LEFT OUTER JOIN advance_on_docket_motions on advance_on_docket_motions.person_id = people.id") - end - - def ready_for_distribution - joins(:tasks) - .group("appeals.id") - .having("count(case when tasks.type = ? and tasks.status = ? then 1 end) >= ?", - DistributionTask.name, Constants.TASK_STATUSES.assigned, 1) - end - - def genpop - joins(with_assigned_distribution_task_sql) - .where( - "appeals.stream_type != ? OR distribution_task.assigned_at <= ?", - Constants.AMA_STREAM_TYPES.court_remand, - CaseDistributionLever.cavc_affinity_days.days.ago - ) - end - - def with_original_appeal_and_judge_task - joins("LEFT JOIN cavc_remands ON cavc_remands.remand_appeal_id = appeals.id") - .joins("LEFT JOIN appeals AS original_cavc_appeal ON original_cavc_appeal.id = cavc_remands.source_appeal_id") - .joins( - "LEFT JOIN tasks AS original_judge_task ON original_judge_task.appeal_id = original_cavc_appeal.id - AND original_judge_task.type = 'JudgeDecisionReviewTask' - AND original_judge_task.status = 'completed'" - ) - end - - # Within the first 21 days, the appeal should be distributed only to the issuing judge. - def non_genpop_for_judge(judge) - joins(with_assigned_distribution_task_sql) - .with_original_appeal_and_judge_task - .where("distribution_task.assigned_at > ?", CaseDistributionLever.cavc_affinity_days.days.ago) - .where(original_judge_task: { assigned_to_id: judge.id }) - end - - def ordered_by_distribution_ready_date - joins(:tasks) - .group("appeals.id") - .order( - Arel.sql("max(case when tasks.type = 'DistributionTask' then tasks.assigned_at end)") - ) - end + def sct_distribution_enabled? + FeatureToggle.enabled?(:specialty_case_team_distribution, user: RequestStore.store[:current_user]) + end - def non_ihp - joins(:tasks) - .group("appeals.id") - .having("count(case when tasks.type = ? then 1 end) = ?", - InformalHearingPresentationTask.name, 0) - end + # :reek:FeatureEnvy + def create_distribution_case_for_task(distribution, task, priority) + distribution.distributed_cases.create!(case_id: task.appeal.uuid, + docket: docket_type, + priority: priority, + ready_at: task.appeal.ready_for_distribution_at, + task: task, + sct_appeal: task.is_a?(SpecialtyCaseTeamAssignTask)) end end diff --git a/app/models/dockets/direct_review_docket.rb b/app/models/dockets/direct_review_docket.rb index 6b99443a572..a499f43af9e 100644 --- a/app/models/dockets/direct_review_docket.rb +++ b/app/models/dockets/direct_review_docket.rb @@ -6,10 +6,12 @@ def docket_type end def due_count - days_before_goal_due_for_distribution = CaseDistributionLever.days_before_goal_due_for_distribution - appeal_ids = if days_before_goal_due_for_distribution > 0 + ama_direct_review_start_distribution_prior_to_goals = + CaseDistributionLever.ama_direct_review_start_distribution_prior_to_goals + appeal_ids = if ama_direct_review_start_distribution_prior_to_goals > 0 appeals(priority: false, ready: true) - .where("target_decision_date <= ?", days_before_goal_due_for_distribution.days.from_now) + .where("target_decision_date <= ?", + ama_direct_review_start_distribution_prior_to_goals.days.from_now) else appeals(priority: false, ready: true) end diff --git a/app/models/dockets/hearing_request_docket.rb b/app/models/dockets/hearing_request_docket.rb index 9cd42294aec..95340f9c4c7 100644 --- a/app/models/dockets/hearing_request_docket.rb +++ b/app/models/dockets/hearing_request_docket.rb @@ -21,9 +21,9 @@ def age_of_n_oldest_genpop_priority_appeals(num) # this method needs to have the same name as the method in legacy_docket.rb for by_docket_date_distribution, # but the judge that is passed in isn't relevant here - def age_of_n_oldest_nonpriority_appeals_available_to_judge(_judge, num) + def age_of_n_oldest_nonpriority_appeals_available_to_judge(judge, num) hearing_distribution_query( - base_relation: ready_nonpriority_appeals.limit(num), genpop: "only_genpop" + base_relation: ready_nonpriority_appeals.limit(num), genpop: "only_genpop", judge: judge ).call.map(&:receipt_date) end @@ -33,19 +33,26 @@ def genpop_priority_count hearing_distribution_query(base_relation: ready_priority_appeals, genpop: "only_genpop").call.count end - def age_of_n_oldest_priority_appeals_available_to_judge(_judge, num) + def age_of_n_oldest_priority_appeals_available_to_judge(judge, num) hearing_distribution_query( - base_relation: ready_priority_appeals.limit(num), genpop: "only_genpop" - ).call.map(&:receipt_date) + base_relation: ready_priority_appeals.limit(num), genpop: "only_genpop", judge: judge + ).call.flatten.map(&:receipt_date) end # rubocop:disable Lint/UnusedMethodArgument def distribute_appeals(distribution, priority: false, genpop: "any", limit: 1, style: "push") - base_relation = appeals(priority: priority, ready: true).limit(limit) + query_args = { priority: priority, ready: true, judge: distribution.judge } + base_relation = appeals(query_args).limit(limit) - # setting genpop to "only_genpop" behind feature toggle as this module only processes AMA + # setting genpop to "only_genpop" behind feature toggle as this module only processes AMA. genpop = "only_genpop" if use_by_docket_date? + sct_appeals = extract_sct_appeals(query_args, limit) + + unless sct_appeals.empty? + base_relation = base_relation.where("appeals.id NOT IN (?)", sct_appeals.pluck(:id)) + end + appeals = hearing_distribution_query(base_relation: base_relation, genpop: genpop, judge: distribution.judge).call appeals = self.class.limit_genpop_appeals(appeals, limit) if genpop.eql? "any" @@ -53,7 +60,7 @@ def distribute_appeals(distribution, priority: false, genpop: "any", limit: 1, s appeals = self.class.limit_only_genpop_appeals(appeals, limit) if genpop.eql?("only_genpop") && limit HearingRequestCaseDistributor.new( - appeals: appeals, genpop: genpop, distribution: distribution, priority: priority + appeals: appeals, genpop: genpop, distribution: distribution, priority: priority, sct_appeals: sct_appeals ).call end # rubocop:enable Lint/UnusedMethodArgument @@ -68,16 +75,30 @@ def hearing_distribution_query(base_relation:, genpop:, judge: nil) def self.limit_genpop_appeals(appeals_array, limit) # genpop 'any' returns 2 arrays of the limited base relation. This means if we only request 2 cases, appeals is a - # 2x2 array containing 4 cases overall and we will end up distributing 4 cases rather than 2. Instead, reinstate the - # limit here by filtering out the newest cases + # 2x2 array containing 4 cases overall and we will end up distributing 4 cases rather than 2. + # Instead, reinstate the limit here by filtering out the newest cases appeals_to_reject = appeals_array.flatten.sort_by(&:ready_for_distribution_at).drop(limit) appeals_array.map { |appeals| appeals - appeals_to_reject } end + def extract_sct_appeals(query_args, limit) + if sct_distribution_enabled? + _, sct_appeals = create_sct_appeals(query_args, limit) + sct_appeals + else + [] + end + end + def self.limit_only_genpop_appeals(appeals_array, limit) + if FeatureToggle.enabled?(:acd_exclude_from_affinity) + appeals_array.flatten.sort_by(&:receipt_date).first(limit) + else + appeals_array.sort_by(&:receipt_date).first(limit) + end + # genpop 'only_genpop' returns 2 arrays of the limited base relation. This means if we only request 2 cases, # appeals is a 2x2 array containing 4 cases overall and we will end up distributing 4 cases rather than 2. # Instead, reinstate the limit here by filtering out the newest cases - appeals_array.flatten.sort_by(&:receipt_date).first(limit) end end diff --git a/app/models/legacy_appeal.rb b/app/models/legacy_appeal.rb index 25c9d152563..caa6c0c57c9 100644 --- a/app/models/legacy_appeal.rb +++ b/app/models/legacy_appeal.rb @@ -935,6 +935,10 @@ def claimant_participant_id veteran_is_not_claimant ? person_for_appellant&.participant_id : veteran&.participant_id end + def sct_appeal? + false + end + # :reek:FeatureEnvy def hearing_day_if_schedueled hearing_date = Hearing.find_by(appeal_id: id) diff --git a/app/models/mixins/specialty_case_team_methods_mixin.rb b/app/models/mixins/specialty_case_team_methods_mixin.rb new file mode 100644 index 00000000000..1c1553fd2fd --- /dev/null +++ b/app/models/mixins/specialty_case_team_methods_mixin.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module SpecialtyCaseTeamMethodsMixin + def sct_appeal? + request_issues.active.any?(&:sct_benefit_type?) + end + + def distributed? + tasks.any? { |task| task.is_a?(DistributionTask) } + end + + def specialty_case_team_assign_task? + tasks.any? { |task| task.is_a?(SpecialtyCaseTeamAssignTask) } + end + + def remove_from_current_queue! + tasks.reject { |task| %w[RootTask DistributionTask].include?(task.type) } + .each(&:cancel_task_and_child_subtasks) + end + + def reopen_distribution_task!(user) + distribution_task = tasks.find { |task| task.is_a?(DistributionTask) } + distribution_task.update!(status: Constants.TASK_STATUSES.assigned, assigned_to: Bva.singleton, assigned_by: user) + end + + # :reek:FeatureEnvy + def completed_specialty_case_team_assign_task? + tasks.any? { |task| task.is_a?(SpecialtyCaseTeamAssignTask) && task.completed? } + end + + def remove_from_specialty_case_team! + tasks.find { |task| task.is_a?(SpecialtyCaseTeamAssignTask) }&.cancelled! + end + + def move_appeal_back_to_distribution!(user) + reopen_distribution_task!(user) + remove_from_current_queue! + remove_from_specialty_case_team! + end +end diff --git a/app/models/organization.rb b/app/models/organization.rb index 9b05f6d3287..20808069ad5 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -20,6 +20,10 @@ class Organization < CaseflowRecord Constants.ORGANIZATION_STATUSES.inactive.to_sym => Constants.ORGANIZATION_STATUSES.inactive } + # Sometimes when a task referencing the assigned to field it will ask for full name if it is commonly a user + # Add this alias here to prevent errors from that assumption when it could also be an organization assigned to + alias_attribute :full_name, :name + default_scope { active } class << self @@ -168,7 +172,8 @@ def serialize participant_id: participant_id, type: type, url: url, - user_admin_path: user_admin_path + user_admin_path: user_admin_path, + exclude_appeals_from_affinity: exclude_appeals_from_affinity } end diff --git a/app/models/organizations/cda_control_group.rb b/app/models/organizations/cda_control_group.rb index 2f69a0189a1..5f5d1a71b50 100644 --- a/app/models/organizations/cda_control_group.rb +++ b/app/models/organizations/cda_control_group.rb @@ -17,4 +17,8 @@ def users_can_view_levers? def can_receive_task?(_task) false end + + def selectable_in_queue? + false + end end diff --git a/app/models/organizations/judge_team.rb b/app/models/organizations/judge_team.rb index 33735aa7686..aab4b5aad7c 100644 --- a/app/models/organizations/judge_team.rb +++ b/app/models/organizations/judge_team.rb @@ -20,6 +20,12 @@ def create_for_judge(user, ama_only_push = false, ama_only_request = false) OrganizationsUser.make_user_admin(user, org) end end + + def judges_with_exclude_appeals_from_affinity + return [] unless FeatureToggle.enabled?(:acd_exclude_from_affinity) + + active.where(exclude_appeals_from_affinity: true).flat_map(&:judge).compact.pluck(:id) + end end def judge diff --git a/app/models/organizations/specialty_case_team.rb b/app/models/organizations/specialty_case_team.rb new file mode 100644 index 00000000000..b40e1adcb72 --- /dev/null +++ b/app/models/organizations/specialty_case_team.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# The Specialty Case Team (SCT) +# +# A single organization within the Board of Veteran Appeals (BVA). +# Established to increase efficiency in decision-writing for appeals with rare issues. +# Cases with rare issues are assigned to specific attorneys that specialize in particular legal topic areas. + +class SpecialtyCaseTeam < Organization + def self.singleton + SpecialtyCaseTeam.first || SpecialtyCaseTeam.create(name: "Specialty Case Team", url: "specialty-case-team") + end + + def can_receive_task?(_task) + false + end + + def queue_tabs + [ + unassigned_tasks_tab, + action_required_tasks_tab, + completed_tasks_tab + ] + end + + def unassigned_tasks_tab + ::SpecialtyCaseTeamUnassignedTasksTab.new(assignee: self) + end + + def action_required_tasks_tab + ::SpecialtyCaseTeamActionRequiredTasksTab.new(assignee: self) + end + + def completed_tasks_tab + ::SpecialtyCaseTeamCompletedTasksTab.new(assignee: self) + end + + COLUMN_NAMES = [ + Constants.QUEUE_CONFIG.COLUMNS.BADGES.name, + Constants.QUEUE_CONFIG.COLUMNS.CASE_DETAILS_LINK.name, + Constants.QUEUE_CONFIG.COLUMNS.APPEAL_TYPE.name, + Constants.QUEUE_CONFIG.COLUMNS.DOCKET_NUMBER.name, + Constants.QUEUE_CONFIG.COLUMNS.ISSUE_COUNT.name, + Constants.QUEUE_CONFIG.COLUMNS.ISSUE_TYPES.name, + Constants.QUEUE_CONFIG.COLUMNS.DOCUMENT_COUNT_READER_LINK.name + ].compact +end diff --git a/app/models/queue_tab.rb b/app/models/queue_tab.rb index e109252b3a6..de370f8d1c6 100644 --- a/app/models/queue_tab.rb +++ b/app/models/queue_tab.rb @@ -32,7 +32,8 @@ def to_hash columns: columns.map { |column| column.to_hash(tasks) }, allow_bulk_assign: allow_bulk_assign?, contains_legacy_tasks: contains_legacy_tasks?, - defaultSort: default_sorting_hash + defaultSort: default_sorting_hash, + hide_from_queue_table_view: hide_from_queue_table_view } end @@ -78,6 +79,12 @@ def contains_legacy_tasks? false end + # Used to hide a specific tab from some pages in the App. + # The primary queue pages will not display a tab with this set to true + def hide_from_queue_table_view + false + end + # rubocop:disable Metrics/AbcSize def self.attorney_column_names [ @@ -136,6 +143,10 @@ def recently_completed_tasks Task.includes(*task_includes).visible_in_queue_table_view.where(assigned_to: assignee).recently_completed end + def last_14_days_completed_tasks + Task.includes(*task_includes).visible_in_queue_table_view.where(assigned_to: assignee).last_14_days_completed + end + # Recently completed tasks that do not have younger sibling tasks # (tasks with the same parent task but have been created more recently) with the same assignee. def recently_completed_tasks_without_younger_siblings diff --git a/app/models/queue_tabs/specialty_case_team_action_required_tasks_tab.rb b/app/models/queue_tabs/specialty_case_team_action_required_tasks_tab.rb new file mode 100644 index 00000000000..dbb4f507719 --- /dev/null +++ b/app/models/queue_tabs/specialty_case_team_action_required_tasks_tab.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class SpecialtyCaseTeamActionRequiredTasksTab < QueueTab + validate :assignee_is_organization + + attr_accessor :show_reader_link_column, :allow_bulk_assign + + def label + COPY::SPECIALTY_CASE_TEAM_QUEUE_PAGE_ACTION_REQUIRED_TAB_TITLE + end + + def self.tab_name + Constants.QUEUE_CONFIG.SPECIALTY_CASE_TEAM_ACTION_REQUIRED_TASKS_TAB_NAME + end + + def description + COPY::SPECIALTY_CASE_TEAM_QUEUE_PAGE_ACTION_REQUIRED_TAB_DESCRIPTION + end + + def tasks + in_progress_tasks + end + + def column_names + SpecialtyCaseTeam::COLUMN_NAMES + end +end diff --git a/app/models/queue_tabs/specialty_case_team_completed_tasks_tab.rb b/app/models/queue_tabs/specialty_case_team_completed_tasks_tab.rb new file mode 100644 index 00000000000..77e8bfec623 --- /dev/null +++ b/app/models/queue_tabs/specialty_case_team_completed_tasks_tab.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class SpecialtyCaseTeamCompletedTasksTab < QueueTab + validate :assignee_is_organization + + attr_accessor :show_reader_link_column, :allow_bulk_assign + + def label + COPY::ORGANIZATIONAL_QUEUE_COMPLETED_TAB_TITLE + end + + def self.tab_name + Constants.QUEUE_CONFIG.SPECIALTY_CASE_TEAM_COMPLETED_TASKS_TAB_NAME + end + + def description + COPY::SPECIALTY_CASE_TEAM_QUEUE_PAGE_COMPLETED_TAB_DESCRIPTION + end + + def tasks + last_14_days_completed_tasks + end + + def column_names + SpecialtyCaseTeam::COLUMN_NAMES + end +end diff --git a/app/models/queue_tabs/specialty_case_team_unassigned_tasks_tab.rb b/app/models/queue_tabs/specialty_case_team_unassigned_tasks_tab.rb new file mode 100644 index 00000000000..6897597ece6 --- /dev/null +++ b/app/models/queue_tabs/specialty_case_team_unassigned_tasks_tab.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +class SpecialtyCaseTeamUnassignedTasksTab < QueueTab + validate :assignee_is_organization + + attr_accessor :show_reader_link_column, :allow_bulk_assign + + def label + COPY::ORGANIZATIONAL_QUEUE_PAGE_UNASSIGNED_TAB_TITLE + end + + def self.tab_name + Constants.QUEUE_CONFIG.SPECIALTY_CASE_TEAM_UNASSIGNED_TASKS_TAB_NAME + end + + def description + format(COPY::ORGANIZATIONAL_QUEUE_PAGE_UNASSIGNED_TASKS_DESCRIPTION, assignee.name) + end + + def tasks + assigned_tasks + end + + def column_names + SpecialtyCaseTeam::COLUMN_NAMES + end + + # This only affects bulk assign on the standard queue tab view + def allow_bulk_assign? + true + end + + def hide_from_queue_table_view + true + end +end diff --git a/app/models/request_issue.rb b/app/models/request_issue.rb index a21f0cdef77..d9d4bd5ca08 100644 --- a/app/models/request_issue.rb +++ b/app/models/request_issue.rb @@ -364,6 +364,10 @@ def vha_predocket? benefit_type == "vha" && predocket_needed? end + def sct_benefit_type? + Constants::SPECIALTY_CASE_TEAM_BENEFIT_TYPES.key?(benefit_type) + end + def description return edited_description if edited_description.present? return contested_issue_description if contested_issue_description diff --git a/app/models/request_issues_update.rb b/app/models/request_issues_update.rb index 2e9cedeed31..5b184d11e49 100644 --- a/app/models/request_issues_update.rb +++ b/app/models/request_issues_update.rb @@ -38,6 +38,7 @@ def perform! create_mst_pact_issue_update_tasks end create_business_line_tasks! if added_issues.present? + handle_sct_issue_updates cancel_active_tasks submit_for_processing! end @@ -111,6 +112,37 @@ def all_updated_issues correction_issues + mst_edited_issues + pact_edited_issues end + def move_review_to_sct_queue + # If appeal has VHA issue, not in the SCT Queue and not PreDocketed, then move to the SCT Queue + if review.sct_appeal? && !review.specialty_case_team_assign_task? && review.distributed? + # Cancel open queue tasks and create a specialty case team assign task to direct it to the SCT org + review.remove_from_current_queue! + SpecialtyCaseTeamAssignTask.find_or_create_by( + appeal: review, + parent: review.root_task, + assigned_to: SpecialtyCaseTeam.singleton, + assigned_by: user + ) + end + end + + def move_review_to_distribution + # If an appeal does not have an SCT issue, it was in the SCT queue, and is not PreDocketed, + # then move it back to distribution + if !review.sct_appeal? && review.specialty_case_team_assign_task? && review.distributed? + review.remove_from_current_queue! + review.remove_from_specialty_case_team! + review.reopen_distribution_task!(user) + end + end + + def handle_sct_issue_updates + if FeatureToggle.enabled?(:specialty_case_team_distribution, user: user) && review.is_a?(Appeal) + move_review_to_sct_queue + move_review_to_distribution + end + end + private def changes? diff --git a/app/models/serializers/work_queue/appeal_serializer.rb b/app/models/serializers/work_queue/appeal_serializer.rb index 99926d79078..1b6cdb0b63d 100644 --- a/app/models/serializers/work_queue/appeal_serializer.rb +++ b/app/models/serializers/work_queue/appeal_serializer.rb @@ -332,4 +332,6 @@ class WorkQueue::AppealSerializer Constants.CAVC_DECISION_TYPES.settlement ]).count end + + attribute :has_completed_sct_assign_task, &:completed_specialty_case_team_assign_task? end diff --git a/app/models/serializers/work_queue/task_column_serializer.rb b/app/models/serializers/work_queue/task_column_serializer.rb index f2ed1f5655a..e1ad582a7e2 100644 --- a/app/models/serializers/work_queue/task_column_serializer.rb +++ b/app/models/serializers/work_queue/task_column_serializer.rb @@ -93,7 +93,7 @@ def self.serialize_attribute?(params, columns) if object.appeal.is_a?(LegacyAppeal) object.appeal.issue_categories else - object.appeal.request_issues.map(&:nonrating_issue_category) + object.appeal.request_issues.active.map(&:nonrating_issue_category) end.join(",") end end @@ -115,7 +115,7 @@ def self.serialize_attribute?(params, columns) end attribute :label do |object, params| - columns = [Constants.QUEUE_CONFIG.COLUMNS.TASK_TYPE.name] + columns = [Constants.QUEUE_CONFIG.COLUMNS.TASK_TYPE.name, Constants.QUEUE_CONFIG.COLUMNS.ISSUE_TYPES.name] if serialize_attribute?(params, columns) object.label @@ -170,7 +170,8 @@ def self.serialize_attribute?(params, columns) attribute :assigned_to do |object, params| columns = [ - Constants.QUEUE_CONFIG.COLUMNS.TASK_ASSIGNEE.name + Constants.QUEUE_CONFIG.COLUMNS.TASK_ASSIGNEE.name, + Constants.QUEUE_CONFIG.COLUMNS.ISSUE_TYPES.name ] assignee = object.assigned_to @@ -361,6 +362,8 @@ def self.serialize_attribute?(params, columns) end end + attribute :appeal_type + # UNUSED attribute :assignee_name do @@ -387,10 +390,6 @@ def self.serialize_attribute?(params, columns) nil end - attribute :appeal_type do - nil - end - attribute :timeline_title do nil end diff --git a/app/models/serializers/work_queue/task_serializer.rb b/app/models/serializers/work_queue/task_serializer.rb index 8490d064bdf..4af2adfddb8 100644 --- a/app/models/serializers/work_queue/task_serializer.rb +++ b/app/models/serializers/work_queue/task_serializer.rb @@ -149,7 +149,7 @@ class WorkQueue::TaskSerializer if object.appeal.is_a?(LegacyAppeal) object.appeal.issue_categories else - object.appeal.request_issues.map(&:nonrating_issue_category) + object.appeal.request_issues.active.map(&:nonrating_issue_category) end.join(",") end diff --git a/app/models/task.rb b/app/models/task.rb index 9c4153f4358..b279a5f71fc 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -89,6 +89,8 @@ class << self; undef_method :open; end scope :recently_completed, -> { completed.where(closed_at: (Time.zone.now - 1.week)..Time.zone.now) } + scope :last_14_days_completed, -> { completed.where(closed_at: (Time.zone.now - 2.weeks)..Time.zone.now) } + scope :incomplete_or_recently_completed, -> { open.or(recently_completed) } scope :of_type, ->(task_type) { where(type: task_type) } diff --git a/app/models/tasks/attorney_task.rb b/app/models/tasks/attorney_task.rb index 040fe5c71fb..e279ab58660 100644 --- a/app/models/tasks/attorney_task.rb +++ b/app/models/tasks/attorney_task.rb @@ -23,7 +23,7 @@ def available_actions(user) (Constants.TASK_ACTIONS.LIT_SUPPORT_PULAC_CERULLO.to_h if ama? && appeal.vacate?), Constants.TASK_ACTIONS.REVIEW_DECISION_DRAFT.to_h, Constants.TASK_ACTIONS.ADD_ADMIN_ACTION.to_h, - Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h + attorney_cancel_action ].compact movement_actions = [ @@ -78,8 +78,24 @@ def send_back_to_judge_assign!(params = {}) end end + def send_back_to_sct_queue!(params = {}) + transaction do + update_with_instructions(params.merge(status: :cancelled)) + parent.update_with_instructions(params.merge(status: :cancelled)) + sct_assign_task = reopen_sct_assign_task + + [self, parent, sct_assign_task] + end + end + def update_from_params(params, user) - update_params_will_cancel_attorney_task?(params) ? send_back_to_judge_assign!(params) : super(params, user) + if update_params_will_move_appeal_back_to_sct_queue?(params) + send_back_to_sct_queue!(params) + elsif update_params_will_cancel_attorney_task?(params) + send_back_to_judge_assign!(params) + else + super(params, user) + end end private @@ -88,6 +104,10 @@ def update_params_will_cancel_attorney_task?(params) type == AttorneyTask.name && params[:status].eql?(Constants.TASK_STATUSES.cancelled) end + def update_params_will_move_appeal_back_to_sct_queue?(params) + update_params_will_cancel_attorney_task?(params) && appeal.sct_appeal? + end + def can_be_moved_by_user?(user) return false unless parent.is_a?(JudgeTask) @@ -105,8 +125,9 @@ def self_assigned?(user) def assigned_to_role_is_valid is_self = assigned_to == assigned_by + errored = assigned_to && !assigned_to.attorney_in_vacols? && !is_self - errors.add(:assigned_to, "has to be an attorney") if assigned_to && !assigned_to.attorney_in_vacols? && !is_self + errors.add(:base, "The selected individual is not an attorney in VACOLS") if errored end def assigned_by_role_is_valid @@ -118,4 +139,18 @@ def assigned_by_role_is_valid def open_judge_assign_task JudgeAssignTask.create!(appeal: appeal, parent: appeal.root_task, assigned_to: parent.assigned_to) end + + def reopen_sct_assign_task + sct_task = SpecialtyCaseTeamAssignTask.find_by(appeal: appeal) + sct_task.update!(status: Constants.TASK_STATUSES.in_progress) + sct_task + end + + def attorney_cancel_action + if ama? && appeal.completed_specialty_case_team_assign_task? + Constants.TASK_ACTIONS.CANCEL_TASK_AND_RETURN_TO_SCT_QUEUE.to_h + else + Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h + end + end end diff --git a/app/models/tasks/specialty_case_team_assign_task.rb b/app/models/tasks/specialty_case_team_assign_task.rb new file mode 100644 index 00000000000..7aedb5b8742 --- /dev/null +++ b/app/models/tasks/specialty_case_team_assign_task.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Task assigned to the Specialty Case Team organization from which one of the SCT Coordinators will assign the +# associated appeal to one of their attorneys by creating a couple of tasks (a JudgeDecisionReviewTask +# and an AttorneyTask) to draft a decision on the appeal. +# +# Task is created as a result of case distribution. +# Task should always have a RootTask as its parent. +# An active task will result in the case appearing in the Specialty Case Team bulk Assign View. +# +# Expected parent task: RootTask +# +# Expected child task: None + +class SpecialtyCaseTeamAssignTask < Task + validate :only_open_task_of_type, on: :create, + unless: :skip_check_for_only_open_task_of_type + + SPECIALTY_CASE_TEAM_TASK_ACTIONS = [ + Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.to_h + ].freeze + + def available_actions(user) + return [] unless assigned_to.user_has_access?(user) + + SPECIALTY_CASE_TEAM_TASK_ACTIONS + end + + def self.label + COPY::SPECIALTY_CASE_TEAM_ASSIGN_TASK_LABEL + end +end diff --git a/app/models/user.rb b/app/models/user.rb index e663375c066..8e71a163290 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -286,6 +286,10 @@ def vha_employee? member_of_organization?(VhaBusinessLine.singleton) end + def specialty_case_team_coordinator? + member_of_organization?(SpecialtyCaseTeam.singleton) + end + def organization_queue_user? organizations.any? end @@ -328,7 +332,7 @@ def current_case_assignments end def administered_teams - organizations_users.admin.map(&:organization).compact + organizations_users.includes(:organization).admin.map(&:organization).compact end def administered_judge_teams @@ -360,11 +364,11 @@ def user_info_for_idt self.class.user_repository.user_info_for_idt(css_id) end + # rubocop:disable Metrics/MethodLength def selectable_organizations orgs = organizations.select(&:selectable_in_queue?) judge_team_judges = judge? ? [self] : [] judge_team_judges |= administered_judge_teams.map(&:judge) if FeatureToggle.enabled?(:judge_admin_scm) - camo_team_users = camo_employee? ? [self] : [] judge_team_judges.each do |judge| orgs << { @@ -373,15 +377,23 @@ def selectable_organizations } end - camo_team_users.each do |user| + if camo_employee? orgs << { name: "Assign VHA CAMO", - url: "/queue/#{user.css_id}/assign?role=camo" + url: "/queue/#{css_id}/assign?role=camo" + } + end + + if specialty_case_team_coordinator? + orgs << { + name: "Assign SCT Appeals", + url: "/queue/#{css_id}/assign?role=sct_coordinator" } end orgs end + # rubocop:enable Metrics/MethodLength def member_of_organization?(org) organizations.include?(org) diff --git a/app/queries/hearing_request_distribution_query.rb b/app/queries/hearing_request_distribution_query.rb index d36d30cf092..ec495b2f761 100644 --- a/app/queries/hearing_request_distribution_query.rb +++ b/app/queries/hearing_request_distribution_query.rb @@ -1,17 +1,29 @@ # frozen_string_literal: true class HearingRequestDistributionQuery + include DistributionScopes + def initialize(base_relation:, genpop:, judge: nil, use_by_docket_date: false) - @base_relation = base_relation.extending(Scopes) + @base_relation = base_relation.extending(DistributionScopes) @genpop = genpop @judge = judge @use_by_docket_date = use_by_docket_date end - def call + def call # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity return not_genpop_appeals if genpop == "not_genpop" - return only_genpop_appeals if genpop == "only_genpop" + if genpop == "only_genpop" + include_feature = FeatureToggle.enabled?(:acd_exclude_from_affinity) || + (CaseDistributionLever.ama_hearing_case_affinity_days == Constants.ACD_LEVERS.omit && + CaseDistributionLever.ama_hearing_case_aod_affinity_days == Constants.ACD_LEVERS.omit) + + return [*not_genpop_appeals, *only_genpop_appeals] if include_feature && + judge.present? + + # if the featue toggle is disabled or judge isn't present then the following line will fail feature tests + return only_genpop_appeals + end # We are returning an array of arrays in order to process the # "not_genpop_appeals" separately from the "only_genpop_appeals" in @@ -35,107 +47,136 @@ def self.ineligible_judges_id_cache attr_reader :base_relation, :genpop, :judge def not_genpop_appeals - base_relation.most_recent_hearings.tied_to_distribution_judge(judge) + ama_non_aod_hearing_query = generate_ama_not_genpop_non_aod_hearing_query(base_relation) + ama_aod_hearing_query = generate_ama_not_genpop_aod_hearing_query(base_relation) + + ama_non_aod_hearing_query.or(ama_aod_hearing_query).uniq end def only_genpop_appeals - no_hearings_or_no_held_hearings = with_no_hearings.or(with_no_held_hearings) - - # returning early as most_recent_held_hearings_not_tied_to_any_judge is redundant - if @use_by_docket_date && !FeatureToggle.enabled?(:acd_cases_tied_to_judges_no_longer_with_board) - return [ - with_held_hearings, - no_hearings_or_no_held_hearings - ].flatten.uniq + ama_non_aod_hearing_query = generate_ama_only_genpop_non_aod_hearing_query(base_relation) + ama_aod_hearing_query = generate_ama_only_genpop_aod_hearing_query(base_relation) + hearings_with_no_judge = base_relation.most_recent_hearings.not_tied_to_any_judge + + result = ama_non_aod_hearing_query.or(ama_aod_hearing_query).or(hearings_with_no_judge) + + if FeatureToggle.enabled?(:acd_cases_tied_to_judges_no_longer_with_board) + result = result.or( + base_relation + .most_recent_hearings + .tied_to_ineligible_judge + ) end - # We are combining two queries using an array because using `or` doesn't work - # due to incompatibilities between the two queries. - [ - most_recent_held_hearings_not_tied_to_any_judge, - most_recent_held_hearings_exceeding_affinity_threshold, - most_recent_held_hearings_tied_to_ineligible_judge, - no_hearings_or_no_held_hearings - ].flatten.uniq - end + if FeatureToggle.enabled?(:acd_exclude_from_affinity) + result = result.or( + base_relation + .most_recent_hearings + .tied_to_judges_with_exclude_appeals_from_affinity + ) + end - def most_recent_held_hearings_exceeding_affinity_threshold - base_relation.most_recent_hearings.exceeding_affinity_threshold - end + # the base result is doing an inner join with hearings so it isn't retrieving any appeals that have no hearings + # yet, so we add with_no_hearings to retrieve those appeals + no_hearings_or_no_held_hearings = with_no_hearings.or(with_no_held_hearings) - def most_recent_held_hearings_not_tied_to_any_judge - base_relation.most_recent_hearings.not_tied_to_any_judge + [*result, *no_hearings_or_no_held_hearings].uniq end - def with_no_hearings - base_relation.with_no_hearings + def generate_ama_not_genpop_non_aod_hearing_query(base_relation) + query = + if case_affinity_days_lever_value_is_selected?(CaseDistributionLever.ama_hearing_case_affinity_days) + base_relation + .most_recent_hearings + .tied_to_distribution_judge(judge) + .ama_non_aod_hearing_appeals + .affinitized_ama_affinity_cases(CaseDistributionLever.ama_hearing_case_affinity_days) + elsif CaseDistributionLever.ama_hearing_case_affinity_days == Constants.ACD_LEVERS.infinite + base_relation + .most_recent_hearings + .tied_to_distribution_judge(judge) + .ama_non_aod_hearing_appeals + elsif CaseDistributionLever.ama_hearing_case_affinity_days == Constants.ACD_LEVERS.omit + base_relation + .most_recent_hearings + .join_distribution_tasks + .none + end + + query end - def with_no_held_hearings - base_relation.with_no_held_hearings + def generate_ama_not_genpop_aod_hearing_query(base_relation) + query = + if case_affinity_days_lever_value_is_selected?(CaseDistributionLever.ama_hearing_case_aod_affinity_days) + base_relation + .most_recent_hearings + .tied_to_distribution_judge(judge) + .ama_aod_hearing_appeals + .affinitized_ama_affinity_cases(CaseDistributionLever.ama_hearing_case_aod_affinity_days) + elsif CaseDistributionLever.ama_hearing_case_aod_affinity_days == Constants.ACD_LEVERS.infinite + base_relation + .most_recent_hearings + .tied_to_distribution_judge(judge) + .ama_aod_hearing_appeals + elsif CaseDistributionLever.ama_hearing_case_aod_affinity_days == Constants.ACD_LEVERS.omit + base_relation + .most_recent_hearings + .join_distribution_tasks + .none + end + + query end - def with_held_hearings - base_relation.most_recent_hearings.with_held_hearings + def generate_ama_only_genpop_non_aod_hearing_query(base_relation) + query = + if case_affinity_days_lever_value_is_selected?(CaseDistributionLever.ama_hearing_case_affinity_days) + base_relation + .most_recent_hearings + .join_distribution_tasks + .ama_non_aod_hearing_appeals + .expired_ama_affinity_cases(CaseDistributionLever.ama_hearing_case_affinity_days) + elsif CaseDistributionLever.ama_hearing_case_affinity_days == Constants.ACD_LEVERS.infinite + base_relation + .most_recent_hearings + .join_distribution_tasks + .none + elsif CaseDistributionLever.ama_hearing_case_affinity_days == Constants.ACD_LEVERS.omit + base_relation + .most_recent_hearings + .join_distribution_tasks + .with_held_hearings + .ama_non_aod_hearing_appeals + end + + query end - def most_recent_held_hearings_tied_to_ineligible_judge - base_relation.most_recent_hearings.tied_to_ineligible_judge + def generate_ama_only_genpop_aod_hearing_query(base_relation) + query = + if case_affinity_days_lever_value_is_selected?(CaseDistributionLever.ama_hearing_case_aod_affinity_days) + base_relation + .most_recent_hearings + .join_distribution_tasks + .ama_aod_hearing_appeals + .expired_ama_affinity_cases(CaseDistributionLever.ama_hearing_case_aod_affinity_days) + elsif CaseDistributionLever.ama_hearing_case_aod_affinity_days == Constants.ACD_LEVERS.infinite + base_relation + .most_recent_hearings + .join_distribution_tasks + .none + elsif CaseDistributionLever.ama_hearing_case_aod_affinity_days == Constants.ACD_LEVERS.omit + base_relation + .most_recent_hearings + .join_distribution_tasks + .with_held_hearings + .ama_aod_hearing_appeals + end + + query end - module Scopes - include DistributionScopes - def most_recent_hearings - query = <<-SQL - INNER JOIN - (SELECT h.appeal_id, max(hd.scheduled_for) as latest_scheduled_for - FROM hearings h - JOIN hearing_days hd on h.hearing_day_id = hd.id - GROUP BY - h.appeal_id - ) as latest_date_by_appeal - ON appeals.id = latest_date_by_appeal.appeal_id - AND hearing_days.scheduled_for = latest_date_by_appeal.latest_scheduled_for - SQL - - joins(query, hearings: :hearing_day) - end - - def tied_to_distribution_judge(judge) - joins(with_assigned_distribution_task_sql) - .where(hearings: { disposition: "held", judge_id: judge.id }) - .where("distribution_task.assigned_at > ?", - CaseDistributionLever.ama_hearing_case_affinity_days.days.ago) - end - - def tied_to_ineligible_judge - where(hearings: { disposition: "held", judge_id: HearingRequestDistributionQuery.ineligible_judges_id_cache }) - .where("1 = ?", FeatureToggle.enabled?(:acd_cases_tied_to_judges_no_longer_with_board) ? 1 : 0) - end - - # If an appeal has exceeded the affinity, it should be returned to genpop. - def exceeding_affinity_threshold - joins(with_assigned_distribution_task_sql) - .where(hearings: { disposition: "held" }) - .where("distribution_task.assigned_at <= ?", CaseDistributionLever.ama_hearing_case_affinity_days.days.ago) - end - - # Historical note: We formerly had not_tied_to_any_active_judge until CASEFLOW-1928, - # when that distinction became irrelevant because cases become genpop after 30 days anyway. - def not_tied_to_any_judge - where(hearings: { disposition: "held", judge_id: nil }) - end - - def with_no_hearings - left_joins(:hearings).where(hearings: { id: nil }) - end - - def with_no_held_hearings - left_joins(:hearings).where.not(hearings: { disposition: "held" }) - end - - def with_held_hearings - where(hearings: { disposition: "held" }) - end - end + delegate :with_no_hearings, to: :base_relation + delegate :with_no_held_hearings, to: :base_relation end diff --git a/app/repositories/task_action_repository.rb b/app/repositories/task_action_repository.rb index cc6374acd72..5f9683719f7 100644 --- a/app/repositories/task_action_repository.rb +++ b/app/repositories/task_action_repository.rb @@ -885,6 +885,18 @@ def mark_task_complete_data(*) } end + def cancel_task_and_return_to_sct_action(task, _) + { + modal_title: COPY::RETURN_TO_SCT_MODAL_TITLE, + modal_body: COPY::RETURN_TO_SCT_MODAL_BODY, + modal_button_text: COPY::MODAL_RETURN_BUTTON, + instructions_label: COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, + show_instructions: true, + message_title: format(COPY::RETURN_TO_SCT_SUCCESS_BANNER_TITLE, task.appeal.claimant.name), + message_detail: COPY::RETURN_TO_SCT_SUCCESS_BANNER_DETAIL + } + end + private def select_ama_review_decision_action(task) diff --git a/app/services/bva_appeal_status.rb b/app/services/bva_appeal_status.rb index c12144958d9..6fd66d36048 100644 --- a/app/services/bva_appeal_status.rb +++ b/app/services/bva_appeal_status.rb @@ -8,6 +8,7 @@ class BVAAppealStatus SORT_KEYS = { not_distributed: 1, distributed_to_judge: 2, + distributed_to_specialty_case_team: 2, assigned_to_attorney: 3, assigned_to_colocated: 4, in_progress: 5, @@ -26,6 +27,7 @@ class BVAAppealStatus DEFINITIONS = { not_distributed: "1. Not distributed", distributed_to_judge: "2. Distributed to judge", + distributed_to_specialty_case_team: "2. Distributed to Specialty Case Team", assigned_to_attorney: "3. Assigned to attorney", assigned_to_colocated: "4. Assigned to colocated", in_progress: "5. Decision in progress", @@ -93,10 +95,7 @@ def as_json(_args) attr_reader :appeal delegate :tasks, to: :appeal - - # rubocop:disable Metrics/MethodLength - # rubocop:disable Metrics/CyclomaticComplexity - # rubocop:disable Metrics/PerceivedComplexity + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength def compute if open_pre_docket_task? :pre_docketed @@ -126,13 +125,13 @@ def compute :misc elsif open_timed_hold_task? :on_hold + elsif active_specialty_case_team_assign_task? + :distributed_to_specialty_case_team else :unknown end end - # rubocop:enable Metrics/MethodLength - # rubocop:enable Metrics/CyclomaticComplexity - # rubocop:enable Metrics/PerceivedComplexity + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength def open_tasks @open_tasks ||= tasks.open @@ -210,4 +209,8 @@ def cancelled_root_task? def misc_task? active_tasks.any? { |task| self.class.misc_task_names.include?(task.type) } end + + def active_specialty_case_team_assign_task? + active_tasks.any? { |task| task.is_a?(SpecialtyCaseTeamAssignTask) } + end end diff --git a/app/services/cached_appeal_service.rb b/app/services/cached_appeal_service.rb index 290de48b8eb..7f46b04ca7e 100644 --- a/app/services/cached_appeal_service.rb +++ b/app/services/cached_appeal_service.rb @@ -134,7 +134,7 @@ def import_cached_appeals(conflict_columns, columns) end def request_issue_counts_for_appeal_ids(appeal_ids) - RequestIssue.where(decision_review_id: appeal_ids, decision_review_type: Appeal.name) + RequestIssue.active.where(decision_review_id: appeal_ids, decision_review_type: Appeal.name) .group(:decision_review_id).count end @@ -144,7 +144,10 @@ def request_issue_types_for_appeal_ids(appeal_ids) .all .map do |appeal| # Matches front end sorting with no duplicates. Issues associated to same appeal are sorted alphanumerically - [appeal.id, appeal.request_issues.map(&:nonrating_issue_category).compact.uniq.sort_by(&:upcase).join(",")] + [ + appeal.id, + appeal.request_issues.active.map(&:nonrating_issue_category).compact.uniq.sort_by(&:upcase).join(",") + ] end .to_h end diff --git a/app/views/appeals/edit.html.erb b/app/views/appeals/edit.html.erb index 052d84c36c8..1e6c975aea4 100644 --- a/app/views/appeals/edit.html.erb +++ b/app/views/appeals/edit.html.erb @@ -14,6 +14,8 @@ buildDate: build_date, serverIntake: appeal.ui_hash, claimId: url_appeal_uuid, + hasDistributionTask: appeal.try(:distributed?), + hasSpecialtyCaseTeamAssignTask: appeal.try(:specialty_case_team_assign_task?), isLegacy: appeal.is_legacy?, featureToggles: { useAmaActivationDate: FeatureToggle.enabled?(:use_ama_activation_date, user: current_user), @@ -21,6 +23,7 @@ covidTimelinessExemption: FeatureToggle.enabled?(:covid_timeliness_exemption, user: current_user), split_appeal_workflow: FeatureToggle.enabled?(:split_appeal_workflow, user: current_user), cc_appeal_workflow: FeatureToggle.enabled?(:cc_appeal_workflow, user: current_user), + specialtyCaseTeamDistribution: FeatureToggle.enabled?(:specialty_case_team_distribution, user: current_user), mstIdentification: FeatureToggle.enabled?(:mst_identification, user: current_user), pactIdentification: FeatureToggle.enabled?(:pact_identification, user: current_user), legacyMstPactIdentification: FeatureToggle.enabled?(:legacy_mst_pact_identification, user: current_user), diff --git a/app/views/case_distribution_levers/index.html.erb b/app/views/case_distribution_levers/index.html.erb index 691b084a51a..f973dec10bb 100644 --- a/app/views/case_distribution_levers/index.html.erb +++ b/app/views/case_distribution_levers/index.html.erb @@ -7,7 +7,8 @@ acdLeversForStore: @acd_levers_for_store, acd_levers: @acd_levers, acd_history: @acd_history, - user_is_an_acd_admin: @user_is_an_acd_admin + user_is_an_acd_admin: @user_is_an_acd_admin, + acd_exclude_from_affinity: @acd_exclude_from_affinity }) %> <% end %> diff --git a/app/views/queue/index.html.erb b/app/views/queue/index.html.erb index 38efc06f513..60ded4506a7 100644 --- a/app/views/queue/index.html.erb +++ b/app/views/queue/index.html.erb @@ -7,6 +7,7 @@ organizations: current_user.selectable_organizations.map {|o| o.slice(:name, :url)}, userIsVsoEmployee: current_user.vso_employee?, userIsCamoEmployee: current_user.camo_employee?, + userIsSCTCoordinator: current_user.specialty_case_team_coordinator?, canEditAod: AodTeam.singleton.user_has_access?(current_user), caseSearchHomePage: case_search_home_page, dropdownUrls: dropdown_urls, @@ -61,7 +62,8 @@ cc_vacatur_visibility: FeatureToggle.enabled?(:cc_vacatur_visibility, user: current_user), additional_remand_reasons: FeatureToggle.enabled?(:additional_remand_reasons, user: current_user), acd_cases_tied_to_judges_no_longer_with_board: FeatureToggle.enabled?(:acd_cases_tied_to_judges_no_longer_with_board, user: current_user), - admin_case_distribution: FeatureToggle.enabled?(:admin_case_distribution, user: current_user) + admin_case_distribution: FeatureToggle.enabled?(:admin_case_distribution, user: current_user), + acd_exclude_from_affinity: FeatureToggle.enabled?(:acd_exclude_from_affinity, user: current_user) } }) %> <% end %> diff --git a/app/workflows/attorney_task_creator.rb b/app/workflows/attorney_task_creator.rb index 135b37f751f..1fb103d0432 100644 --- a/app/workflows/attorney_task_creator.rb +++ b/app/workflows/attorney_task_creator.rb @@ -10,6 +10,10 @@ def call tasks end + def create_attorney_tasks_from_sct_params + tasks_from_specialty_case_team_assign_task + end + private attr_reader :judge_assign_task, :task_params @@ -22,4 +26,22 @@ def tasks attorney_task = AttorneyTask.create!(Task.modify_params_for_create(task_params.merge(parent: judge_review_task))) [attorney_task, judge_review_task, judge_assign_task] end + + def tasks_from_specialty_case_team_assign_task + # The judge assign task in this context is really a SpecialtyCaseTeamAssignTask + assigned_attorney = User.find(task_params[:assigned_to_id]) + + # Select a random judge from all of the attorney's judge teams + attorney_judge = assigned_attorney.non_administered_judge_teams.map(&:organization).map(&:judge).sample + + judge_review_task = JudgeDecisionReviewTask.create!( + judge_assign_task.slice(:appeal, :parent) + .merge(assigned_by: task_params[:assigned_by], assigned_to: attorney_judge) + ) + + judge_assign_task.update!(status: Constants.TASK_STATUSES.completed) + attorney_task = AttorneyTask.create!(Task.modify_params_for_create(task_params.merge(parent: judge_review_task, + assigned_by: attorney_judge))) + [attorney_task, judge_review_task, judge_assign_task] + end end diff --git a/app/workflows/hearing_request_case_distributor.rb b/app/workflows/hearing_request_case_distributor.rb index a6f6e380e20..97367b07692 100644 --- a/app/workflows/hearing_request_case_distributor.rb +++ b/app/workflows/hearing_request_case_distributor.rb @@ -1,26 +1,25 @@ # frozen_string_literal: true +# :reek:TooManyInstanceVariables class HearingRequestCaseDistributor include DistributionConcern - def initialize(appeals:, genpop:, distribution:, priority:) + def initialize(appeals:, genpop:, distribution:, priority:, sct_appeals:) @appeals = appeals + @sct_appeals = sct_appeals @genpop = genpop @distribution = distribution @priority = priority end def call - # The DistributedCases model validates genpop and genpop_query for a hearing or legacy case. These methods - # will create one array for the appeals and one for their genpop values with matching indexes - appeals_for_tasks = appeals_to_distribute.flatten.select { |obj| obj.is_a?(Appeal) } - genpop_values = appeals_to_distribute.flatten.reject { |obj| obj.is_a?(Appeal) } - # Creates JudgeAssignTasks for the appeals, then zip the genpop_values into the array for creating # the DistributedCases - tasks = assign_judge_tasks_for_appeals(appeals_for_tasks, @distribution.judge).zip(genpop_values) + tasks = assign_judge_tasks_for_appeals(appeals_for_tasks, distribution.judge).zip(genpop_values) + + sct_tasks = create_sct_tasks - tasks.map do |task, genpop_value| + (tasks + sct_tasks).map do |task, genpop_value| next if task.nil? # If a distributed case already exists for this appeal, alter the existing distributed case's case id. @@ -32,7 +31,7 @@ def call new_dist_case = create_distribution_case_for_task(task, genpop_value) # In a race condition for distributions, two JudgeAssignTasks will be created; this cancels the first one - cancel_previous_judge_assign_task(task.appeal, @distribution.judge.id) + cancel_previous_judge_assign_task(task.appeal, distribution.judge.id) # Returns the new DistributedCase as expected by calling methods; case in elsif is implicitly returned new_dist_case elsif !distributed_case @@ -43,7 +42,7 @@ def call private - attr_reader :appeals, :genpop, :distribution, :priority + attr_reader :appeals, :genpop, :distribution, :priority, :sct_appeals def appeals_to_distribute not_genpop_appeals.map { |appeal| [appeal, false] }.concat(only_genpop_appeals.map { |appeal| [appeal, true] }) @@ -57,7 +56,8 @@ def create_distribution_case_for_task(task, genpop_value) ready_at: task.appeal.ready_for_distribution_at, task: task, genpop: genpop_value, - genpop_query: genpop + genpop_query: genpop, + sct_appeal: task.is_a?(SpecialtyCaseTeamAssignTask) ) end @@ -76,4 +76,22 @@ def only_genpop_appeals [] end + + # The DistributedCases model validates genpop and genpop_query for a hearing or legacy case. These methods + # will create one array for the appeals and one for their genpop values with matching indexes + def appeals_for_tasks + appeals_to_distribute.flatten.select { |obj| obj.is_a?(Appeal) } + end + + def genpop_values + appeals_to_distribute.flatten.reject { |obj| obj.is_a?(Appeal) } + end + + def create_sct_tasks + if FeatureToggle.enabled?(:specialty_case_team_distribution, user: RequestStore.store[:current_user]) + assign_sct_tasks_for_appeals(sct_appeals).zip([true] * sct_appeals.count) + else + [] + end + end end diff --git a/app/workflows/specialty_case_team_assign_task_creator.rb b/app/workflows/specialty_case_team_assign_task_creator.rb new file mode 100644 index 00000000000..38f42991238 --- /dev/null +++ b/app/workflows/specialty_case_team_assign_task_creator.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +class SpecialtyCaseTeamAssignTaskCreator + def initialize(appeal:, assigned_by_id:) + @appeal = appeal + @assigned_by_id = assigned_by_id + end + + def call + # If an appeal does not have an open DistributionTask, then it has already been distributed by automatic + # case distribution and a new SpecialtyCaseTeamAssignTask should not be created. This should only occur + # if two users request a distribution simultaneously. The check for LegacyAppeal was added for the Legacy DAS + # deprecation code in app/workflows/das_deprecation/case_distribution + return nil unless appeal.tasks.open.of_type(:DistributionTask).any? || appeal.is_a?(LegacyAppeal) + + Rails.logger.info("Assigning SCT task for appeal #{appeal.id}") + task = reassign_or_create + Rails.logger.info("Assigned SCT task with task id #{task.id} to #{task.assigned_to.name}") + + Rails.logger.info("Closing distribution task for appeal #{appeal.id} with task id #{task.id}") + close_distribution_tasks_for_appeal if appeal.is_a?(Appeal) + Rails.logger.info("Closed distribution task for appeal #{appeal.id}") + + task + end + + private + + attr_reader :appeal + + def reassign_or_create + open_sct_assign_task = appeal.tasks.open.find_by_type(:SpecialtyCaseTeamAssignTask) + + return reassign_existing_open_task(open_sct_assign_task) if open_sct_assign_task + + SpecialtyCaseTeamAssignTask.create!(appeal: appeal, + parent: appeal.root_task, + assigned_to: SpecialtyCaseTeam.singleton) + end + + def reassign_existing_open_task(open_sct_assign_task) + begin + assigning_user = @assigned_by_id.nil? ? nil : User.find(@assigned_by_id) + rescue ActiveRecord::RecordNotFound + Rails.logger.error("Could not locate a user with id #{@assigned_by_id} who reassigned a SCT assign task.") + new_task, * = open_sct_assign_task.reassign({ + assigned_to_type: :Organization, + assigned_to_id: SpecialtyCaseTeam.singleton.id, + appeal: appeal + }, nil) + return new_task + end + new_task, * = open_sct_assign_task.reassign({ + assigned_to_type: :Organization, + assigned_to_id: SpecialtyCaseTeam.singleton.id, + appeal: appeal + }, assigning_user) + new_task + end + + def close_distribution_tasks_for_appeal + appeal.tasks.of_type(:DistributionTask).update(status: :completed) + end +end diff --git a/app/workflows/specialty_case_team_split_appeal_handler.rb b/app/workflows/specialty_case_team_split_appeal_handler.rb new file mode 100644 index 00000000000..48b5f9856c3 --- /dev/null +++ b/app/workflows/specialty_case_team_split_appeal_handler.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +# The SpecialtyCaseTeamSplitAppealHandler handles cancelling, moving, and creating tasks after splitting an appeal +# That contains Specialty Case Team issues +class SpecialtyCaseTeamSplitAppealHandler + attr_reader :old_appeal + attr_reader :new_appeal + attr_reader :current_user + + def initialize(old_appeal, new_appeal, current_user) + @old_appeal = old_appeal + @new_appeal = new_appeal + @current_user = current_user + end + + def handle_split_sct_appeals + return unless old_appeal.distributed? + + old_sct_appeal = old_appeal.sct_appeal? + new_sct_appeal = new_appeal.sct_appeal? + both_sct_appeals = old_sct_appeal && new_sct_appeal + + if both_sct_appeals + # We only need something here if we are cancelling the judge/attorney tasks. Otherwise a standard split works + elsif old_sct_appeal + handle_old_sct_appeal + elsif new_sct_appeal + handle_new_sct_appeal + end + end + + private + + def handle_old_sct_appeal + # If the old appeal was not in the sct queue, then the new appeal needs to be moved there + # The appeal was created before the SpecialtyCaseTeam was created or before the issue type was added to SCT. + new_appeal.move_appeal_back_to_distribution!(current_user) + unless old_appeal.specialty_case_team_assign_task? + assign_appeal_to_the_specialty_case_team(old_appeal) + end + end + + def handle_new_sct_appeal + # If the old appeal was not in the sct queue, then the old appeal needs to be moved there + # The appeal was created before the SpecialtyCaseTeam was created or before the issue type was added to SCT. + old_appeal.move_appeal_back_to_distribution!(current_user) + unless old_appeal.specialty_case_team_assign_task? + assign_appeal_to_the_specialty_case_team(new_appeal) + end + end + + def assign_appeal_to_the_specialty_case_team(appeal) + appeal.remove_from_current_queue! + create_new_specialty_case_team_assign_task(appeal) + end + + def create_new_specialty_case_team_assign_task(appeal) + sct_task = SpecialtyCaseTeamAssignTask.find_or_create_by( + appeal: appeal, + parent: appeal.root_task, + assigned_to: SpecialtyCaseTeam.singleton + ) + sct_task.update!(assigned_by: current_user, status: Constants.TASK_STATUSES.assigned) + end +end diff --git a/client/COPY.json b/client/COPY.json index 2a76c2df69b..26348a3e57d 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -333,6 +333,9 @@ "EDUCATION_ORGANIZATIONAL_QUEUE_PAGE_IN_PROGRESS_TASKS_DESCRIPTION": "Cases that are in progress in the %s team's queue:", "EDUCATION_ORGANIZATIONAL_QUEUE_PAGE_UNASSIGNED_TASKS_DESCRIPTION": "Cases owned by the %s team:", "VHA_ORGANIZATIONAL_QUEUE_PAGE_IN_PROGRESS_TASKS_DESCRIPTION": "Cases that are in progress:", + "SPECIALTY_CASE_TEAM_QUEUE_PAGE_ACTION_REQUIRED_TAB_TITLE": "Action Required (%d)", + "SPECIALTY_CASE_TEAM_QUEUE_PAGE_ACTION_REQUIRED_TAB_DESCRIPTION": "Cases owned by the Specialty Case Team that require action:", + "SPECIALTY_CASE_TEAM_QUEUE_PAGE_COMPLETED_TAB_DESCRIPTION": "Cases owned by the Specialty Case Team that have been assigned to a SCT Attorney (last 14 days):", "ORGANIZATIONAL_QUEUE_PAGE_IN_PROGRESS_TASKS_DESCRIPTION": "Cases in progress in a %s team member's queue.", "ORGANIZATIONAL_QUEUE_PAGE_READY_FOR_REVIEW_TASKS_DESCRIPTION": "Cases ready for review in a %s team member's queue.", "ORGANIZATIONAL_QUEUE_PAGE_UNASSIGNED_TASKS_DESCRIPTION": "Cases owned by the %s team that are unassigned to a person.", @@ -456,12 +459,14 @@ "ASSIGN_WIDGET_NO_TASK_TITLE": "No tasks selected", "ASSIGN_WIDGET_NO_TASK_DETAIL": "Please select a task.", "ASSIGN_WIDGET_SUCCESS": "%(verb)s %(numCases)s %(casePlural)s to %(assignee)s", + "SPECIALTY_CASE_TEAM_ASSIGN_WIDGET_SUCCESS": "You have successfully assigned %(numCases)s %(casePlural)s to %(assignee)s", "ASSIGN_WIDGET_ASSIGNMENT_ERROR_TITLE": "Error assigning tasks", - "ASSIGN_WIDGET_ASSIGNMENT_ERROR_DETAIL": "Timeout Error while assigning tasks; please reload the page before proceeding.", + "ASSIGN_WIDGET_ASSIGNMENT_ERROR_DETAIL": "Error occurred while assigning tasks. You may need to reload the page before proceeding.", "ASSIGN_WIDGET_ASSIGNMENT_ERROR_DETAIL_MODAL_LINK": "Please assign tasks to an attorney from your assign page.", "ASSIGN_WIDGET_ASSIGNMENT_ERROR_DETAIL_MODAL": " Reassign tasks to a judge in the action dropdown", "ASSIGN_WIDGET_LOADING": "Loading...", "ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER": "Select a user", + "SCT_ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER": "Search or select", "VHA_ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER": "Select a Program Office", "ASSIGN_WIDGET_DROPDOWN_NAME_PRIMARY": "Assignee", "ASSIGN_WIDGET_DROPDOWN_NAME_SECONDARY": "Other assignee", @@ -529,6 +534,7 @@ "MODAL_END_HOLD_BUTTON": "End hold", "MODAL_REMOVE_BUTTON": "Remove", "MODAL_SAVE_BUTTON": "Save", + "MODAL_MOVE_BUTTON": "Move", "BULK_ASSIGN_BUTTON_TEXT": "Assign Tasks", "BULK_ASSIGN_MODAL_TITLE": "Bulk Assign Tasks", "REGIONAL_OFFICE_REQUIRED_MESSAGE": "Please select a regional office", @@ -651,6 +657,7 @@ "ASSIGN_TO_USER_DROPDOWN": "Select a user", "ASSIGN_TO_TEAM_DROPDOWN": "Select a team", "ASSIGN_TASK_TITLE": "Assign task", + "ASSIGN_TASK_BUTTON": "Assign task", "ASSIGN_TASK_TO_TITLE": "Assign task to %s", "NOTIFY_OGC_OF": "Notify OGC of %s", "PULAC_CERULLO_MODAL_TITLE": "Notify Litigation Support of Possible Conflict of Jurisdiction", @@ -709,6 +716,7 @@ "TEAM_MANAGEMENT_URL_COLUMN_HEADING": "URL", "TEAM_MANAGEMENT_PRIORITY_DISTRIBUTION_COLUMN_HEADING": "Priority Case Distribution", "TEAM_MANAGEMENT_REQUESTED_DISTRIBUTION_COLUMN_HEADING": "Request More Cases Distribution", + "TEAM_MANAGEMENT_EXCLUDE_FROM_AFFINITY_CASES_COLUMN_HEADING": "Exclude from Affinity Appeals*", "TEAM_MANAGEMENT_PARTICIPANT_ID_COLUMN_HEADING": "BGS Participant ID", "TEAM_MANAGEMENT_UPDATE_ROW_BUTTON": "Update", "TEAM_MANAGEMENT_ADD_JUDGE_LABEL": "Judge Teams", @@ -1379,6 +1387,7 @@ "REVIEW_SPLIT_APPEAL_CREATE_SUBHEAD": "Case history, POA, and Veteran information will be deplicated on the new appeal.", "SPLIT_APPEAL_BANNER_SUCCESS_TITLE": "You have successfully split %(appellantName)s's appeal", "SPLIT_APPEAL_BANNER_SUCCESS_MESSAGE": "This new appeal stream has the same docket number and tasks as the original appeal.", + "SPLIT_APPEAL_SPECIALTY_CASE_TEAM_ISSUE_MESSAGE": "This appeal stream has no Specialty Case Team issues. Upon split, it will be routed to regular distribution.", "TABLE_ORIGINAL_APPEAL": "Original Appeal Stream", "TABLE_NEW_APPEAL": "New Appeal Stream", "TABLE_VETERAN": "Veteran", @@ -1412,6 +1421,19 @@ "POA_SUCCESSFULLY_REFRESH_MESSAGE": "Successfully refreshed. No power of attorney information was found at this time.", "POA_UPDATED_SUCCESSFULLY": "POA Updated Successfully", "EMPLOYER_IDENTIFICATION_NUMBER": "Employer Identification Number", + "MOVE_TO_SCT_MODAL_TITLE": "Move appeal to SCT queue", + "MOVE_TO_SCT_MODAL_BODY": "One or more Specialty Case Team (SCT) issues have been added and the appeal will now be routed to the SCT queue.", + "MOVE_TO_DISTRIBUTION_MODAL_TITLE": "Move appeal to regular distribution", + "MOVE_TO_DISTRIBUTION_MODAL_BODY": "All Specialty Case Team (SCT) issues have been removed from this appeal. It will be moved to regular distribution.", + "MOVE_TO_SCT_BANNER_TITLE": "You have successfully updated issues on this appeal", + "MOVE_TO_SCT_BANNER_MESSAGE": "The appeal for %s (ID: %s) has been moved to the SCT queue.", + "MOVE_TO_GENERIC_BANNER_SUCCESS_MESSAGE": "The appeal for %s (ID: %s) has been moved to the %s.", + "SPECIALTY_CASE_TEAM_ASSIGN_TASK_LABEL": "Assign", + "SPECIALTY_CASE_TEAM_ASSIGN_DROPDOWN_LABEL": "Select an attorney", + "RETURN_TO_SCT_MODAL_TITLE": "Return to Specialty Case Team (SCT)", + "RETURN_TO_SCT_MODAL_BODY": "Returning this case to SCT will cancel the current task and remove the case from your queue.", + "RETURN_TO_SCT_SUCCESS_BANNER_TITLE": "You have successfully returned %s's case to the SCT Queue", + "RETURN_TO_SCT_SUCCESS_BANNER_DETAIL": "If you have made a mistake, please email SCT Coordinator to manage any changes.", "VHA_POA_NAME_NOT_LISTED": "VHA does not allow manual entry of unrecognized POAs. Please proceed to next step for the intake, as you do not need to enter additional information.", "CASE_DISTRIBUTION_TITLE": "Case Distribution Algorithm Values", "CASE_DISTRIBUTION_ALGORITHM_DESCRIPTION": "The Case Distribution Algorithm determines how cases are assigned to VLJs and their teams. Current algorithm is \"Docket Date.\"", diff --git a/client/app/caseDistribution/components/AffinityDays.jsx b/client/app/caseDistribution/components/AffinityDays.jsx index facda2c7192..06beeafa00f 100644 --- a/client/app/caseDistribution/components/AffinityDays.jsx +++ b/client/app/caseDistribution/components/AffinityDays.jsx @@ -1,28 +1,51 @@ import React, { useState, useEffect } from 'react'; -import { useSelector } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import cx from 'classnames'; import NumberField from 'app/components/NumberField'; import TextField from 'app/components/TextField'; import COPY from '../../../COPY'; import ACD_LEVERS from '../../../constants/ACD_LEVERS'; -import { getUserIsAcdAdmin, getLeversByGroup } from '../reducers/levers/leversSelector'; +import { getUserIsAcdAdmin, getLeversByGroup, getLeverErrors } from '../reducers/levers/leversSelector'; import { Constant } from '../constants'; import { dynamicallyAddAsterisk } from '../utils'; +import { validateLever, updateRadioLever } from '../reducers/levers/leversActions'; const AffinityDays = () => { const theState = useSelector((state) => state); + const dispatch = useDispatch(); const isUserAcdAdmin = getUserIsAcdAdmin(theState); - const storeLevers = getLeversByGroup(theState, Constant.LEVERS, ACD_LEVERS.lever_groups.affinity); const [affinityLevers, setAffinityLevers] = useState(storeLevers); + const leverErrors = (leverItem) => { + return getLeverErrors(theState, leverItem); + }; + useEffect(() => { setAffinityLevers(storeLevers); }, [storeLevers]); + const isOptionSelected = (lever, option) => lever.selectedOption === option.item; + + const onChangeRadio = (lever, option) => () => { + // eslint-disable-next-line camelcase + const { lever_group, item } = lever; + + dispatch(updateRadioLever(lever_group, item, option.item, option.value)); + }; + + const onChangeField = (lever, option) => (event) => { + // eslint-disable-next-line camelcase + const { lever_group, item } = lever; + + dispatch(validateLever(lever, item, event, leverErrors(item))); + dispatch(updateRadioLever(lever_group, item, option.item, event)); + }; + const generateFields = (dataType, option, lever) => { const useAriaLabel = !lever.is_disabled_in_ui; const tabIndex = lever.is_disabled_in_ui ? -1 : 0; + const value = lever.valueOptionValue; if (dataType === ACD_LEVERS.data_types.number) { return ( @@ -31,12 +54,12 @@ const AffinityDays = () => { title={option.text} label={option.unit} isInteger - readOnly={lever.is_disabled_in_ui ? true : (lever.value !== option.item)} - value={option.value} - errorMessage={option.errorMessage} - onChange={() => console.warn('not implemented')} - id={`${lever.item}-${option.value}`} - inputID={`${lever.item}-${option.value}-input`} + readOnly={lever.is_disabled_in_ui ? true : !isOptionSelected(lever, option)} + value={value} + errorMessage={leverErrors(lever.item)} + onChange={onChangeField(lever, option)} + id={`${lever.item}-${value}`} + inputID={`${lever.item}-${value}-input`} useAriaLabel={useAriaLabel} tabIndex={tabIndex} disabled={lever.is_disabled_in_ui} @@ -49,11 +72,12 @@ const AffinityDays = () => { name={option.item} title={option.text} label={false} - readOnly={lever.is_disabled_in_ui ? true : (lever.value !== option.item)} - value={option.value} - onChange={() => console.warn('not implemented')} - id={`${lever.item}-${option.value}`} - inputID={`${lever.item}-${option.value}-input`} + readOnly={lever.is_disabled_in_ui ? true : !isOptionSelected(lever, option)} + value={value} + errorMessage={leverErrors(lever.item)} + onChange={onChangeField(lever, option)} + id={`${lever.item}-${value}`} + inputID={`${lever.item}-${value}-input`} useAriaLabel={useAriaLabel} tabIndex={tabIndex} disabled={lever.is_disabled_in_ui} @@ -67,7 +91,7 @@ const AffinityDays = () => { const generateMemberViewLabel = (option, lever, index) => { const affinityLabelId = `affinity-day-label-for-${lever.item}`; - if (lever.value === option.item) { + if (isOptionSelected(lever, option)) { return (
@@ -76,7 +100,7 @@ const AffinityDays = () => { htmlFor={`${lever.item}-${option.item}`} > {`${option.text} ${option.data_type === ACD_LEVERS.data_types.number ? - `${option.value} ${option.unit}` : ''}`} + `${lever.value} ${option.unit}` : ''}`}
@@ -87,19 +111,19 @@ const AffinityDays = () => { }; const renderAdminInput = (option, lever, index) => { - const className = cx('combined-radio-input', (lever.value === option.item) ? '' : 'outline-radio-input'); + const className = cx('combined-radio-input', (isOptionSelected(lever, option)) ? '' : 'outline-radio-input'); return (
console.warn('not implemented')} + onChange={onChangeRadio(lever, option)} />
- {generateFields(option.data_type, option, lever, isUserAcdAdmin)} + {generateFields(option.data_type, option, lever)}
diff --git a/client/app/caseDistribution/components/BatchSize.jsx b/client/app/caseDistribution/components/BatchSize.jsx index bdfc5fb98a2..13ebc875fbc 100644 --- a/client/app/caseDistribution/components/BatchSize.jsx +++ b/client/app/caseDistribution/components/BatchSize.jsx @@ -4,7 +4,7 @@ import cx from 'classnames'; import NumberField from 'app/components/NumberField'; import COPY from '../../../COPY'; import { getLeversByGroup, getLeverErrors, getUserIsAcdAdmin } from '../reducers/levers/leversSelector'; -import { updateNumberLever, validateLever } from '../reducers/levers/leversActions'; +import { updateLeverValue, validateLever } from '../reducers/levers/leversActions'; import { Constant } from '../constants'; import ACD_LEVERS from '../../../constants/ACD_LEVERS'; import { dynamicallyAddAsterisk } from '../utils'; @@ -30,7 +30,7 @@ const BatchSize = () => { const { lever_group, item } = lever; dispatch(validateLever(lever, item, event, leverErrors(item))); - dispatch(updateNumberLever(lever_group, item, event)); + dispatch(updateLeverValue(lever_group, item, event)); }; return ( diff --git a/client/app/caseDistribution/components/CaseDistributionContent.jsx b/client/app/caseDistribution/components/CaseDistributionContent.jsx index ab43aaf8d3d..d5e7470e339 100644 --- a/client/app/caseDistribution/components/CaseDistributionContent.jsx +++ b/client/app/caseDistribution/components/CaseDistributionContent.jsx @@ -1,4 +1,7 @@ import React from 'react'; +import { useSelector } from 'react-redux'; +import Alert from '../../components/Alert'; +import Link from '../../components/Link'; import StaticLeversWrapper from './StaticLeversWrapper'; import InteractableLeverWrapper from './InteractableLeversWrapper'; import LeverHistory from './LeverHistory'; @@ -6,9 +9,13 @@ import { sectionSegmentStyling, sectionHeadingStyling, anchorJumpLinkStyling } from 'app/queue/StickyNavContentArea'; + import COPY from '../../../COPY'; +import { getExcludeFromAffinityStatus } from '../reducers/levers/leversSelector'; const CaseDistributionContent = () => { + const theState = useSelector((state) => state); + const excludeFromAffinityCasesToggle = getExcludeFromAffinityStatus(theState); return (
@@ -18,6 +25,13 @@ const CaseDistributionContent = () => {

{COPY.CASE_DISTRIBUTION_TITLE}

{COPY.CASE_DISTRIBUTION_ALGORITHM_DESCRIPTION}

+ {excludeFromAffinityCasesToggle && (

+ + You may remove individual judges from Affinity Case Distribution within the setting on the  + Caseflow Team Management page. + +

)} +
{/* Container for Active Levers*/}

{COPY.CASE_DISTRIBUTION_ACTIVE_LEVERS_TITLE} diff --git a/client/app/caseDistribution/components/DocketTimeGoals.jsx b/client/app/caseDistribution/components/DocketTimeGoals.jsx index 4269e85ed8b..520a25732c1 100644 --- a/client/app/caseDistribution/components/DocketTimeGoals.jsx +++ b/client/app/caseDistribution/components/DocketTimeGoals.jsx @@ -1,7 +1,11 @@ import React, { useState, useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import cx from 'classnames'; -import { updateNumberLever, validateLever } from '../reducers/levers/leversActions'; +import { + updateLeverValue, + validateLever, + updateLeverIsToggleActive +} from '../reducers/levers/leversActions'; import ToggleSwitch from 'app/components/ToggleSwitch/ToggleSwitch'; import NumberField from 'app/components/NumberField'; import COPY from '../../../COPY'; @@ -42,22 +46,17 @@ const DocketTimeGoals = () => { const { lever_group, item } = lever; dispatch(validateLever(lever, item, event, leverErrors(item))); - dispatch(updateNumberLever(lever_group, item, event)); + dispatch(updateLeverValue(lever_group, item, event)); }; - const toggleLever = (index) => () => { - const levers = docketDistributionLevers.map((lever, i) => { - if (index === i) { - lever.is_toggle_active = !lever.is_toggle_active; + const toggleLever = (lever) => () => { + const { + lever_group: leverGroup, + item, + is_toggle_active: isToggleActive + } = lever; - return lever; - } - - return lever; - - }); - - setDistributionLever(levers); + dispatch(updateLeverIsToggleActive(leverGroup, item, !isToggleActive)); }; const renderDocketDistributionLever = (distributionPriorLever, index) => { @@ -101,7 +100,7 @@ const DocketTimeGoals = () => { id={`toggle-switch-${distributionPriorLever.item}`} selected={distributionPriorLever.is_toggle_active} disabled={distributionPriorLever.is_disabled_in_ui} - toggleSelected={toggleLever(index)} + toggleSelected={toggleLever(distributionPriorLever)} />
{ @@ -10,6 +10,15 @@ const LeverHistory = () => { const leverHistoryTable = getLeverHistoryTable(theState); + const displayValue = (value, entry, idx) => { + if (entry.leverDataType[idx] === ACD_LEVERS.data_types.radio && + (value.toLowerCase().includes('always') || value.toLowerCase().includes('omit'))) { + return `${value}`; + } + + return `${value} ${entry.units[idx]}`; + }; + return (
@@ -46,18 +55,18 @@ const LeverHistory = () => {
    - {entry.previous_values.map((previousValue, idx) => { + {entry.previousValues.map((previousValue, idx) => { return
  1. - {previousValue}{' '}{entry.units[idx]}
  2. ; + {displayValue(previousValue, entry, idx)}; }) }
    - {entry.updated_values.map((updatedValue, idx) => { + {entry.updatedValues.map((updatedValue, idx) => { return
  1. - {updatedValue}{' '}{entry.units[idx]}
  2. ; + {displayValue(updatedValue, entry, idx)}; }) }
diff --git a/client/app/caseDistribution/components/SaveModal.jsx b/client/app/caseDistribution/components/SaveModal.jsx index 20b95664f55..4fa5e37a75a 100644 --- a/client/app/caseDistribution/components/SaveModal.jsx +++ b/client/app/caseDistribution/components/SaveModal.jsx @@ -7,7 +7,7 @@ import ACD_LEVERS from '../../../constants/ACD_LEVERS'; import cx from 'classnames'; import COPY from '../../../COPY'; import PropTypes from 'prop-types'; -import { findOption } from '../utils'; +import { findOption, findValueOption } from '../utils'; import { changedLevers } from '../reducers/levers/leversSelector'; export const SaveModal = (props) => { @@ -15,18 +15,48 @@ export const SaveModal = (props) => { const theState = useSelector((state) => state); - const leverValueDisplay = (lever) => { - const doesDatatypeRequireComplexLogic = (lever.data_type === ACD_LEVERS.data_types.radio || - lever.data_type === ACD_LEVERS.data_types.combination); + const combinationValue = (value, isToggleActive) => { + const toggleString = isToggleActive ? 'Active' : 'Inactive'; + + return `${toggleString} - ${value}`; + }; + + /** + * If omit or infinite + * Return the text for the option + * + * If value + * Return the text, value, and unit for the option + */ + const radioValue = (lever, value) => { + if ([ACD_LEVERS.omit, ACD_LEVERS.infinite].includes(value)) { + return findOption(lever, value).text; + } + const selectedOption = findValueOption(lever); + + return `${selectedOption.text} ${value} ${selectedOption.unit}`; + }; - if (doesDatatypeRequireComplexLogic) { - const selectedOption = findOption(lever, lever.value); - const isSelectedOptionANumber = selectedOption.data_type === ACD_LEVERS.data_types.number; + const changedLeverDisplayValue = (lever, value, isToggleActive) => { + let displayValue = value; - return isSelectedOptionANumber ? selectedOption.value : selectedOption.text; + if (lever.data_type === ACD_LEVERS.data_types.radio) { + displayValue = radioValue(lever, value); } - return {lever.value}; + if (lever.data_type === ACD_LEVERS.data_types.combination) { + displayValue = combinationValue(value, isToggleActive); + } + + return displayValue; + }; + + const backendValueDisplay = (lever) => { + return <>{changedLeverDisplayValue(lever, lever.backendValue, lever.backendIsToggleActive)}; + }; + + const leverValueDisplay = (lever) => { + return {changedLeverDisplayValue(lever, lever.value, lever.is_toggle_active)}; }; const leverList = () => { @@ -62,7 +92,7 @@ export const SaveModal = (props) => { id={`${lever.item}-previous-value`} className={cx('modal-table-styling', 'modal-table-right-styling')} > - {lever.backendValue} + {backendValueDisplay(lever)}
diff --git a/client/app/caseDistribution/pages/CaseDistributionApp.jsx b/client/app/caseDistribution/pages/CaseDistributionApp.jsx index e9a7a6f3f24..11e0fe5223c 100644 --- a/client/app/caseDistribution/pages/CaseDistributionApp.jsx +++ b/client/app/caseDistribution/pages/CaseDistributionApp.jsx @@ -4,6 +4,7 @@ import CaseDistributionContent from '../components/CaseDistributionContent'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { + loadAcdExcludeFromAffinity, loadLevers, loadHistory, setUserIsAcdAdmin @@ -15,6 +16,7 @@ class CaseDistributionApp extends React.PureComponent { this.props.loadLevers(this.props.acdLeversForStore); this.props.loadHistory(this.props.acd_history); this.props.setUserIsAcdAdmin(this.props.user_is_an_acd_admin); + this.props.loadAcdExcludeFromAffinity(this.props.acd_exclude_from_affinity); } render() { @@ -31,6 +33,8 @@ class CaseDistributionApp extends React.PureComponent { CaseDistributionApp.propTypes = { acdLeversForStore: PropTypes.object, + loadAcdExcludeFromAffinity: PropTypes.bool, + acd_exclude_from_affinity: PropTypes.bool, acd_history: PropTypes.array, user_is_an_acd_admin: PropTypes.bool, loadLevers: PropTypes.func, @@ -44,6 +48,7 @@ const mapStateToProps = (state) => ({ const mapDispatchToProps = (dispatch) => ( bindActionCreators({ + loadAcdExcludeFromAffinity, loadLevers, loadHistory, setUserIsAcdAdmin diff --git a/client/app/caseDistribution/reducers/levers/leversActionTypes.js b/client/app/caseDistribution/reducers/levers/leversActionTypes.js index b13b942a17f..3eb6fba24e3 100644 --- a/client/app/caseDistribution/reducers/levers/leversActionTypes.js +++ b/client/app/caseDistribution/reducers/levers/leversActionTypes.js @@ -1,10 +1,9 @@ export const ACTIONS = { ADD_LEVER_VALIDATION_ERRORS: 'ADD_LEVER_VALIDATION_ERRORS', + SET_ACD_EXCLUDE_FROM_AFFINITY: 'SET_ACD_EXCLUDE_FROM_AFFINITY', UPDATE_RADIO_LEVER: 'UPDATE_RADIO_LEVER', - UPDATE_COMBINATION_LEVER: 'UPDATE_COMBINATION_LEVER', - UPDATE_BOOLEAN_LEVER: 'UPDATE_BOOLEAN_LEVER', - UPDATE_TEXT_LEVER: 'UPDATE_TEXT_LEVER', - UPDATE_NUMBER_LEVER: 'UPDATE_NUMBER_LEVER', + UPDATE_LEVER_IS_TOGGLE_ACTIVE: 'UPDATE_LEVER_IS_TOGGLE_ACTIVE', + UPDATE_LEVER_VALUE: 'UPDATE_LEVER_VALUE', SAVE_LEVERS: 'SAVE_LEVERS', REMOVE_LEVER_VALIDATION_ERRORS: 'REMOVE_LEVER_VALIDATION_ERRORS', RESET_ALL_VALIDATION_ERRORS: 'RESET_ALL_VALIDATION_ERRORS', diff --git a/client/app/caseDistribution/reducers/levers/leversActions.js b/client/app/caseDistribution/reducers/levers/leversActions.js index 3c53a331112..5b9fb446f02 100644 --- a/client/app/caseDistribution/reducers/levers/leversActions.js +++ b/client/app/caseDistribution/reducers/levers/leversActions.js @@ -2,6 +2,16 @@ import { ACTIONS } from './leversActionTypes'; import ApiUtil from '../../../util/ApiUtil'; import { validateLeverInput } from '../../utils'; +export const loadAcdExcludeFromAffinity = (acdExcludeFromAffinity) => + (dispatch) => { + dispatch({ + type: ACTIONS.SET_ACD_EXCLUDE_FROM_AFFINITY, + payload: { + acdExcludeFromAffinity + } + }); + }; + export const setUserIsAcdAdmin = (isUserAcdAdmin) => (dispatch) => { dispatch({ @@ -57,47 +67,22 @@ export const updateRadioLever = (leverGroup, leverItem, value, optionValue = nul }); }; -export const updateCombinationLever = (leverGroup, leverItem, value, toggleValue = false) => +export const updateLeverIsToggleActive = (leverGroup, leverItem, toggleValue) => (dispatch) => { dispatch({ - type: ACTIONS.UPDATE_COMBINATION_LEVER, + type: ACTIONS.UPDATE_LEVER_IS_TOGGLE_ACTIVE, payload: { leverGroup, leverItem, - value, toggleValue } }); }; -export const updateBooleanLever = (leverGroup, leverItem, value) => - (dispatch) => { - dispatch({ - type: ACTIONS.UPDATE_BOOLEAN_LEVER, - payload: { - leverGroup, - leverItem, - value - } - }); - }; - -export const updateTextLever = (leverGroup, leverItem, value) => - (dispatch) => { - dispatch({ - type: ACTIONS.UPDATE_TEXT_LEVER, - payload: { - leverGroup, - leverItem, - value - } - }); - }; - -export const updateNumberLever = (leverGroup, leverItem, value) => +export const updateLeverValue = (leverGroup, leverItem, value) => (dispatch) => { dispatch({ - type: ACTIONS.UPDATE_NUMBER_LEVER, + type: ACTIONS.UPDATE_LEVER_VALUE, payload: { leverGroup, leverItem, @@ -108,10 +93,11 @@ export const updateNumberLever = (leverGroup, leverItem, value) => export const saveLevers = (levers) => (dispatch) => { - const changedValues = Object.values(levers).flat(). + const changedValues = levers. map((lever) => ({ id: lever.id, - value: lever.value + value: lever.value, + is_toggle_active: lever.is_toggle_active })); const postData = { diff --git a/client/app/caseDistribution/reducers/levers/leversReducer.js b/client/app/caseDistribution/reducers/levers/leversReducer.js index 62c032e4293..c8ea6bd5c32 100644 --- a/client/app/caseDistribution/reducers/levers/leversReducer.js +++ b/client/app/caseDistribution/reducers/levers/leversReducer.js @@ -1,9 +1,9 @@ import { ACTIONS } from '../levers/leversActionTypes'; import { update } from '../../../util/ReducerUtil'; import { - createUpdatedLever, - createUpdatedRadioLever, - createUpdatedCombinationLever + updateLeverGroupForValue, + updateLeverGroupForRadioLever, + updateLeverGroupForIsToggleActive } from './leversSelector'; import { createUpdatedLeversWithValues, @@ -18,7 +18,8 @@ export const initialState = { displayBanner: false, leversErrors: [], errors: [], - isUserAcdAdmin: false + isUserAcdAdmin: false, + acdExcludeFromAffinity: false }; const leversReducer = (state = initialState, action = {}) => { @@ -41,10 +42,14 @@ const leversReducer = (state = initialState, action = {}) => { $set: action.payload.isUserAcdAdmin } }); - case ACTIONS.UPDATE_BOOLEAN_LEVER: - case ACTIONS.UPDATE_NUMBER_LEVER: - case ACTIONS.UPDATE_TEXT_LEVER: { - const leverGroup = createUpdatedLever(state, action); + case ACTIONS.SET_ACD_EXCLUDE_FROM_AFFINITY: + return update(state, { + acdExcludeFromAffinity: { + $set: action.payload.acdExcludeFromAffinity + } + }); + case ACTIONS.UPDATE_LEVER_VALUE: { + const leverGroup = updateLeverGroupForValue(state, action); return { ...state, @@ -54,8 +59,8 @@ const leversReducer = (state = initialState, action = {}) => { }, }; } - case ACTIONS.UPDATE_COMBINATION_LEVER: { - const leverGroup = createUpdatedCombinationLever(state, action); + case ACTIONS.UPDATE_LEVER_IS_TOGGLE_ACTIVE: { + const leverGroup = updateLeverGroupForIsToggleActive(state, action); return { ...state, @@ -66,7 +71,7 @@ const leversReducer = (state = initialState, action = {}) => { }; } case ACTIONS.UPDATE_RADIO_LEVER: { - const leverGroup = createUpdatedRadioLever(state, action); + const leverGroup = updateLeverGroupForRadioLever(state, action); return { ...state, diff --git a/client/app/caseDistribution/reducers/levers/leversSelector.js b/client/app/caseDistribution/reducers/levers/leversSelector.js index 2253fa26bc0..c7fa5e99eab 100644 --- a/client/app/caseDistribution/reducers/levers/leversSelector.js +++ b/client/app/caseDistribution/reducers/levers/leversSelector.js @@ -1,6 +1,12 @@ import { createSelector } from 'reselect'; import ACD_LEVERS from '../../../../constants/ACD_LEVERS'; -import { findOption, createCombinationValue } from '../../utils'; +import { + findSelectedOption, + hasCombinationLeverChanged, + radioValueOptionSelected, + findValueOption, + hasLeverValueChanged +} from '../../utils'; const sortLevers = (leverA, leverB) => leverA.lever_group_order - leverB.lever_group_order; @@ -27,6 +33,10 @@ const getAdminStatus = (state) => { return state.caseDistributionLevers.isUserAcdAdmin; }; +const getExcludeStatus = (state) => { + return state.caseDistributionLevers.acdExcludeFromAffinity; +}; + const leverErrorList = (state, leverItem) => { return state.caseDistributionLevers.leversErrors?. filter((error) => error.leverItem === leverItem).map((error) => error.message).join(''); @@ -36,21 +46,58 @@ const leverErrorCount = (state) => { return state.caseDistributionLevers.leversErrors.length; }; +const getLeversAsArray = (state) => { + return Object.values(getLevers(state)).flat(); +}; + +const getSimpleLevers = (state) => { + return getLeversAsArray(state).filter((lever) => + lever.data_type !== ACD_LEVERS.data_types.radio && + lever.data_type !== ACD_LEVERS.data_types.combination + ); +}; + +const getCombinationLevers = (state) => { + return getLeversAsArray(state).filter((lever) => + lever.data_type === ACD_LEVERS.data_types.combination + ); +}; + +const getRadioLevers = (state) => { + return getLeversAsArray(state).filter((lever) => + lever.data_type === ACD_LEVERS.data_types.radio + ); +}; + /** - * WILL NEED UPDATING WHEN RADIO AND COMBINATION LEVERS ARE EDITABLE + * Determine which levers have changed + * + * For radio levers compare if value has changed + * + * For combination levers compare if either is_toggle_active or value has changed + * + * For simple lever data types compare if value has changed */ export const changedLevers = createSelector( - [getLevers], - (levers) => { - return Object.values(levers).flat(). - filter((lever) => - lever.data_type !== ACD_LEVERS.data_types.radio && - lever.data_type !== ACD_LEVERS.data_types.combination && - lever.backendValue !== null && - `${lever.value}` !== lever.backendValue - ). + [getSimpleLevers, getCombinationLevers, getRadioLevers], + (simpleLevers, combinationLevers, radioLevers) => { + const changedSimpleLevers = simpleLevers.filter((lever) => + hasLeverValueChanged(lever) + ); + + const changedCombinationLevers = combinationLevers.filter((lever) => + hasCombinationLeverChanged(lever) + ); + + // Keeping separated in case there is a need to add additional checks + const changedRadioLevers = radioLevers.filter((lever) => + hasLeverValueChanged(lever) + ); + + return changedSimpleLevers.concat(changedCombinationLevers, changedRadioLevers). sort((leverA, leverB) => sortLevers(leverA, leverB)); } + ); export const hasChangedLevers = (state) => changedLevers(state).length > 0; @@ -76,15 +123,22 @@ export const getUserIsAcdAdmin = createSelector( } ); +export const getExcludeFromAffinityStatus = createSelector( + [getExcludeStatus], + (acdExcludeFromAffinity) => { + return acdExcludeFromAffinity; + } +); + const updateLeverGroup = (state, leverGroup, leverItem, updateLeverValue) => state.levers[leverGroup].map((lever) => lever.item === leverItem ? updateLeverValue(lever) : lever ); /** - * Updates levers of data type number, boolean, and text + * Used when updating the value of a lever */ -export const createUpdatedLever = (state, action) => { +export const updateLeverGroupForValue = (state, action) => { const { leverGroup, leverItem, value } = action.payload; const updateLeverValue = (lever) => { @@ -95,18 +149,13 @@ export const createUpdatedLever = (state, action) => { }; /** - * Do not trust this code. It is untested - * WILL NEED UPDATING WHEN RADIO AND COMBINATION LEVERS ARE EDITABLE + * Used when updating the is_toggle_active of a lever */ -export const createUpdatedRadioLever = (state, action) => { - const { leverGroup, leverItem, value, optionValue } = action.payload; +export const updateLeverGroupForIsToggleActive = (state, action) => { + const { leverGroup, leverItem, toggleValue } = action.payload; const updateLeverValue = (lever) => { - const selectedOption = findOption(lever, value); - - selectedOption.value = optionValue; - - return { ...lever, currentValue: optionValue }; + return { ...lever, is_toggle_active: toggleValue }; }; return updateLeverGroup(state, leverGroup, leverItem, updateLeverValue); @@ -127,16 +176,40 @@ export const hasNoLeverErrors = createSelector( ); /** - * Do not trust this code. It is untested - * WILL NEED UPDATING WHEN RADIO AND COMBINATION LEVERS ARE EDITABLE + * Used when updating the a radio lever + * Pass in the selected option and a value if the selected option is value + * + * This will break if a Radio lever has more than one option that has an input + * + * If value is the selected Radio option + * Update lever.value to optionValue passed in + * Set valueOptionValue to value passed in + * + * If omit or infinite is the selected Radio option + * Update lever.value to the value passed in + * Set valueOptionValue to value in value's option */ -export const createUpdatedCombinationLever = (state, action) => { - const { leverGroup, leverItem, value, toggleValue } = action.payload; +export const updateLeverGroupForRadioLever = (state, action) => { + const { leverGroup, leverItem, value, optionValue } = action.payload; const updateLeverValue = (lever) => { - const newValue = createCombinationValue(toggleValue, value); + const selectedOption = findSelectedOption(lever); + const isValueOption = radioValueOptionSelected(value); + const valueOptionValue = isValueOption ? optionValue : findValueOption(lever).value; + const leverValue = isValueOption ? optionValue : value; + // Set all options to not selected + + lever.options.forEach((option) => option.selected = false); - return { ...lever, currentValue: newValue, is_toggle_active: toggleValue }; + selectedOption.value = optionValue; + selectedOption.selected = true; + + return { + ...lever, + value: leverValue, + selectedOption: value, + valueOptionValue + }; }; return updateLeverGroup(state, leverGroup, leverItem, updateLeverValue); diff --git a/client/app/caseDistribution/test.jsx b/client/app/caseDistribution/test.jsx index f0299637162..9c21ff5bd8f 100644 --- a/client/app/caseDistribution/test.jsx +++ b/client/app/caseDistribution/test.jsx @@ -9,8 +9,46 @@ import AppSegment from '@department-of-veterans-affairs/caseflow-frontend-toolki import { LOGO_COLORS } from '../constants/AppConstants'; import Footer from '@department-of-veterans-affairs/caseflow-frontend-toolkit/components/Footer'; import CaseSearchLink from '../components/CaseSearchLink'; +import ApiUtil from '../util/ApiUtil'; +import Button from '../components/Button'; class CaseDistributionTest extends React.PureComponent { + constructor(props) { + super(props); + this.state = { + isReseedingAod: false, + isReseedingNonAod: false, + }; + } + + reseedAod = () => { + this.setState({ isReseedingAod: true }); + ApiUtil.post('/run-demo-aod-seeds').then(() => { + this.setState({ + isReseedingAod: false, + }); + }, (err) => { + console.warn(err); + this.setState({ + isReseedingAod: false, + }); + }); + }; + + reseedNonAod = () => { + this.setState({ isReseedingNonAod: true }); + ApiUtil.post('/run-demo-non-aod-seeds').then(() => { + this.setState({ + isReseedingNonAod: false, + }); + }, (err) => { + console.warn(err); + this.setState({ + isReseedingNonAod: false, + }); + }); + }; + render() { const Router = this.props.router || BrowserRouter; const appName = 'Case Distribution'; @@ -175,6 +213,32 @@ class CaseDistributionTest extends React.PureComponent {
+

Run Seed Files

+ +
); diff --git a/client/app/caseDistribution/utils.js b/client/app/caseDistribution/utils.js index 1a03ef7e340..cc93b8e2135 100644 --- a/client/app/caseDistribution/utils.js +++ b/client/app/caseDistribution/utils.js @@ -1,9 +1,9 @@ import ACD_LEVERS from '../../constants/ACD_LEVERS'; export const findOption = (lever, value) => lever.options.find((option) => option.item === value); - -export const createCombinationValue = (toggleValue, value) => `${toggleValue}-${value}`; - +export const findSelectedOption = (lever) => lever.options.find((option) => option.selected); +export const findValueOption = (lever) => findOption(lever, ACD_LEVERS.value); +export const radioValueOptionSelected = (item) => ACD_LEVERS.value === item; /** * Add backendValue attributes to each lever * For radio and combination levers add currentValue @@ -18,23 +18,33 @@ export const createUpdatedLeversWithValues = (levers) => { return leverGroups.reduce((updatedLevers, leverGroup) => { updatedLevers[leverGroup] = levers[leverGroup]?.map((lever) => { + // All levers should have a backendValue added as this is used for the following + // - showing the user what value was in the SaveModal + // - checking if the lever has changed and Save button should be enabled let additionalValues = { backendValue: lever.value }; const dataType = lever.data_type; - // Only add a new property for radio and combination data types as these have special handling logic + // Add new properties for radio and combination data types as these have special handling logic // to retrieve value if (dataType === ACD_LEVERS.data_types.radio) { + + const selectedOption = findSelectedOption(lever)?.item; + const isValueOptionSelected = radioValueOptionSelected(selectedOption); + const valueOptionValue = selectedOption && isValueOptionSelected ? + lever.value : findValueOption(lever)?.value; + additionalValues = { - currentValue: findOption(lever, lever.value).value, - backendValue: findOption(lever, lever.value).value, + ...additionalValues, + selectedOption, + valueOptionValue, }; } else if (dataType === ACD_LEVERS.data_types.combination) { additionalValues = { - currentValue: createCombinationValue(lever.is_toggle_active, lever.value), - backendValue: createCombinationValue(lever.is_toggle_active, lever.value) + ...additionalValues, + backendIsToggleActive: lever.is_toggle_active }; } @@ -84,18 +94,20 @@ export const formatLeverHistory = (leverHistoryList) => { if (existingEntry) { existingEntry.titles.push(entry.lever_title); - existingEntry.previous_values.push(entry.previous_value); - existingEntry.updated_values.push(entry.update_value); + existingEntry.previousValues.push(entry.previous_value); + existingEntry.updatedValues.push(entry.update_value); existingEntry.units.push(entry.lever_unit || 'null'); + existingEntry.leverDataType.push(entry.lever_data_type); } else { const newEntry = { created_at: formatTimestamp(entry.created_at), user_css_id: entry.user_css_id, user_name: entry.user_name, titles: [entry.lever_title], - previous_values: [entry.previous_value], - updated_values: [entry.update_value], + previousValues: [entry.previous_value], + updatedValues: [entry.update_value], units: [entry.lever_unit || 'null'], + leverDataType: [entry.lever_data_type] }; accumulator.push(newEntry); @@ -111,18 +123,22 @@ export const formatLeverHistory = (leverHistoryList) => { export const validateLeverInput = (lever, value) => { const errors = []; - const { min_value: minValue, max_value: maxValue } = lever; + const { item, min_value: minValue, max_value: maxValue } = lever; + let valueErrorMessage = null; - if (value === null || value === '') { - errors.push({ leverItem: lever.item, message: ACD_LEVERS.validation_error_message.minimum_not_met }); + const numericValue = value === '' || value === null ? NaN : parseFloat(value); + + if (maxValue !== null && (isNaN(numericValue) || numericValue < minValue || numericValue > maxValue)) { + valueErrorMessage = ACD_LEVERS.validation_error_message.out_of_bounds.replace('%s', maxValue); + } else if (maxValue === null && (value === '' || value === null)) { + valueErrorMessage = ACD_LEVERS.validation_error_message.minimum_not_met; } - if (parseFloat(value)) { - if (value < minValue) { - errors.push({ leverItem: lever.item, message: ACD_LEVERS.validation_error_message.minimum_not_met }); - } - if (maxValue && value > maxValue) { - errors.push({ leverItem: lever.item, message: ACD_LEVERS.validation_error_message.out_of_bounds }); - } + + if (valueErrorMessage !== null) { + errors.push({ + leverItem: item, + message: valueErrorMessage + }); } return errors; @@ -140,3 +156,21 @@ export const dynamicallyAddAsterisk = (lever) => { return (lever.algorithms_used.includes(ACD_LEVERS.algorithms.proportion) && lever.algorithms_used.includes(ACD_LEVERS.algorithms.docket) ? '*' : ''); }; + +/** + * if is_toggle_active was false then set to true and value was updated + * return true + * if is_toggle_active was true, value was updated then is_toggle_active was set to false + * return true + * if is_toggle_active didn't change, value was udpated + * return true + * if neither value or is_toggle_active changed + * return false + */ +export const hasCombinationLeverChanged = (lever) => + (lever.backendIsToggleActive !== lever.is_toggle_active) || + (lever.backendValue !== null && + `${lever.value}` !== lever.backendValue); + +export const hasLeverValueChanged = (lever) => lever.backendValue !== null && `${lever.value}` !== lever.backendValue; + diff --git a/client/app/components/Button.jsx b/client/app/components/Button.jsx index 31c478cb4b9..f13e759c2fc 100644 --- a/client/app/components/Button.jsx +++ b/client/app/components/Button.jsx @@ -47,6 +47,7 @@ export default class Button extends React.Component { type={type} disabled aria-label={ariaLabel} + {...styling} > diff --git a/client/app/intake/pages/ReviewAppealView.jsx b/client/app/intake/pages/ReviewAppealView.jsx index dae14a15e86..73a249454fd 100644 --- a/client/app/intake/pages/ReviewAppealView.jsx +++ b/client/app/intake/pages/ReviewAppealView.jsx @@ -4,9 +4,12 @@ import PropTypes from 'prop-types'; import { StateContext } from '../../intakeEdit/IntakeEditFrame'; import { DateString } from '../../util/DateUtil'; import { css } from 'glamor'; -import _ from 'lodash'; +import { startCase } from 'lodash'; import Link from '@department-of-veterans-affairs/caseflow-frontend-toolkit/components/Link'; import { ExternalLinkIcon } from '../../components/icons'; +import Alert from '../../components/Alert'; +import { useSelector } from 'react-redux'; +import SPECIALTY_CASE_TEAM_BENEFIT_TYPES from 'constants/SPECIALTY_CASE_TEAM_BENEFIT_TYPES'; const styles = { mainTable: css({ @@ -78,15 +81,16 @@ const ReviewAppealView = (props) => { const { serverIntake } = props; const requestIssues = serverIntake.requestIssues; const streamdocketNumber = props.appeal.stream_docket_number; - const reviewOpt = _.startCase(serverIntake?.docketType?.split('_').join(' ')); + const reviewOpt = startCase(serverIntake?.docketType?.split('_').join(' ')); const { selectedIssues, reason, otherReason } = useContext(StateContext); const veteran = serverIntake.veteran.name; const claimantName = props.serverIntake.claimantName; const hearings = props.hearings; const hearingsSize = hearings.length; - const originalHearingRequestType = _.startCase(props.appeal.original_hearing_request_type); + const originalHearingRequestType = startCase(props.appeal.original_hearing_request_type); const PARSE_INT_RADIX = 10; const hearingDayDate = props.hearingDayDate; + const specialtyCaseTeamFeatureToggle = useSelector((state) => state.featureToggles.specialtyCaseTeamDistribution); const currentValues = { reason, otherReason, @@ -121,6 +125,14 @@ const ReviewAppealView = (props) => { return selectOriginal; }); + // Specialty Case Team (SCT) logic for movement of appeals based on splitting appeals with SCT request issues + const specialtyCaseTeamBenefitTypes = Object.keys(SPECIALTY_CASE_TEAM_BENEFIT_TYPES); + const originalHasSCTIssue = selectOriginal.some((issue) => + specialtyCaseTeamBenefitTypes.includes(issue.benefit_type)); + const selectedHasSCTIssue = selectElement.some((issue) => + specialtyCaseTeamBenefitTypes.includes(issue.benefit_type)); + const atLeastOneHasSCTIssue = selectedHasSCTIssue || originalHasSCTIssue; + return ( <>
@@ -177,7 +189,7 @@ const ReviewAppealView = (props) => { ) && <>

-

{ _.startCase(hearings[0].disposition) }

+

{ startCase(hearings[0].disposition) }

{ ) && <>

-

{ _.startCase(hearings[0].disposition) }

+

{ startCase(hearings[0].disposition) }

{ return (
  • {issue.description}

    -

    Benefit type: {_.startCase(issue.benefit_type)}

    +

    Benefit type: {startCase(issue.benefit_type)}

    Decision date:

  • ); })} + {atLeastOneHasSCTIssue && !originalHasSCTIssue && specialtyCaseTeamFeatureToggle && }
      @@ -229,13 +242,14 @@ const ReviewAppealView = (props) => { return (
    1. {issue.description}

      -

      Benefit type: {_.startCase(issue.benefit_type)}

      +

      Benefit type: {startCase(issue.benefit_type)}

      Decision date:

    2. ); })}
    + {atLeastOneHasSCTIssue && !selectedHasSCTIssue && specialtyCaseTeamFeatureToggle && }
    @@ -244,6 +258,14 @@ const ReviewAppealView = (props) => { ); }; +const messageStyling = css({ + fontSize: '17px !important', +}); + +const SplitAppealNotice = () => ( + +); + ReviewAppealView.propTypes = { serverIntake: PropTypes.object, appeal: PropTypes.array, @@ -251,3 +273,4 @@ ReviewAppealView.propTypes = { hearingDayDate: PropTypes.string, }; export default (ReviewAppealView); + diff --git a/client/app/intakeEdit/components/EditButtons.jsx b/client/app/intakeEdit/components/EditButtons.jsx index aba68ad9013..1adfb115e68 100644 --- a/client/app/intakeEdit/components/EditButtons.jsx +++ b/client/app/intakeEdit/components/EditButtons.jsx @@ -14,6 +14,7 @@ import { REQUEST_STATE, VBMS_BENEFIT_TYPES } from '../../intake/constants'; import SaveAlertConfirmModal from './SaveAlertConfirmModal'; import COPY from '../../../COPY'; import { sprintf } from 'sprintf-js'; +import SPECIALTY_CASE_TEAM_BENEFIT_TYPES from 'constants/SPECIALTY_CASE_TEAM_BENEFIT_TYPES'; class SaveButtonUnconnected extends React.Component { constructor(props) { @@ -25,20 +26,43 @@ class SaveButtonUnconnected extends React.Component { issueChangeModal: false, unidentifiedIssueModal: false, reviewRemovedModal: false, - correctionIssueModal: false + correctionIssueModal: false, + moveToSctModal: false, + moveToDistributionModal: false } }; } validate = () => { // do validation and show modals + let showModals = { issueChangeModal: false, unidentifiedIssueModal: false, reviewRemovedModal: false, - correctionIssueModal: false + correctionIssueModal: false, + moveToSctModal: false, + moveToDistributionModal: false }; + // Specialty Case Team (SCT) logic for movement of appeals based on additional and removal of SCT request issues + const specialtyCaseTeamBenefitTypes = Object.keys(SPECIALTY_CASE_TEAM_BENEFIT_TYPES); + const addedIssuesHasSCTIssue = this.props.state.addedIssues.some((issue) => + specialtyCaseTeamBenefitTypes.includes(issue.benefitType) && !issue.withdrawalPending); + const originalIssuesHasSCTIssue = this.props.originalIssues.some((issue) => + specialtyCaseTeamBenefitTypes.includes(issue.benefitType)); + const hasDistributionTaskAndSCTFeatureToggle = this.props.hasDistributionTask && + this.props.specialtyCaseTeamDistribution; + + if (addedIssuesHasSCTIssue && !originalIssuesHasSCTIssue && hasDistributionTaskAndSCTFeatureToggle) { + showModals.moveToSctModal = true; + } + + if (!addedIssuesHasSCTIssue && originalIssuesHasSCTIssue && hasDistributionTaskAndSCTFeatureToggle && + this.props.hasSpecialtyCaseTeamAssignTask) { + showModals.moveToDistributionModal = true; + } + if (this.state.originalIssueNumber !== this.props.state.addedIssues.length) { if (this.props.state.addedIssues.length === 0) { showModals.reviewRemovedModal = true; @@ -79,7 +103,33 @@ class SaveButtonUnconnected extends React.Component { return this.state.showModals.correctionIssueModal && !this.state.showModals.reviewRemovedModal && !this.state.showModals.issueChangeModal && - !this.state.showModals.unidentifiedIssueModal; + !this.state.showModals.unidentifiedIssueModal && + !this.state.showModals.moveToSctModal; + } + + showMoveToSctModal = () => { + if (!this.props.specialtyCaseTeamDistribution) { + return false; + } + + return this.state.showModals.moveToSctModal && + !this.state.showModals.reviewRemovedModal && + !this.state.showModals.issueChangeModal && + !this.state.showModals.unidentifiedIssueModal && + !this.state.showModals.correctionIssueModal; + } + + showMoveToDistributionModal = () => { + if (!this.props.specialtyCaseTeamDistribution) { + return false; + } + + return this.state.showModals.moveToDistributionModal && + !this.state.showModals.reviewRemovedModal && + !this.state.showModals.issueChangeModal && + !this.state.showModals.unidentifiedIssueModal && + !this.state.showModals.correctionIssueModal && + !this.state.showModals.moveToSctModal; } confirmModal = (modalToClose) => { @@ -193,6 +243,24 @@ class SaveButtonUnconnected extends React.Component {

    {COPY.CORRECT_REQUEST_ISSUES_ESTABLISH_MODAL_TEXT}

    } + { this.showMoveToSctModal() && this.closeModal('moveToSctModal')} + onConfirm={() => this.confirmModal('moveToSctModal')} + buttonClassNames={['usa-button', 'confirm']}> +

    {COPY.MOVE_TO_SCT_MODAL_BODY}

    +
    } + + { this.showMoveToDistributionModal() && this.closeModal('moveToDistributionModal')} + onConfirm={() => this.confirmModal('moveToDistributionModal')} + buttonClassNames={['usa-button', 'confirm']}> +

    {COPY.MOVE_TO_DISTRIBUTION_MODAL_BODY}

    +
    } +