Skip to content

Commit

Permalink
Feature/appeals 36234.uat3.5.1 (#22037)
Browse files Browse the repository at this point in the history
* APPEALS-36339 (#21436)

* Updated to remove obsolete levers of ACD Disable Legacy Distributions and ACD Disable Non-priority Distributions

* Fixed redundant linting issue

* Fixed empty line linting issue

* Changed dockerfile to install node through NVM

* Update env.sh with node 14.20 path

* Removed unused node env

* Update Dockerfile Removed unused node env variable

* Removed unused node env

* mbeard/APPEALS-44379 (#21451)

* init commit

* new questions about method

* method for ready_appeals_from_levers 3rd iteration

* switched to conditional

* updates test and constants file

* adds testing scenarios for edge cases

* fixes test

* adds constants to top of file

---------

Co-authored-by: Amy Detwiler <[email protected]>

* APPEALS-44417 Seeds for Docket Lever Demo (#21534)

Co-authored-by: Christopher Detlef <>

* APPEALS-36345-updated (#21537)

* Refactored exclusion table

* Fixed ordering issue and testing

* mbeard/APPEALS-44379 (#21530)

* init commit

* new questions about method

* method for ready_appeals_from_levers 3rd iteration

* switched to conditional

* updates test and constants file

* adds testing scenarios for edge cases

* fixes test

* adds constants to top of file

* first new commit with new args

* updates methods and test query

* updates age_of_oldest methods params

* cleans up method removes args and updates tests, fixes linting

---------

Co-authored-by: Amy Detwiler <[email protected]>

* APPEALS-44346 Demo Docket Goal Lever Test Seed Data (#21524)

Co-authored-by: Christopher Detlef <>

* Chrisbdetlef/appeals 40705 (#21535)

* Chris backend Work

* APPEALS-44441. Added initial changes for individual seed

* WIP

* APPEALS-44441. Fixed the table css

* APPEALS-44441. Added Custom and Scenario Seed components and jest tests

* APPEALS-44441. Fix ScenarioSeeds jest test

* APPEALS-44441. Fix CustomeSeeds Jest test

* init commit

* fixes linting issues

* capybara test init

* APPEALS-44441. Backend Integration API changes

* APPEALS-44441_1. Matched the constant keys in the backend

* APPEALS-44441_1. Update the param to match the backend and fixed spec

* APPEALS-44441. lint fixes

* APPEALS-44441. linting fixes

* sharsha/APPEALS-44441. fixed the route and tests

* Change route

* Change variables to match front and back end

* CustomSeed Jest test fix

* Fix issues

* Fix rubocop issues

* Use existing method in the controller

---------

Co-authored-by: Christopher Detlef <>
Co-authored-by: SHarshain <[email protected]>
Co-authored-by: Michael Beard <[email protected]>
Co-authored-by: Amy Detwiler <[email protected]>

* Sharsha/appeals 45531 (#21566)

* Fixed rspec failures on constants

* APPEALS-45531. Remove dead code

---------

Co-authored-by: SHarshain <[email protected]>

* Updated lever history to handle null unit values from docket levers (#21567)

Co-authored-by: 631966 <[email protected]>

* Sharsha/appeals 45531_1 (#21573)

* APPEALS-45531. Add the controller which is used in the route

* APPEALS-45531. Fix lint issue

* Remove access check for this iteration

* APPEALS-45531. Fix lint issue in controller

---------

Co-authored-by: SHarshain <[email protected]>
Co-authored-by: Christopher Detlef <>
Co-authored-by: Amy Detwiler <[email protected]>

* Sharsha/appeals 45531 1 (#21609)

* APPEALS-45531. Add the controller which is used in the route

* APPEALS-45531. Fix lint issue

* Remove access check for this iteration

* APPEALS-45531. Fix lint issue in controller

* TEST FOR FIX

* MORE TESTING

* Fixed rspec issues

---------

Co-authored-by: SHarshain <[email protected]>
Co-authored-by: Christopher Detlef <>
Co-authored-by: Amy Detwiler <[email protected]>

* APPEALS-45502. Organize route and fix the controller (#21595)

Co-authored-by: SHarshain <[email protected]>
Co-authored-by: Amy Detwiler <[email protected]>

* Ricky/APPEALS-36345.fixes (#21612)

* Updated lever history to handle null unit values from docket levers

* Updated member view of exclusion table with proper text display and fixed missing css

* Updated unit test and test data to test rendering of exclusionTable

---------

Co-authored-by: 631966 <[email protected]>

* ricky/APPEALS-44053 (#21587)

* init commit, adds conditional to check for docket_type ama to method, fixes json constants to snakecase

* puts statements testing

* updates seeds for evidence_submission, adds method to hearing_request_docket.rb and dist_concern.rb

* updated appeals dsit

* final fix for PR

* updates spec to reflect changes in hearing_request_docket

* uncomments seeds

* Ricky/appeals 43523 (#21649)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

---------

Co-authored-by: 631068 <[email protected]>

* APPEALS-45898. Updated the lever_group_order values (#21639)

* APPEALS-45898. Updated the lever_group_order values

* APPEALS-45898. Updated order of the evidence submission priority and non-priority

---------

Co-authored-by: SHarshain <[email protected]>

* mbeard/APPEALS-40646 (#21645)

* Init commit

* adds methods and useffect first pass

* fixes isIdle warning

* removes important from scss

* refined handleToggleChange method

* updates font color for h4

* adds keys to the td and fixed proptype for loadAcdExcludeFromAffinity in casedistributionapp

* Chrisbdetlef/appeals 43117.cleanup (#21671)

* APPEALS-43421: Attorney Selection Sticking on Dropdown after Assignment (#21401)

* redo init commit

* updated imp. logic

* attorney widget fix

---------

Co-authored-by: Calvin <[email protected]>

* Add ruby CE API Gem

* remove correspondence changes from schema.rb (#21468)

* Revert "Add ruby CE API Gem" (#21479)

This reverts commit c78afe3.

* Override SCT Bulk Assign Page task limit (#21465)

* Override SCT Bulk Assign Queue 15 case limit & Adjust SCT attorney assign task action label

* feature/APPEALS-35707-29633-29632 (prodtest) (#21485)

* 🔀 Squash merge AlecK/APPEALS-35707 - Replace `database_cleaner` with `database_cleaner-active_record`

* 🔀 Squash merge jcroteau/APPEALS-29632-fix-deprecation-action-view-base-instances

* 🔀 Squash merge jcroteau/APPEALS-29633-fix-deprecation-warning-active_record-result-to_hash

* feature/APPEALS-44871 Steps for installing node in the Caseflow demo environment  (#21483) (#21484)

* Changed dockerfile to install node through NVM

* Update env.sh with node 14.20 path

* Removed unused node env

* Update Dockerfile Removed unused node env variable

* Revert "feature/APPEALS-44871 Steps for installing node in the Caseflow demo …" (#21489)

This reverts commit a626200.

* Sbashamoni/appeals 44871 node14 demo fixes (#21490) (#21495)

* Changed dockerfile to install node through NVM

* Update env.sh with node 14.20 path

* Removed unused node env

* Update Dockerfile Removed unused node env variable

* Removed unused node env

* add error rules to demo builds (#21496) (#21498)

Co-authored-by: davis-dwayne <[email protected]>

* APPEALS-43117 Add QA Users for testing

* Fix rspecs

* Fix issues with attorneys and judge teams

* Fix org count

---------

Co-authored-by: Isaiah Saucedo <[email protected]>
Co-authored-by: Calvin <[email protected]>
Co-authored-by: youfoundmanesh <[email protected]>
Co-authored-by: Craig Reese <[email protected]>
Co-authored-by: Robert Travis Pierce <[email protected]>
Co-authored-by: Jeremy Croteau <[email protected]>
Co-authored-by: sbashamoni <[email protected]>
Co-authored-by: davis-dwayne <[email protected]>
Co-authored-by: Christopher Detlef <>

* Minor fixes (#21694)

* Minor fixes

* Fix rspec tests and properly check for judge css id

* Fix lint issue

---------

Co-authored-by: Christopher Detlef <>

* Fix Legacy Case issues (#21747)

Co-authored-by: Christopher Detlef <>

* APPEALS-46037. Fix padding in the lever history table (#21725)

* APPEALS-46037. Fix padding in the lever history table

* APPEALS-46037. Fix lint issues

---------

Co-authored-by: SHarshain <[email protected]>

* Fix Lauren Roth issue (#21813)

* Users with a VACOLS::Staff entry no longer get created with the default name of Lauren Roth

Co-authored-by: Christopher Detlef <>

* ricky/APPEALS-44044 (#21814)

* first pass at legacy_docket method and spec

* second iteration of legacy_docket and spec

* adds method to age_of_oldest methods and updates test scenarios

* Updated testing and expanded method missing logic

* Updated legacy_docket_spec file and tests

* Updated boolean logic, updated rspecs and factories

* Updated rspec tests to include factories

* updates docket_spec line 317 and factory for disable_ama_non_priority_direct_review

---------

Co-authored-by: Michael Beard <[email protected]>

* updates ready_priority_nonpriority_appeals to public_send, updates test (#21844)

* APPEALS-36333 first iteration of docket time goal and prior to goal (#21523)

* APPEALS-36333 first iteration of docket time goal and prior to goal

* APPEALS-36333 address pr comments and moved the logic to docket model

* APPEALS-36333 Added specs for docket and hearing request docket models

* refactored code and moved it to distribution scopes

* APPEALS-36333 address pr comments and refactor code

* APPEALS-43996 updated lever name in all the required files to fix spec failures

* APPEALS-44000 revert hearing request docket model changes to keept it in sync with feature

* APPEALS-44000 updated hearing request docket model specs

* APPEALS-44000 fixed jest tests

* APPEALS-44000 fixed broken rspecs

* APPEALS-43996 fix rubocop warnings

* APPEALS-43996 fix push priority job spec failures

* APPEALS-43996 Updated case distribution lever and docker model and refactor specs

* APPEALS-43996 added rake task to update case distribution lever item in db

* APPEALS-43996 update docket model to handle the scenario when the lever being disabled by a user via the UI

* APPEALS-43996 update section title

* APPEALS-43996 revert rake task

* APPEALS-43996 add new factories to case distribution lever and fix spec failures

* APPEALS-45191. Added columns to the appeals ready to distribute query and made some tweaks (#21834)

* APPEALS-45191. Added columns to the appeals ready to distribute query and made some tweaks

* APPEALS-45191. Refactor and fix lint issues

---------

Co-authored-by: SHarshain <[email protected]>

* refactor the logic and fix docket spec failures

* changed the call times to 3 times

* APPEALS-36333 fixed the docket time goal to check the existence of the item before using the public send to get the value

---------

Co-authored-by: SHarshain <[email protected]>
Co-authored-by: SHarshain <[email protected]>
Co-authored-by: 631966 <[email protected]>

* updated the seeds to align with the work completed

* Updated Toggle Switch behavior when clicked while idle (#21874)

* Csv research (#21892)

* APPEALS-44911. Change the pure react components to functional components

* APPEALS-44911. Redux implementation

* APPEALS-44911. CSS changes for custom seed preview

* APPEALS-44911. tweak css

* csv and etc

* CSS for buttons

* jest tests for the reducer and action types

* Jest test

---------

Co-authored-by: SHarshain <[email protected]>
Co-authored-by: Amy Detwiler <[email protected]>

* APPEALS-46057. CleanUP (#21914)

* more jest tests

* Disable scenario seeds

* Lint fixes

* APPEALS-46057. disable all scenario seeds

* APPEALS-46057. Refactor the TestSeed wrapper to be a functional component and fixed jest test

* APPEALS-46057. Jest job in GHA complaining on test

---------

Co-authored-by: SHarshain <[email protected]>

* updates line of test to correctly build lever item (#21918)

Co-authored-by: Amy Detwiler <[email protected]>

* APPEALS-45191. Updated the query to return the date based on the calculation (#21928)

* APPEALS-45191. Updated the query to return the date based on the calculation

* APPEALS-45191. Lint fix

---------

Co-authored-by: SHarshain <[email protected]>

* Chrisharsha/appeals 43962 (#21929)

* Sharsha/appeals-44911_1 (#21784)

* APPEALS-44911. Change the pure react components to functional components

* APPEALS-44911. Redux implementation

* APPEALS-44911. CSS changes for custom seed preview

* APPEALS-44911. tweak css

---------

Co-authored-by: SHarshain <[email protected]>

* Chrisbdetlef/appeals 44910 (#21838)

* Initial

* Add JSON parsing and multiple calls to rake tasks

* Pre-caby tets

* Add capybara tests and add IDs to buttons

---------

Co-authored-by: Christopher Detlef <>

---------

Co-authored-by: SHarshain <[email protected]>
Co-authored-by: cdetlefva <[email protected]>

* APPEALS-43962. Lint fixes (#21932)

Co-authored-by: SHarshain <[email protected]>

* Ricky/APPEALS-47293 (#21925)

* First pass implementation of fixing seeding rspecs

* Second pass at fixing errors in rspecs

* Revert updates to test if rspec passes

* Fixed linting issues in test_docket_seeds_controller_spec

---------

Co-authored-by: Amy Detwiler <[email protected]>

* APPEALS-48292 updated the column to be a string (#21954)

* APPEALS-48292 updated the column to be a string

* APPEALS-48292 added comment to the control_group field in the migration

* APPEALS-48292 added column comment to the schema, changed migration so that it can be rolled back

* APPEALS-48598 fix logic when Start Distribution Prior to Docket Time Goal toggle is false (#21948)

* APPEALS-48598 fix logic when Start Distribution Prior to Docket Time Goal toggle is false

* APPEALS-49004 added spec to check when Start Distribution Prior to Docket Time Goal toggle is on

* APPEALS-49004 fixed lint issues in docket.rb

* APPEALS-48898. Created Distributable AMA Non-priority Appeals Query (#21949)

* APPEALS-48898. Created Distributable AMA Non-priority Appeals Query

* APPEALS-48898. Renamed the column and update the method

---------

Co-authored-by: SHarshain <[email protected]>

* APPEALS-49100. getting value from the start_distribution_prior_to_goal (#21968)

Co-authored-by: SHarshain <[email protected]>

* mbeard/APPEALS-46257 (#21976)

* updates routes and frontend urls to namespace

* removes superfluous <a> tags

* Ensure that legacy appeals are being created (#21981)

* Ensure that legacy appeals are being created

* Remove puts

---------

Co-authored-by: Christopher Detlef <>

* APPEALS-49403. Added buttons Docket Lever Seed (#21989)

* APPEALS-49403. Added buttons Docket Lever Seed

* sharsha/APPEALS-49403. Updated the endpoint URL path

* APPEALS-49403. Lint fix

---------

Co-authored-by: SHarshain <[email protected]>

* APPEALS-44000 added check to skip priority appeals in docket model (#21992)

* Feature/appeals 36234 masterupgrade (#22003)

* sbashamoni/APPEALS-43724 Node 16 version upgrade changes (#21966) (#21975)

* Update node verstion to 16 in git workflow

* Update node verstion to 16 in nvm and dockerfile for demo

* Update node version in yarn.lock and package.json and .nvmrc file

* Update node's version path to node16 in docker-bin/env.sh

* Update and upgrade to node16 in client

* More updates to yarn.lock and package.json

* Fix tests by Adam Shaw

* Upadate snapshot for ScheduleVeteran.test.js.snap

* Doing some code clean up

* Doiing some more clean up

* Add and remove spaces to match master

* One more space to take care of

* One more space to take care of again

* One more space to take care of again

---------

Co-authored-by: ramon-chavez <[email protected]>

* init master merge branch

---------

Co-authored-by: sbashamoni <[email protected]>
Co-authored-by: ramon-chavez <[email protected]>

* Remove AOD trait from non-priority legacy appeal creation (#22013)

Co-authored-by: Christopher Detlef <>

* Sharsha/appeals 49461 (#22018)

* sharsha/APPEALS-49461. initial commit

* sharsha/APPEALS-49461. fix

---------

Co-authored-by: SHarshain <[email protected]>

* mbeard/APPEALS-49421 (#22014)

* init commit fixes ama_np_ capybara test to expect user as admin, and first attempt  test_docket_seeds test

* removes previous chane for TASKS_LOADED

* fixes capybara for test seeds controller button ids

---------

Co-authored-by: Amy Detwiler <[email protected]>

* APPEALS-49403. Updated the buttons label (#22025)

Co-authored-by: SHarshain <[email protected]>

* mbeard/APPEALS-49585 (#22020)

* init commit for non member view input

* fixes css issue for docket-lever-right

* Added a hyphen between value and unit for member only view

* replaces hyphen with comma

---------

Co-authored-by: Blake Manus <[email protected]>
Co-authored-by: sbashamoni <[email protected]>
Co-authored-by: sbashamoni <[email protected]>
Co-authored-by: Michael Beard <[email protected]>
Co-authored-by: cdetlefva <[email protected]>
Co-authored-by: SHarshain <[email protected]>
Co-authored-by: Michael Beard <[email protected]>
Co-authored-by: SHarshain <[email protected]>
Co-authored-by: 631068 <[email protected]>
Co-authored-by: Isaiah Saucedo <[email protected]>
Co-authored-by: Calvin <[email protected]>
Co-authored-by: youfoundmanesh <[email protected]>
Co-authored-by: Craig Reese <[email protected]>
Co-authored-by: Robert Travis Pierce <[email protected]>
Co-authored-by: Jeremy Croteau <[email protected]>
Co-authored-by: davis-dwayne <[email protected]>
Co-authored-by: kristeja <[email protected]>
Co-authored-by: Craig Reese <[email protected]>
Co-authored-by: ramon-chavez <[email protected]>
Co-authored-by: Matt Roth <[email protected]>
  • Loading branch information
21 people authored Jun 27, 2024
1 parent 9cd2c7a commit 849f067
Show file tree
Hide file tree
Showing 92 changed files with 22,776 additions and 355 deletions.
33 changes: 29 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ def case_distribution_url
}
end

def test_seeds_url
{
title: "Test Seeds",
link: "/test/seeds",
sort_order: 7
}
end

def hearing_application_url
{
title: "Hearings",
Expand Down Expand Up @@ -210,14 +218,31 @@ def manage_users_menu_item

def admin_menu_items
admin_urls = []
admin_urls.concat(manage_teams_menu_items) if current_user&.administered_teams&.any?
admin_urls.push(manage_users_menu_item) if current_user&.can_view_user_management?
admin_urls.push(case_distribution_url) if current_user&.organizations&.any?(&:users_can_view_levers?)
add_team_management_items(admin_urls)
add_user_management_items(admin_urls)
add_case_distribution_item(admin_urls)
add_test_seeds_item(admin_urls)

admin_urls.flatten
end

def add_team_management_items(admin_urls)
if current_user&.can_view_team_management? || current_user&.can_view_judge_team_management?
admin_urls.unshift(manage_all_teams_menu_item)
end
admin_urls.flatten
end

def add_user_management_items(admin_urls)
admin_urls.concat(manage_teams_menu_items) if current_user&.administered_teams&.any?
admin_urls.push(manage_users_menu_item) if current_user&.can_view_user_management?
end

def add_case_distribution_item(admin_urls)
admin_urls.push(case_distribution_url) if current_user&.organizations&.any?(&:users_can_view_levers?)
end

def add_test_seeds_item(admin_urls)
admin_urls.push(test_seeds_url) if current_user&.organizations&.any?(&:users_can_view_levers?)
end

def dropdown_urls
Expand Down
27 changes: 27 additions & 0 deletions app/controllers/case_distribution_levers_tests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ def run_demo_aod_hearing_seeds
head :ok
end

def run_demo_ama_docket_goals
Rake::Task["db:seed:demo_ama_docket_goals_lever_test_data"].reenable
Rake::Task["db:seed:demo_ama_docket_goals_lever_test_data"].invoke

head :ok
end

def run_demo_docket_priority
Rake::Task["db:seed:demo_docket_priority_lever_test_data"].reenable
Rake::Task["db:seed:demo_docket_priority_lever_test_data"].invoke

head :ok
end

def appeals_ready_to_distribute
csv_data = AppealsReadyForDistribution.process

Expand All @@ -39,6 +53,19 @@ def appeals_ready_to_distribute
send_data csv_data, filename: filename
end

def appeals_non_priority_ready_to_distribute
csv_data = AppealsNonPriorityReadyForDistribution.process

# Get the current date and time for dynamic filename
current_datetime = Time.zone.now.strftime("%Y%m%d-%H%M")

# Set dynamic filename with current date and time
filename = "AMA_Non_priority_distributable_#{current_datetime}.csv"

# Send CSV as a response with dynamic filename
send_data csv_data, filename: filename
end

def appeals_distributed
# change this to the correct class
csv_data = AppealsDistributed.process
Expand Down
7 changes: 4 additions & 3 deletions app/controllers/concerns/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
module Errors
extend ActiveSupport::Concern
def invalid_role_error
render json: {
{
"errors": [
"title": "Role is Invalid",
"detail": "User is not allowed to perform this action"
]
}, status: :bad_request
],
"status": "bad_request"
}
end
end
8 changes: 7 additions & 1 deletion app/controllers/legacy_tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ def validate_user_id
end

def validate_user_role
return invalid_role_error unless ROLES.include?(user_role)
return true if ROLES.include?(user_role)

Rails.logger.info("User with roles #{current_user.roles.join(', ')} "\
"couldn't access #{request.original_url}: Error: #{invalid_role_error}")

session["return_to"] = request.original_url
redirect_to "/unauthorized"
end

def user
Expand Down
49 changes: 49 additions & 0 deletions app/controllers/test_docket_seeds_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

class TestDocketSeedsController < ApplicationController
before_action :check_environment # , :verify_access
# before_action :current_user, only: [:reset_all_appeals]

def seed_dockets
JSON.parse(request.body.read).each do |row_entry|
task_name = Constants.TEST_SEEDS.to_h[row_entry["seed_type"].to_sym]
ENV["SEED_COUNT"] = row_entry["seed_count"].to_s
ENV["DAYS_AGO"] = row_entry["days_ago"].to_s
ENV["JUDGE_CSS_ID"] = row_entry["judge_css_id"].to_s

Rake::Task[task_name].reenable
Rake::Task[task_name].invoke

ENV.delete("SEED_COUNT")
ENV.delete("DAYS_AGO")
ENV.delete("JUDGE_CSS_ID")
end

head :ok
end

def reset_all_appeals
RequestStore[:current_user] = current_user
DistributionTask.where(status: "assigned").map { |t| t.update!(status: "on_hold") }
VACOLS::Case.where(bfcurloc: %w[81 83]).map { |c| c.update!(bfcurloc: "testing") }

head :ok
end

private

# def verify_access ##future work
# return true if current_user&.organizations && current_user.organizations.any?(&:users_can_view_levers?)

# session["return_to"] = request.original_url
# redirect_to "/unauthorized"
# end

def check_environment
return true if Rails.env.development?
return true if Rails.deploy_env?(:demo)
return true if Rails.deploy_env?(:uat)

redirect_to "/unauthorized"
end
end
41 changes: 41 additions & 0 deletions app/controllers/test_seeds_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

require "csv"

class Test::TestSeedsController < ApplicationController
before_action :check_environment
before_action :verify_access, only: [:seeds]
before_action :authorize_admin, only: [:seeds]

def seeds
# seeds
render "/test/seeds"
end

private

def check_environment
return true if Rails.env.development?
return true if Rails.deploy_env?(:demo)

redirect_to "/unauthorized"
end

def authorize_admin
error = ["UNAUTHORIZED"]

resp = {
status_code: 500,
message: error,
user_is_an_acd_admin: false
}
render json: resp unless CDAControlGroup.singleton.user_is_admin?(current_user)
end

def verify_access
return true if current_user&.organizations && current_user.organizations.any?(&:users_can_view_levers?)

session["return_to"] = request.original_url
redirect_to "/unauthorized"
end
end
8 changes: 1 addition & 7 deletions app/jobs/push_priority_appeals_to_judges_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ def slack_report # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
docket_coordinator.dockets.each_pair do |sym, docket|
report << "*Number of #{sym} appeals _not_ distributed*: #{docket.count(priority: true, ready: true)}"
end
unless disable_legacy?
report << "*Number of Legacy Hearing Non Genpop appeals _not_ distributed*: #{legacy_not_genpop_count}"
end
report << "*Number of Legacy Hearing Non Genpop appeals _not_ distributed*: #{legacy_not_genpop_count}"

report << ""
report << "*Debugging information*"
Expand Down Expand Up @@ -184,10 +182,6 @@ def use_by_docket_date?
FeatureToggle.enabled?(:acd_distribute_by_docket_date, user: RequestStore.store[:current_user])
end

def disable_legacy?
FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])
end

def legacy_not_genpop_count
docket_coordinator.dockets[:legacy].not_genpop_priority_count
end
Expand Down
11 changes: 10 additions & 1 deletion app/models/case_distribution_lever.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class CaseDistributionLever < ApplicationRecord
#{Constants.DISTRIBUTION.ama_hearing_case_aod_affinity_days}
#{Constants.DISTRIBUTION.cavc_affinity_days}
#{Constants.DISTRIBUTION.ama_evidence_submission_docket_time_goals}
#{Constants.DISTRIBUTION.ama_hearings_docket_time_goals}
#{Constants.DISTRIBUTION.ama_hearing_docket_time_goals}
#{Constants.DISTRIBUTION.ama_hearing_start_distribution_prior_to_goals}
#{Constants.DISTRIBUTION.ama_evidence_submission_start_distribution_prior_to_goals}
).freeze

FLOAT_LEVERS = %W(
Expand All @@ -31,6 +33,11 @@ class CaseDistributionLever < ApplicationRecord
#{Constants.DISTRIBUTION.nod_adjustment}
).freeze

BOOLEAN_LEVERS = %W(
#{Constants.DISTRIBUTION.disable_legacy_priority}
#{Constants.DISTRIBUTION.disable_legacy_non_priority}
).freeze

def history_value
if combination_lever?
combination_value
Expand Down Expand Up @@ -185,6 +192,8 @@ def method_missing_value(name)
Integer(lever)
elsif FLOAT_LEVERS.include?(name)
Float(lever)
elsif BOOLEAN_LEVERS.include?(name)
ActiveModel::Type::Boolean.new.cast(lever)
else
lever
end
Expand Down
22 changes: 8 additions & 14 deletions app/models/concerns/by_docket_date_distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ def requested_distribution
priority_rem = priority_target.clamp(0, @rem)
distribute_priority_appeals_from_all_dockets_by_age_to_limit(priority_rem, style: "request")

unless FeatureToggle.enabled?(:acd_disable_nonpriority_distributions, user: RequestStore.store[:current_user])
# Distribute the oldest nonpriority appeals from any docket if we haven't distributed {batch_size} appeals
# @nonpriority_iterations guards against an infinite loop if not enough cases are ready to distribute
until @rem <= 0 || @nonpriority_iterations >= MAX_NONPRIORITY_ITERATIONS
distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(@rem)
end
# Distribute the oldest nonpriority appeals from any docket if we haven't distributed {batch_size} appeals
# @nonpriority_iterations guards against an infinite loop if not enough cases are ready to distribute
until @rem <= 0 || @nonpriority_iterations >= MAX_NONPRIORITY_ITERATIONS
distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(@rem)
end
@appeals
end
Expand All @@ -59,7 +57,7 @@ def distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(limit, style
end
end

# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def ama_statistics
priority_counts = { count: priority_count }
nonpriority_counts = { count: nonpriority_count }
Expand All @@ -69,19 +67,15 @@ def ama_statistics
nonpriority_counts[sym] = docket.count(priority: false, ready: true)
end

unless FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])
priority_counts[:legacy_hearing_tied_to] = legacy_hearing_priority_count(judge)
nonpriority_counts[:legacy_hearing_tied_to] = legacy_hearing_nonpriority_count(judge)
end
priority_counts[:legacy_hearing_tied_to] = legacy_hearing_priority_count(judge)
nonpriority_counts[:legacy_hearing_tied_to] = legacy_hearing_nonpriority_count(judge)

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,
:specialty_case_team_distribution
]
feature_toggles.each do |sym|
Expand Down Expand Up @@ -110,7 +104,7 @@ def ama_statistics
#{error.class}: #{error.message}, #{error.backtrace.first}"
}
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
# rubocop:enable Metrics/MethodLength

def ama_distributed_cases_tied_to_ineligible_judges
@appeals.filter_map do |appeal|
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/distribution_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def cancel_previous_judge_assign_task(appeal, judge_id)
# rubocop:disable Metrics/MethodLength
# :reek:FeatureEnvy
def create_sct_appeals(appeals_args, limit)
appeals = appeals(appeals_args)
appeals = ready_priority_nonpriority_appeals(appeals_args)
.limit(limit)
.includes(:request_issues)

Expand Down
2 changes: 0 additions & 2 deletions app/models/distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ def judge_tasks
end

def judge_legacy_tasks
return [] if FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])

legacy_tasks = QueueRepository.tasks_for_user(judge.css_id)

@judge_legacy_tasks ||= legacy_tasks.select { |task| task.assigned_to_attorney_date.nil? }
Expand Down
Loading

0 comments on commit 849f067

Please sign in to comment.