Skip to content

Commit

Permalink
Feature/appeals 26750 int (#20933)
Browse files Browse the repository at this point in the history
* 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 <spoosa@razortalent.com>

* 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 <amy.detwiler@va.gov>

* Add toggle switch component (#19794)

* Add toggle switch component

* Added toggle fuctions for ON,OFF and Disable states

* Clean up

---------

Co-authored-by: SHarshain <spoosa@razortalent.com>

* * 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 <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* * 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 <spoosa@razortalent.com>

* Appeals-32140. Added Database table to store ACD lever information (#19889)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* Created case distribution audit lever entries (#19893)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* 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 <amy.detwiler@va.gov>

* 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 <spoosa@razortalent.com>
Co-authored-by: 631966 <amy.detwiler@va.gov>

* Second draft (#19922)

Co-authored-by: Christopher Detlef <>
Co-authored-by: 631966 <amy.detwiler@va.gov>

* 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 <amy.detwiler@va.gov>

* Chrisbdetlef/appeals 34018 (#19954)

* Second draft

* APPEALS-34018 Create CDLever Controller and Routing

---------

Co-authored-by: Christopher Detlef <>
Co-authored-by: 631966 <amy.detwiler@va.gov>
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 <rickybmanus@gmail.com>

* 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 <spoosa@razortalent.com>

* 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 <amy.detwiler@va.gov>

* 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 <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* 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 <amy.detwiler@va.gov>

* 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 88ade0a.

* last known working feature commit

* APPEALS-34353. fixed controller specs (#20217)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* 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 <amy.detwiler@va.gov>

* 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 <amy.detwiler@va.gov>

* 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 <amy.detwiler@va.gov>

* 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 <amy.detwiler@va.gov>

* 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 <amy.detwiler@va.gov>

* 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 <amy.detwiler@va.gov>

* 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 <rickybmanus@gmail.com>

* 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 <rickybmanus@gmail.com>

* 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 <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* APPEALS-37314 fixes X functionality (#20339)

* APPEALS-37227. Sort the levers (#20319)

Co-authored-by: SHarshain <spoosa@razortalent.com>
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 <spoosa@razortalent.com>
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 <amy.detwiler@va.gov>

* APPEALS-37466. ama_direct_review_docket_time_goals value fix (#20373)

Co-authored-by: SHarshain <spoosa@razortalent.com>
Co-authored-by: Matt Roth <roth_matthew@bah.com>

* APPEALS-37315. Fix the focus on first option only and disable the input when selected other options (#20374)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* 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 <roth_matthew@bah.com>

* 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 <alex.smith.99@thunderyard.com>
Co-authored-by: Matthew Roth <roth_matthew@bah.com>

* 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 <spoosa@razortalent.com>

* 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 <roth_matthew@bah.com>

* 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 <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* 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 <roth_matthew@bah.com>

* APPEALS-38572. Addressed the missing test coverage for case_distribution levers controller (#20613)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* APPEALS-38571. Tweaked the spec and addressed the missing test coverage (#20614)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>
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 <spoosa@razortalent.com>

* 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 <roth_matthew@bah.com>

* 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 <roth_matthew@bah.com>

* 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 <roth_matthew@bah.com>

* 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 <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>

* APPEALS-38562./ Removes the unused component (#20697)

Co-authored-by: SHarshain <spoosa@razortalent.com>
Co-authored-by: Matt Roth <roth_matthew@bah.com>

* "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 <roth_matthew@bah.com>

* 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 <amy.detwiler@va.gov>

* 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 <amy.detwiler@va.gov>

* 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 <spoosa@razortalent.com>
Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com>

* Update leversActions.js (#20760)

* APPEALS-39899. Spec fix (#20758)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* 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 <roth_matthew@bah.com>

* APPEALS-40085 Update ACD lever count (#20769)

Co-authored-by: Christopher Detlef <>
Co-authored-by: Matt Roth <roth_matthew@bah.com>

* APPEALS-40092. Fix negative rspec matcher (#20772)

Co-authored-by: SHarshain <spoosa@razortalent.com>
Co-authored-by: Matt Roth <roth_matthew@bah.com>

* "fixed spelling and updated spec to include two new users" (#20777)

Co-authored-by: Matt Roth <roth_matthew@bah.com>

* 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 <rickybmanus@gmail.com>
Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com>
Co-authored-by: 631966 <amy.detwiler@va.gov>

* APPEALS-40134. Add missing traits in factories (#20789)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* APPEALS-40131. Fix case_distribution_levers seed spec (#20786)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* APPEALS-39980. Mock the value in the spec (#20784)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* "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 <amy.detwiler@va.gov>

* 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 <spoosa@razortalent.com>

* APPEALS-39980. Fix the timestamp failure in the spec (#20836)

Co-authored-by: SHarshain <spoosa@razortalent.com>

* 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 <spoosa@razortalent.com>
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 <amy.detwiler@va.gov>
Co-authored-by: 631068 <rickybmanus@gmail.com>
Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com>
Co-authored-by: Alexander Smith <alex.smith.99@thunderyard.com>
  • Loading branch information
11 people authored Feb 23, 2024
1 parent b64b2a7 commit f49268d
Show file tree
Hide file tree
Showing 25 changed files with 1,067 additions and 752 deletions.
2 changes: 1 addition & 1 deletion app/controllers/case_distribution_levers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,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
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/judge_assign_tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
82 changes: 73 additions & 9 deletions app/models/case_distribution_lever.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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

Expand All @@ -28,15 +28,24 @@ 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

private

def value_matches_data_type
Expand All @@ -48,7 +57,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

Expand All @@ -71,6 +80,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.to_s} #{selected_option["unit"]}"
end

class << self
def respond_to_missing?(name, _include_private)
Constants.DISTRIBUTION.to_h.key?(name)
Expand All @@ -91,6 +126,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)

Expand All @@ -105,7 +149,7 @@ def update_acd_levers(current_levers, current_user)
private

def method_missing_value(name)
lever = find_by_item(name).try(:distribution_value)
lever = find_by_item(name).try(:value)

if INTEGER_LEVERS.include?(name)
lever.to_i
Expand All @@ -123,8 +167,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

Expand All @@ -138,5 +182,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
3 changes: 2 additions & 1 deletion app/models/tasks/attorney_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,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
Expand Down
2 changes: 1 addition & 1 deletion client/COPY.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@
"ASSIGN_WIDGET_NO_TASK_DETAIL": "Please select a task.",
"ASSIGN_WIDGET_SUCCESS": "%(verb)s %(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...",
Expand Down
64 changes: 44 additions & 20 deletions client/app/caseDistribution/components/AffinityDays.jsx
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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 (
<div key={`${option.item}-${lever.item}-${index}`}>
<div>
Expand All @@ -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}` : ''}`}
</label>
</div>
</div>
Expand All @@ -87,27 +111,27 @@ 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 (
<div key={`${lever.item}-${index}-${option.item}`}>
<div>
<input
checked={option.item === lever.value}
checked={isOptionSelected(lever, option)}
type={ACD_LEVERS.data_types.radio}
value={option.item}
disabled={lever.is_disabled_in_ui}
id={`${lever.item}-${option.item}`}
name={lever.item}
onChange={() => console.warn('not implemented')}
onChange={onChangeRadio(lever, option)}
/>
<label htmlFor={`${lever.item}-${option.item}`}>
{option.text}
</label>
</div>
<div>
<div className={className} aria-label={option.unit}>
{generateFields(option.data_type, option, lever, isUserAcdAdmin)}
{generateFields(option.data_type, option, lever)}
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions client/app/caseDistribution/components/BatchSize.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 (
Expand Down
29 changes: 14 additions & 15 deletions client/app/caseDistribution/components/DocketTimeGoals.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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)}
/>
<div
className={distributionPriorLever.is_toggle_active ? 'toggle-switch-input' : 'toggle-input-hide'}
Expand Down
Loading

0 comments on commit f49268d

Please sign in to comment.