From 6dd9870c8f1402e3a24ee9573847117024e0a885 Mon Sep 17 00:00:00 2001 From: Craig Reese <109101548+craigrva@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:05:31 -0500 Subject: [PATCH] Release R2.3.0 FY24Q4.3.0 (#22517) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Hotfix/appeals 45 2 (#22198) * Trigger Build * Update email address from Hearings to Decisions --------- Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com> * APPEALS-46269: Remove the ability to enable proportions code (#22499) * remove conditional for selecting distribution algorithm * fix tests which broke when removing the toggle * Feature/appeals 42187 (#22522) * cmartine/APPEALS-42621 (#21599) * Add remove_comp_and_pen_intake feature toggle to intakes controller * Add new compensation and pension removal message to COPY.json * Disable comp and pen radio buttons if remove_comp_and_pen_intake toggle is on * Frontend test updates * Add tooltip checks for review page integration tests * fix frontend test lint errors * frontend tests changes * Fix linter errors --------- Co-authored-by: kshiflett88 Co-authored-by: root * nrithner/APPEALS-45263 (#21617) * Add remove_comp_and_pen_intake feature toggle to intakes controller * Add new compensation and pension removal message to COPY.json * Disable comp and pen radio buttons if remove_comp_and_pen_intake toggle is on * Frontend test updates * Add tooltip checks for review page integration tests * fix frontend test lint errors * frontend tests changes * Add banner for non-vha * Add banner for VHA employee * Refactor conditionals * Refactor logic for banners to display * Add dangerouslySetHtml to banner * Add test for no VHA employee with vha_claim_review_establishment disabled. * Add VHA employee scenario to display REMOVE_INTAKE_COMP_AND_PEN * Complete non vha user scenarios * Complete VHA employee scenarios * Remove comments * Fix linter errors * Remove spaces preceding question marks * Correct linting errors --------- Co-authored-by: Chris-Martine Co-authored-by: kshiflett88 Co-authored-by: root --------- Co-authored-by: Chris-Martine <135330019+Chris-Martine@users.noreply.github.com> Co-authored-by: kshiflett88 Co-authored-by: root Co-authored-by: nicorithner-bah <148365039+nicorithner-bah@users.noreply.github.com> Co-authored-by: Chris-Martine * Feature/appeals 51138.rc.4.3.0 (#22523) * 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 <133032208+amybids@users.noreply.github.com> * 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 <133032208+amybids@users.noreply.github.com> * 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 Co-authored-by: Michael Beard Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * Sharsha/appeals 45531 (#21566) * Fixed rspec failures on constants * APPEALS-45531. Remove dead code --------- Co-authored-by: SHarshain * Updated lever history to handle null unit values from docket levers (#21567) Co-authored-by: 631966 * 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 Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * 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 Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-45502. Organize route and fix the controller (#21595) Co-authored-by: SHarshain Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * 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 * 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 * 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 * 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 * Add ruby CE API Gem * remove correspondence changes from schema.rb (#21468) * Revert "Add ruby CE API Gem" (#21479) This reverts commit c78afe30620716d59d2ac31ad6eed71585d78a98. * 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 a6262001f9bedabca60598c82bfe1b803f0f16c7. * 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 <47563178+davis-dwayne@users.noreply.github.com> * APPEALS-43117 Add QA Users for testing * Fix rspecs * Fix issues with attorneys and judge teams * Fix org count --------- Co-authored-by: Isaiah Saucedo Co-authored-by: Calvin Co-authored-by: youfoundmanesh Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> Co-authored-by: Robert Travis Pierce Co-authored-by: Jeremy Croteau Co-authored-by: sbashamoni <138054633+sbashamoni@users.noreply.github.com> Co-authored-by: davis-dwayne <47563178+davis-dwayne@users.noreply.github.com> 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 * 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 * 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 * 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 <133917878+SHarshain@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: 631966 * 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 Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * 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 * updates line of test to correctly build lever item (#21918) Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * 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 * 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 * 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 Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> * APPEALS-43962. Lint fixes (#21932) Co-authored-by: SHarshain * 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 <133032208+amybids@users.noreply.github.com> * 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 * APPEALS-49100. getting value from the start_distribution_prior_to_goal (#21968) Co-authored-by: SHarshain * mbeard/APPEALS-46257 (#21976) * updates routes and frontend urls to namespace * removes superfluous 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 * 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 * init master merge branch --------- Co-authored-by: sbashamoni <138054633+sbashamoni@users.noreply.github.com> Co-authored-by: ramon-chavez * 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 * 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 <133032208+amybids@users.noreply.github.com> * APPEALS-49403. Updated the buttons label (#22025) Co-authored-by: SHarshain * 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 * Init commit replaces th with div for 508 compliance (#22036) * Chrisbdetlef/appeals 47008 1 (#22040) * Allow judges to see legacy cases and attorneys to be assigned cases * Remove testing function * Update spec to reflect new user count in seed file --------- Co-authored-by: Christopher Detlef <> * got rid of extraneous file * got rid of yarn lock orig * APPEALS-50734. Remove Legacy appeals from the query (#22071) Co-authored-by: SHarshain * APPEALS-46087 fix css table width issues for case distribution lever history table (#22024) * Feature/appeals 36234.merge master.20240701 (#22075) * APPEALS-47277 remove Vegas office (#21876) * APPEALS-47277 remove Vagas office * Removed Texas ID from other files and updated tests * Snapshot update --------- Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com> Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com> * hotfix/APPEALS-22403 (#21942) * add identifier for filenumber or ssn in filenumber search * linting * codeclimate linting * update match call to return boolean --------- Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com> Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com> * APPEALS-46907: Update to Determination of Gen Pop Legacy Cases (#21986) * Isaiah/merge 46910 (#21983) * removed BFHINES checks and modified tests * removed lingering bfhines test * modified test * most recent updates on tests for passing status * removed refs to cavc updates * Skip flaky test ro_viewhearsched_spec --------- Co-authored-by: Isaiah Saucedo * APPEALS-44916: Case Distribution Affinity Calculations (#21899) * APPEALS-44956: Add AppealAffinity model and database table (#21526) * add migration for appeal_affinities * add AppealAffinity model and associations, update migration for new column * update index to be unique * add factory, add tests * add factory traits to appeal and case for appeal affinities * add combination trait to appeal factory * add appeal_affinity to skipped associations in ETL reporting * add a validation, test * Craig/appeals 44958 (#21564) * add new job, update affinity model validation and after save hook * add update from push job * fix job extending distribution scopes * add with appeal affinities to distribution scopes * typo * add error handling, add test file * add distributed case factory, refactor naming in job * fix factories, added tests * fix migration for null affinity start date column * fixes, added tests * more test updates * add return in job if no query results, tests for no query results * add test for after_save hook adding dist task instructions * set start dist job to queue affinity job after running * fix update job and start dist job spec * queue affinity update job from push job * code clarity * fix judge in seed file * remove comment, fix hearing factory, disable some seeds for testing * add more tests * test refactor * update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory * disable new seed on reset * update seed file with vet names, add another seed category * fix distirbuted case factory? * actually fix GHA runs * lint, test fixes * change constants in new job * APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611) * swap distribution queries from distribution_task to appeal_affinities * update seed files to use appeal affinities instead of distribution task * clean up seed file method names * add missing Timecop.return in ama affinity case seed * fix name of a method in a seed file * remove references to distribution task in distribution scopes * fix push priority job tests * fix naming of args in one of the seed files * fix user seed, fix date format in distribution task instructions * fix tests for date format update * Calvin/APPEALS-44957-rake-affinity (#21577) * grabbed receipt dates from distributed cases * refactored for functionality + added method to grab appeals that match * using receipt date, get all related appeals * added update/creation plus cleaned prior imple. * gets most recent distributed case receipt_date * skips if receipt_date is nil for performance * if appeal affinity is nil, it will now be updated * created spec file * fixed non ready appeals * updated query to match new AC * removing comment * testing for each docket * updated spec file * added new tests to rspec * updated start date to receipt date instead of Time.now * fixed date/time rspec errors * added rails logger to know when rake task has finished * added tag for rails log * removed nonpriority dockets for direct_review and evidence_submission * fixed lint issue * fixed flaky spec test * limits distributed cases query to within the last week * APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660) * add affinity start date to explain page * add feature test to verify dates display * update rake task and spec (#21731) * APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730) * add aod hearing cases to ama affinity cases seed * fix lever spec * APPEALS-45148: Hook to clear saved affinity date (#21623) * initial imp. idea * AC1: check for affinity_start_date on assignment * AC2/3: update affinity start date w/ instr. * updates to naming, instructions, and hook logic * updates after review * rspec coverage and addtional condition * removed unused identifier * removed reduntant 'self's * added update on actual AA record * updated to save aa record and addtional rspec * added change to assignment on no record test * check for assignment * addd update to 'on_hold' status * public method to handle legacy affinity appeals * added .reload to :with_affinity_appeal * added .reload to :ready_for_distribution * updates to pass explain_spec * switched boolean values * typo * readujsted order on :create for affinity appeal * removed after(:create) * testing rspec by readding after :create * reloading in assertation * addressing lint errors * fix seeds/users_spec * add case dist lever to new tests (#21776) * remove unnecessarily included module from job (#21827) * APPEALS-47211: Improve Performance of Distribution Queries (#21840) * rework ready_for_distribution scope * fix non-hearing docket distribution bug * restart tests * added null checks for appeal affinity in distribution queries, update tests (#21893) * add check for appeal being active to distribution and associated slack message (#21902) * Update users_spec.rb --------- Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Co-authored-by: Isaiah Saucedo * hotfix/APPEALS-45177: TaskTable Default Sorting Fix (#21772) * Updated the TaskTable component to use the defaultSort property instead of the defaultSortIdx property for queue table since that property is not used anywhere. Added a default sorting hash to the UnassignedCasesPage component and now pass that down to TaskTable. Removed references to defaultSortIdx. * Added the type column default sort to the AssignedCasesPage widget as well. * Added a parenthesis for clarity around a boolean. Moved the defaultSortingHash out into a constants file. --------- Co-authored-by: Robert Travis Pierce * APPEALS-47106 Caseflow Swagger (#21993) * Add Rswag and convert existing API documentation (#21778) * add rswag * Update Gemfile.lock * Setup yaml UI * remove and reroute old swagger files * update format and servers values * Update route_docs_controller.rb * Update cmp_controller.rb * cmp endpoint yaml * cmp endpoint to return 501 * CMP endpoint swagger flies * update swagger files * adjust server order, add auth token * cmp parameter name change * add comments * Update users_controller.rb * unit tests and linting * lint fixes * Update swagger_helper.rb * APPEALS-48048 Swagger Updates (#21909) * update servers to not include a host * remove host for server * remove generated swaggers from definitions * remove internal API endpoints from having generated swagger * IDT servers fixes * disable CMP swagger in prod and prodtest * set authorization correctly * fix what is required for CMP upload * fix linting issues, update lint rake task to autocorrect for rubocop, add rubocop make command * Update decision_reviews.yaml * Update ama_issues.yaml * Update vacols_issues.yaml * Update swagger.yaml * fix check failures * Update docs_controller_spec.rb * fix unit tests * Update fetch_all_active_legacy_appeals_job_spec.rb * Update rswag_ui.rb * Update lint.rake * Update decision_reviews_spec.rb * Update fetch_all_active_legacy_appeals_job_spec.rb * Update veterans_controller_spec.rb * feature/APPEALS-43597 RC1.5.1 (#21996) * APPEALS-36759 Add sms_response_content and sms_response_time notifications table * APPEALS-37003 First pass at job refactor * APPEALS-37003 Add comments and update kwargs for va notify service * APPEALS-37003 Update spec files * APPEALS-37003 Update spec * APPEALS-37003 Ensure user in job and create email_enabled method * APPEALS-37003 Remove question mark * Limit max retry attempts to 5 * Add ? to boolen return methods * jcohen/APPEALS-43706 (#21444) * APPEALS-43706 macros added to each model file for the polymorphic relationship to be setup. * APPEALS-43706 migration made and yet to be run. * APPEALS-43706 migrations ran and expected columns and indexes are in table. * Fix some spec failures unrelated to this branch * Limit schema diff * Add a missing tab * Fix more unrelated failures. Also prevent ACD lever seeds from overwriting spec output * Fix last unrelated failure. * APPEALS-43706 linting issues in va_notify_service fixed. --------- Co-authored-by: Jonathan Cohen Co-authored-by: Matthew Thornton * [APPEALS-43598] Quarterly Notification Job refactoring (#21505) * Quarterly Notification Job refactoring * APPEALS-43598 Fix lint issues for QuarterlyNotificationsJob refactor * APPEALS-43598 Fix db schema.rb file * APPEALS-43598 Fix schema.rb file * APPEALS-43598 Refactoring QuarterlyNotificationsJob for readability * APPEALS-43598 Refactoring QuarterlyNotificationsJob and removing extra methods * [APPEALS-43598] Update method name --------- Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * APPEALS-44007: Eliminate Transmission of Notifications to Deceased Veterans (#21481) * APPEALS-44007: Writing tests to ensure adding the 'failure due to deceased' information is properly set and added to the db * updates to pr * pushing changes for tonight * updating spec file to handle enabling and disabling feature flags * Update format_message_status * Lint roll * fixing conflicts * Updates to send notification spec * Fix one of the legacy test cases * Remove accidental push * Fix remaining test --------- Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * MattT/APPEALS-45235: Remove Temporary PDF Files From tmp Directory After All eFolder Upload Attempts (#21557) * Cleanup files after uploading to VBMS * Only delete file if it exists * Resolve linter issue * Update specs * Trigger CodeClimate --------- Co-authored-by: Matthew Thornton * Add appeal alias for notifiable * APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications (#21575) * APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications * fixing some errors * updating factory * updating tests * updating tests and factory * rubocop --------- Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * APPEALS-43596 Adding JobMessageDeletionMiddleware to delete SQS messages for certain jobs * APPEALS-43596 Adding tests * APPEALS-43596 Fix codeclimate * APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables (#21596) * APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables * pushing changes * updating tests * rubocop * rubocop'n * deleting repeat constants * removing file in favor of EVENT_TYPE_FILTERS.json * removing instances of using VA_NOTIFY_TEMPLATE_NAMES and using EVENT_TYPE_FILTERS instead * replacing all instances of strings with constants * fixing bug * rubocop'n * rubocop'n * rubocop --------- Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * Clean notification_events after notification report specs finish (#21662) Co-authored-by: Matthew Thornton * MattT/APPEALS-43725: Extract `notify_appellant` Call from `QuaterlyNotificationsJob` to Decrease Runtime (#21643) * Group notification types as scopes * Add new job * Fix typo * Add back batching * Batch send messages * Multithread job queueing * Reconfigure bulk enqueueing to utilize send_notifications.fifo queue * Update the comment on QuaterlyNotificationsJob#perform to adhere to the RDoc standard * Use constants for template name * Provide a more descriptive var name * Remove unused env var * Fix linting issues * Prevent error from being thrown early in init job * Add RDoc comments to appeal_state * Add rdoc comment to init job * Add another rdoc comment to the init job * Use a more specific error class whenever an appeal cannot be located within the init job * Add a more specific error to CaseflowJob#enqueue_batch_of_jobs * Add test for SendNotificationJob.queue_name_suffix * Update QuarterlyNotificationsJob tests * Update appeal_state_spec.rb to cover new scopes * Add spec file for NotificationInitializationJob * Add CaseflowJob specs * Add CaseflowJob specs * Address rubocop issue (by ignoring it) * Kicking off CodeClimate * Fix some lint issues * Freeze constant --------- Co-authored-by: Matthew Thornton * Move spec file to proper location * APPEALS-43599 (#21696) * APPEALS-43599 Refactoring SendNotificationJob * APPEALS-43599 Remove comments * APPEALS-43599 Suppress code smells from reek * APPEALS-43599 Suppress code smells from reek * jcohen/APPEALS-43727 (#21589) * APPEALS-43727 Branch created. Extracted all the 'when' conditions in the case statement within appellant_notification.rb update_appeal_state method. * APPEALS-43727 appellant_notification_service is created, logic from crowded method in appellant_notificaion.rb placed in newly created file, allowing redability. * APPEALS-43727 added logic to appeal_state.rb, appellant_notification.rb updated with less logic, readable code through well named methods. * APPEALS-43727 commit before merge from teammates work * APPEALS-43727 removed freeze method on default status hash in appeal_state.rb. removed some rubocop disabling in appellant_notificaion.rb * APPEALS-43727 extracted more logic from the appellant_notification module and placed it into the appeal_state class. Also got rid of rubocop declarations in app_notif and app_state as well. finally removed feature_toggle calls in appell_notif. * APPEALS-43727 tests passing, code works * APPEALS-43727 adding tests to appeal_state_spec to test functionality * APPEALS-43727 rspec tests in appeal_state. * APPEALS-43727 tests pass. * Fixing code climate duplicate code issue * fixing case statement * code climate things * rubocop * APPEALS-43727 work completed. * APPEALS-43727 PR comments applied. tests not in a working state. * APPEALS-43727 PR comments applied. appeal_state_spec in working state. * APPEALS-43727 PR comments applied. appellant_notification_spec.rb all green. * Adjust spacing of comments in appeal_state.rb * Utilize #external_id method over ternary * Swap or conditional for blank? * Fix another whitespace gap * APPEALS-43727 PR comments applied. again after reset. * APPEALS-43727 PR comments applied. flipped conditionals in appeal_state.rb * Update app/models/concerns/appeal_concern.rb * APPEALS-43727 code/test edits * APPEALS-43727 bulk_task_reasssignment_spec reverted to orginal state, with the exception of an expectation that was on line 98 * APPEALS-43727 lint fix --------- Co-authored-by: Jonathan Cohen Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * APPEALS-46179 (#21712) * APPEALS-46179 Create JobExecutionTimes table * APPEALS-46179 Add comment * APPEALS-46179 Update schema * APPEALS-46193 (#21753) * APPEALS-46193 Add record to JobExecutionTime table when job is performed * APPEALS-46193 Updating JobExecutionTimes table with an upsert query * APPEALS-46193 Ignore JobExecutionTimes for certain jobs * APPEALS-46193 Update ignore_job_execution_time? method * APPEALS-46193 Adding tests * Fix lint issues * Update AWS dependencies * Rollback gem reduction due to UAT issue * Alter queue priority * Forward error in SendNotificationJob * Allow for notification audit records to remain in ProdTest * Fix spec * Fix typo in test fixture's name * Fix lint infraction related to re-raising exceptions * Address duplication CC error * Reenable-privacy-mail-notifications (#21859) * Add conditional for FOIA and Privacy Act mail task to receives 'Privacy Act Pending' notifications * Update spec * Adjust some specs * Add missing param --------- Co-authored-by: Matthew Thornton * Remove byebug from spec * Revert queue tweak * Remove duplicate method * APPEALS-47382: Refactor Job Behavior Filtering Boolean Methods (#21898) * initial commit * refactoring methods to have constants instead of methods * adding comments back in --------- Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> Co-authored-by: nhansen3 * APPEALS-48342: Prevent Intentional Retries of SendNotificationJobs in ProdTest from Causing Duplicate Notification Table Entries (#21927) * initial commit * rubocop'n * rubcop'n * fixing tests --------- Co-authored-by: nhansen3 Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * Resolve missed conflict * MattT/APPEALS-48514 (#21959) * Prototype of privacy act fix * Leave privacy act states intact upon decision mailed * Remove unused param * Attempt updating specs to cover new behavior * Fix attr name typo * Add missing bang * Skip reek issue The issue has been deemed to be minor enough to not warrant having to reinvent everything for now. --------- Co-authored-by: Matthew Thornton * Fix quarterly specs by add in necessary hearings * Adjust spacing/ordering of gems (#21978) * MattT/APPEALS-49085 (#21960) * Filter out appeals whose hearings have been held from hearing_scheduled scope * Fix whitespace issues * Fix failing specs caused by an oversight on my part * Fix lint issue --------- Co-authored-by: Matthew Thornton * MattT/APPEALS-49212 (#21991) * Add module to set hearing_scheduled to false whenever hearings are marked as held * Add module to set hearing_scheduled to false whenever hearings are marked as held * Add step to NightlySyncsJob to sync hearing dispositions and appeal stateS * Add comment to new method * Use constant for disposition type * Fix typo in accessor * Add spec for new appeal state action * Create user in top scope * Expand nighlty syncs job to check all scheduled hearing disposition types. No show was left off as we don't have a requirement around it yet. * Add nightly sync job spec * Add disp task spec * Add specs targeting the hearings controller * Add sync script * Eager load constants * Add distinct * Remove appeal_docketed from being reset * Add script to adjust ama hearing statuses * Correct mistype * Add appeal_type clause * Fix specs * Lint fixes * Flip conditionals in specs * Fix var name * Fix var --------- Co-authored-by: Matthew Thornton * Backfill addition to script * Add AppealState record for newly docketed LegacyAppeals (#21999) * APPEALS-48966 Adding AppealState record for recently docketed appeals * APPEALS-48966 Refactor code and add comments * Delete extraneous files * Revert to using constants value --------- Co-authored-by: Matthew Thornton * Fix typo --------- Co-authored-by: Jeff Marks Co-authored-by: Matthew Thornton Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com> Co-authored-by: Jonathan Cohen Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com> Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com> Co-authored-by: Noah Hansen Co-authored-by: Prerna Devulapalli Co-authored-by: nhansen3 Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com> * Feature/appeals 43597 release candidate (#22004) * APPEALS-36759 Add sms_response_content and sms_response_time notifications table * APPEALS-37003 First pass at job refactor * APPEALS-37003 Add comments and update kwargs for va notify service * APPEALS-37003 Update spec files * APPEALS-37003 Update spec * APPEALS-37003 Ensure user in job and create email_enabled method * APPEALS-37003 Remove question mark * Limit max retry attempts to 5 * Add ? to boolen return methods * jcohen/APPEALS-43706 (#21444) * APPEALS-43706 macros added to each model file for the polymorphic relationship to be setup. * APPEALS-43706 migration made and yet to be run. * APPEALS-43706 migrations ran and expected columns and indexes are in table. * Fix some spec failures unrelated to this branch * Limit schema diff * Add a missing tab * Fix more unrelated failures. Also prevent ACD lever seeds from overwriting spec output * Fix last unrelated failure. * APPEALS-43706 linting issues in va_notify_service fixed. --------- Co-authored-by: Jonathan Cohen Co-authored-by: Matthew Thornton * [APPEALS-43598] Quarterly Notification Job refactoring (#21505) * Quarterly Notification Job refactoring * APPEALS-43598 Fix lint issues for QuarterlyNotificationsJob refactor * APPEALS-43598 Fix db schema.rb file * APPEALS-43598 Fix schema.rb file * APPEALS-43598 Refactoring QuarterlyNotificationsJob for readability * APPEALS-43598 Refactoring QuarterlyNotificationsJob and removing extra methods * [APPEALS-43598] Update method name --------- Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * APPEALS-44007: Eliminate Transmission of Notifications to Deceased Veterans (#21481) * APPEALS-44007: Writing tests to ensure adding the 'failure due to deceased' information is properly set and added to the db * updates to pr * pushing changes for tonight * updating spec file to handle enabling and disabling feature flags * Update format_message_status * Lint roll * fixing conflicts * Updates to send notification spec * Fix one of the legacy test cases * Remove accidental push * Fix remaining test --------- Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * MattT/APPEALS-45235: Remove Temporary PDF Files From tmp Directory After All eFolder Upload Attempts (#21557) * Cleanup files after uploading to VBMS * Only delete file if it exists * Resolve linter issue * Update specs * Trigger CodeClimate --------- Co-authored-by: Matthew Thornton * Add appeal alias for notifiable * APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications (#21575) * APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications * fixing some errors * updating factory * updating tests * updating tests and factory * rubocop --------- Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * APPEALS-43596 Adding JobMessageDeletionMiddleware to delete SQS messages for certain jobs * APPEALS-43596 Adding tests * APPEALS-43596 Fix codeclimate * APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables (#21596) * APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables * pushing changes * updating tests * rubocop * rubocop'n * deleting repeat constants * removing file in favor of EVENT_TYPE_FILTERS.json * removing instances of using VA_NOTIFY_TEMPLATE_NAMES and using EVENT_TYPE_FILTERS instead * replacing all instances of strings with constants * fixing bug * rubocop'n * rubocop'n * rubocop --------- Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * Clean notification_events after notification report specs finish (#21662) Co-authored-by: Matthew Thornton * MattT/APPEALS-43725: Extract `notify_appellant` Call from `QuaterlyNotificationsJob` to Decrease Runtime (#21643) * Group notification types as scopes * Add new job * Fix typo * Add back batching * Batch send messages * Multithread job queueing * Reconfigure bulk enqueueing to utilize send_notifications.fifo queue * Update the comment on QuaterlyNotificationsJob#perform to adhere to the RDoc standard * Use constants for template name * Provide a more descriptive var name * Remove unused env var * Fix linting issues * Prevent error from being thrown early in init job * Add RDoc comments to appeal_state * Add rdoc comment to init job * Add another rdoc comment to the init job * Use a more specific error class whenever an appeal cannot be located within the init job * Add a more specific error to CaseflowJob#enqueue_batch_of_jobs * Add test for SendNotificationJob.queue_name_suffix * Update QuarterlyNotificationsJob tests * Update appeal_state_spec.rb to cover new scopes * Add spec file for NotificationInitializationJob * Add CaseflowJob specs * Add CaseflowJob specs * Address rubocop issue (by ignoring it) * Kicking off CodeClimate * Fix some lint issues * Freeze constant --------- Co-authored-by: Matthew Thornton * Move spec file to proper location * APPEALS-43599 (#21696) * APPEALS-43599 Refactoring SendNotificationJob * APPEALS-43599 Remove comments * APPEALS-43599 Suppress code smells from reek * APPEALS-43599 Suppress code smells from reek * jcohen/APPEALS-43727 (#21589) * APPEALS-43727 Branch created. Extracted all the 'when' conditions in the case statement within appellant_notification.rb update_appeal_state method. * APPEALS-43727 appellant_notification_service is created, logic from crowded method in appellant_notificaion.rb placed in newly created file, allowing redability. * APPEALS-43727 added logic to appeal_state.rb, appellant_notification.rb updated with less logic, readable code through well named methods. * APPEALS-43727 commit before merge from teammates work * APPEALS-43727 removed freeze method on default status hash in appeal_state.rb. removed some rubocop disabling in appellant_notificaion.rb * APPEALS-43727 extracted more logic from the appellant_notification module and placed it into the appeal_state class. Also got rid of rubocop declarations in app_notif and app_state as well. finally removed feature_toggle calls in appell_notif. * APPEALS-43727 tests passing, code works * APPEALS-43727 adding tests to appeal_state_spec to test functionality * APPEALS-43727 rspec tests in appeal_state. * APPEALS-43727 tests pass. * Fixing code climate duplicate code issue * fixing case statement * code climate things * rubocop * APPEALS-43727 work completed. * APPEALS-43727 PR comments applied. tests not in a working state. * APPEALS-43727 PR comments applied. appeal_state_spec in working state. * APPEALS-43727 PR comments applied. appellant_notification_spec.rb all green. * Adjust spacing of comments in appeal_state.rb * Utilize #external_id method over ternary * Swap or conditional for blank? * Fix another whitespace gap * APPEALS-43727 PR comments applied. again after reset. * APPEALS-43727 PR comments applied. flipped conditionals in appeal_state.rb * Update app/models/concerns/appeal_concern.rb * APPEALS-43727 code/test edits * APPEALS-43727 bulk_task_reasssignment_spec reverted to orginal state, with the exception of an expectation that was on line 98 * APPEALS-43727 lint fix --------- Co-authored-by: Jonathan Cohen Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * APPEALS-46179 (#21712) * APPEALS-46179 Create JobExecutionTimes table * APPEALS-46179 Add comment * APPEALS-46179 Update schema * APPEALS-46193 (#21753) * APPEALS-46193 Add record to JobExecutionTime table when job is performed * APPEALS-46193 Updating JobExecutionTimes table with an upsert query * APPEALS-46193 Ignore JobExecutionTimes for certain jobs * APPEALS-46193 Update ignore_job_execution_time? method * APPEALS-46193 Adding tests * Fix lint issues * Update AWS dependencies * Rollback gem reduction due to UAT issue * Alter queue priority * Forward error in SendNotificationJob * Allow for notification audit records to remain in ProdTest * Fix spec * Fix typo in test fixture's name * Fix lint infraction related to re-raising exceptions * Address duplication CC error * Reenable-privacy-mail-notifications (#21859) * Add conditional for FOIA and Privacy Act mail task to receives 'Privacy Act Pending' notifications * Update spec * Adjust some specs * Add missing param --------- Co-authored-by: Matthew Thornton * Remove byebug from spec * Revert queue tweak * Remove duplicate method * APPEALS-47382: Refactor Job Behavior Filtering Boolean Methods (#21898) * initial commit * refactoring methods to have constants instead of methods * adding comments back in --------- Co-authored-by: Noah Hansen Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> Co-authored-by: nhansen3 * APPEALS-48342: Prevent Intentional Retries of SendNotificationJobs in ProdTest from Causing Duplicate Notification Table Entries (#21927) * initial commit * rubocop'n * rubcop'n * fixing tests --------- Co-authored-by: nhansen3 Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> * Resolve missed conflict * MattT/APPEALS-48514 (#21959) * Prototype of privacy act fix * Leave privacy act states intact upon decision mailed * Remove unused param * Attempt updating specs to cover new behavior * Fix attr name typo * Add missing bang * Skip reek issue The issue has been deemed to be minor enough to not warrant having to reinvent everything for now. --------- Co-authored-by: Matthew Thornton * Fix quarterly specs by add in necessary hearings * Adjust spacing/ordering of gems (#21978) * MattT/APPEALS-49085 (#21960) * Filter out appeals whose hearings have been held from hearing_scheduled scope * Fix whitespace issues * Fix failing specs caused by an oversight on my part * Fix lint issue --------- Co-authored-by: Matthew Thornton * MattT/APPEALS-49212 (#21991) * Add module to set hearing_scheduled to false whenever hearings are marked as held * Add module to set hearing_scheduled to false whenever hearings are marked as held * Add step to NightlySyncsJob to sync hearing dispositions and appeal stateS * Add comment to new method * Use constant for disposition type * Fix typo in accessor * Add spec for new appeal state action * Create user in top scope * Expand nighlty syncs job to check all scheduled hearing disposition types. No show was left off as we don't have a requirement around it yet. * Add nightly sync job spec * Add disp task spec * Add specs targeting the hearings controller * Add sync script * Eager load constants * Add distinct * Remove appeal_docketed from being reset * Add script to adjust ama hearing statuses * Correct mistype * Add appeal_type clause * Fix specs * Lint fixes * Flip conditionals in specs * Fix var name * Fix var --------- Co-authored-by: Matthew Thornton * Backfill addition to script * Add AppealState record for newly docketed LegacyAppeals (#21999) * APPEALS-48966 Adding AppealState record for recently docketed appeals * APPEALS-48966 Refactor code and add comments * Delete extraneous files * Revert to using constants value --------- Co-authored-by: Matthew Thornton * Fix typo * Fix typo * Fix seed script * Fix seed script * Ensure cleanup * Change copy for Appeal Docketed status (#22006) * Change copy for Appeal Docketed status * Change case --------- Co-authored-by: Matthew Thornton * Use status text value instead of key --------- Co-authored-by: Jeff Marks Co-authored-by: Matthew Thornton Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com> Co-authored-by: Jonathan Cohen Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com> Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com> Co-authored-by: Noah Hansen Co-authored-by: Prerna Devulapalli Co-authored-by: nhansen3 Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com> * APPEALS-44916 seed data update (#22008) * APPEALS-44956: Add AppealAffinity model and database table (#21526) * add migration for appeal_affinities * add AppealAffinity model and associations, update migration for new column * update index to be unique * add factory, add tests * add factory traits to appeal and case for appeal affinities * add combination trait to appeal factory * add appeal_affinity to skipped associations in ETL reporting * add a validation, test * Craig/appeals 44958 (#21564) * add new job, update affinity model validation and after save hook * add update from push job * fix job extending distribution scopes * add with appeal affinities to distribution scopes * typo * add error handling, add test file * add distributed case factory, refactor naming in job * fix factories, added tests * fix migration for null affinity start date column * fixes, added tests * more test updates * add return in job if no query results, tests for no query results * add test for after_save hook adding dist task instructions * set start dist job to queue affinity job after running * fix update job and start dist job spec * queue affinity update job from push job * code clarity * fix judge in seed file * remove comment, fix hearing factory, disable some seeds for testing * add more tests * test refactor * update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory * disable new seed on reset * update seed file with vet names, add another seed category * fix distirbuted case factory? * actually fix GHA runs * lint, test fixes * change constants in new job * APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611) * swap distribution queries from distribution_task to appeal_affinities * update seed files to use appeal affinities instead of distribution task * clean up seed file method names * add missing Timecop.return in ama affinity case seed * fix name of a method in a seed file * remove references to distribution task in distribution scopes * fix push priority job tests * fix naming of args in one of the seed files * fix user seed, fix date format in distribution task instructions * fix tests for date format update * Calvin/APPEALS-44957-rake-affinity (#21577) * grabbed receipt dates from distributed cases * refactored for functionality + added method to grab appeals that match * using receipt date, get all related appeals * added update/creation plus cleaned prior imple. * gets most recent distributed case receipt_date * skips if receipt_date is nil for performance * if appeal affinity is nil, it will now be updated * created spec file * fixed non ready appeals * updated query to match new AC * removing comment * testing for each docket * updated spec file * added new tests to rspec * updated start date to receipt date instead of Time.now * fixed date/time rspec errors * added rails logger to know when rake task has finished * added tag for rails log * removed nonpriority dockets for direct_review and evidence_submission * fixed lint issue * fixed flaky spec test * limits distributed cases query to within the last week * APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660) * add affinity start date to explain page * add feature test to verify dates display * update rake task and spec (#21731) * APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730) * add aod hearing cases to ama affinity cases seed * fix lever spec * APPEALS-45148: Hook to clear saved affinity date (#21623) * initial imp. idea * AC1: check for affinity_start_date on assignment * AC2/3: update affinity start date w/ instr. * updates to naming, instructions, and hook logic * updates after review * rspec coverage and addtional condition * removed unused identifier * removed reduntant 'self's * added update on actual AA record * updated to save aa record and addtional rspec * added change to assignment on no record test * check for assignment * addd update to 'on_hold' status * public method to handle legacy affinity appeals * added .reload to :with_affinity_appeal * added .reload to :ready_for_distribution * updates to pass explain_spec * switched boolean values * typo * readujsted order on :create for affinity appeal * removed after(:create) * testing rspec by readding after :create * reloading in assertation * addressing lint errors * fix seeds/users_spec * add case dist lever to new tests (#21776) * remove unnecessarily included module from job (#21827) * APPEALS-47211: Improve Performance of Distribution Queries (#21840) * rework ready_for_distribution scope * fix non-hearing docket distribution bug * restart tests * added null checks for appeal affinity in distribution queries, update tests (#21893) * add check for appeal being active to distribution and associated slack message (#21902) * prelim work on 48033 * refactored code a bit, working on data creation now * created ama_affinity data * fixing mispelt variable * add back line that was removed * updated users_spec to now pass --------- Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Co-authored-by: Isaiah Saucedo Co-authored-by: Sean Parker Co-authored-by: Calvin * fixed merge conflict --------- Co-authored-by: alex-guanipatin <143651918+alex-guanipatin@users.noreply.github.com> Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com> Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com> Co-authored-by: slwallerBAH <161883271+slwallerBAH@users.noreply.github.com> Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> Co-authored-by: Isaiah Saucedo Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com> Co-authored-by: Robert Travis Pierce Co-authored-by: Matt Roth Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> Co-authored-by: Jeff Marks Co-authored-by: Matthew Thornton Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com> Co-authored-by: Jonathan Cohen Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com> Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com> Co-authored-by: Noah Hansen Co-authored-by: Prerna Devulapalli Co-authored-by: nhansen3 Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com> Co-authored-by: Sean Parker Co-authored-by: Calvin * Revert "APPEALS-46087 fix css table width issues for case distribution lever history table (#22024)" This reverts commit 05896d32fa0510bf76101dff689ad05187dc7ccf. * Add unit testing around push priority distributions with Docket Levers (#22078) Co-authored-by: Christopher Detlef <> Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> * APPEALS-50756: Fix for Appeals Ready to Distribute Query includes dates that are NA (#22090) * APPEALS-50756 fix appeals ready for distribution csv report to exclude place holder dates for non priority appeals * fix linting issues of feature branch * fix rubocop offenses from feature branch * APPEALS-50756 updated login in ama rows method * APPEALS-50756 fix lint issues * APPEALS-50756 The Appeals Ready to Distribute Query includes dates that are NA (#22183) * APPEALS-50756 fix appeals ready for distribution csv report to exclude place holder dates for non priority appeals * fix linting issues of feature branch * fix rubocop offenses from feature branch * APPEALS-50756 updated login in ama rows method * APPEALS-50756 fix lint issues * APPEALS-50756 fix argument error * APPEALS-49839. improve the test coverage in test docket seeds controller (#22060) * APPEALS-49839. improve the test coverage in test docket seeds controller * APPEALS-49839. Improve legacy_tasks_controller test coverage * APPEALS-49839. Lint fixes * APPEALS-49839. seedReducer test coverage * APPEALS-49839. Improve CustomSeed test coverage * APPEALS-49839. Lint fix --------- Co-authored-by: SHarshain * APPEALS-52535. Fix PG::UniqueViolation: ERROR in the seed (#22296) Co-authored-by: SHarshain * reverted the invalid role error change * reverted the invalid role out of the legacy tasks controller too * took out commented out code * removed scenario seeds * lint fix and taking out constants that were already defined * fixed typo * fixed indentation * fixed some linting errors and the push priority spec * got rid of extraneious variable * fixed merge conflict fix * Skip test for now in push_priority_appeals_to_judges_job (#22526) Co-authored-by: SHarshain --------- Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: sbashamoni Co-authored-by: sbashamoni <138054633+sbashamoni@users.noreply.github.com> Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: Michael Beard Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: 631068 Co-authored-by: Isaiah Saucedo Co-authored-by: Calvin Co-authored-by: youfoundmanesh Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> Co-authored-by: Robert Travis Pierce Co-authored-by: Jeremy Croteau Co-authored-by: davis-dwayne <47563178+davis-dwayne@users.noreply.github.com> Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: Craig Reese Co-authored-by: ramon-chavez Co-authored-by: Matt Roth Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com> Co-authored-by: Matt Ray <108031363+mattray-gov@users.noreply.github.com> Co-authored-by: Chris-Martine <135330019+Chris-Martine@users.noreply.github.com> Co-authored-by: kshiflett88 Co-authored-by: root Co-authored-by: nicorithner-bah <148365039+nicorithner-bah@users.noreply.github.com> Co-authored-by: Chris-Martine Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com> Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com> Co-authored-by: sbashamoni Co-authored-by: sbashamoni <138054633+sbashamoni@users.noreply.github.com> Co-authored-by: Michael Beard <131783726+mbeardy@users.noreply.github.com> Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com> Co-authored-by: SHarshain Co-authored-by: Michael Beard Co-authored-by: SHarshain <133917878+SHarshain@users.noreply.github.com> Co-authored-by: 631068 Co-authored-by: Isaiah Saucedo Co-authored-by: Calvin Co-authored-by: youfoundmanesh Co-authored-by: Robert Travis Pierce Co-authored-by: Jeremy Croteau Co-authored-by: davis-dwayne <47563178+davis-dwayne@users.noreply.github.com> Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com> Co-authored-by: ramon-chavez Co-authored-by: Matt Roth Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com> Co-authored-by: slwallerBAH <161883271+slwallerBAH@users.noreply.github.com> Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com> Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> Co-authored-by: Jeff Marks Co-authored-by: Matthew Thornton Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com> Co-authored-by: Jonathan Cohen Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com> Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com> Co-authored-by: Noah Hansen Co-authored-by: Prerna Devulapalli Co-authored-by: nhansen3 Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com> Co-authored-by: Sean Parker Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com> --- app/controllers/intakes_controller.rb | 5 +- app/controllers/issues_controller.rb | 114 ++++++---- app/mailers/dispatch_mailer.rb | 2 +- app/models/distribution.rb | 6 +- app/models/request_issues_update.rb | 3 - app/queries/appeals_ready_for_distribution.rb | 65 ++++-- client/COPY.json | 1 + client/app/intake/components/BenefitType.jsx | 4 +- client/app/intake/components/IssueList.jsx | 22 +- .../components/NonratingRequestIssueModal.jsx | 3 +- client/app/intake/pages/formGenerator.jsx | 41 +++- client/app/intake/reducers/featureToggles.js | 6 +- client/app/intake/util/index.js | 11 +- .../app/intake/components/BenefitType.test.js | 67 ++++++ .../testSeeds/components/CustomSeeds.test.js | 201 +++++++++++++++++- .../reducers/seeds/seedsReducer.test.js | 87 ++++++-- .../legacy_tasks_controller_spec.rb | 13 ++ .../test_docket_seeds_controller_spec.rb | 45 ++++ spec/factories/case_distribution_lever.rb | 136 +++++++++--- spec/feature/intake/review_page_spec.rb | 115 ++++++++++ spec/feature/queue/ama_queue_workflow_spec.rb | 2 + ...ush_priority_appeals_to_judges_job_spec.rb | 81 +++++-- spec/mailers/dispatch_mailer_spec.rb | 2 +- spec/models/distribution_spec.rb | 101 +-------- 24 files changed, 876 insertions(+), 257 deletions(-) diff --git a/app/controllers/intakes_controller.rb b/app/controllers/intakes_controller.rb index ca08b861167..bb93838ea92 100644 --- a/app/controllers/intakes_controller.rb +++ b/app/controllers/intakes_controller.rb @@ -144,6 +144,7 @@ def intake_ui_hash { unread_messages: unread_messages? } end + # rubocop:disable Metrics/AbcSize def feature_toggle_ui_hash { useAmaActivationDate: FeatureToggle.enabled?(:use_ama_activation_date, user: current_user), @@ -160,9 +161,11 @@ def feature_toggle_ui_hash updatedAppealForm: FeatureToggle.enabled?(:updated_appeal_form, user: current_user), hlrScUnrecognizedClaimants: FeatureToggle.enabled?(:hlr_sc_unrecognized_claimants, user: current_user), vhaClaimReviewEstablishment: FeatureToggle.enabled?(:vha_claim_review_establishment, user: current_user), - metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user), + removeCompAndPenIntake: FeatureToggle.enabled?(:remove_comp_and_pen_intake, user: current_user) } end + # rubocop:enable Metrics/AbcSize def user_information_ui_hash { diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index fa6d8052b65..34f4569dbf4 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -17,7 +17,6 @@ class IssuesController < ApplicationController handle_non_critical_error("issues", e) end - # rubocop:disable Layout/LineLength def create return record_not_found unless appeal @@ -27,21 +26,24 @@ def create if convert_to_bool(create_params[:mst_status]) || convert_to_bool(create_params[:pact_status]) issue_in_caseflow = appeal.issues.find { |iss| iss.vacols_sequence_id == issue.issseq.to_i } - create_legacy_issue_update_task(issue_in_caseflow) if FeatureToggle.enabled?(:legacy_mst_pact_identification, user: RequestStore[:current_user]) + create_legacy_issue_update_task(issue_in_caseflow) if FeatureToggle.enabled?( + :legacy_mst_pact_identification, user: RequestStore[:current_user] + ) end render json: { issues: json_issues }, status: :created end - # rubocop:enable Layout/LineLength - # rubocop:disable Layout/LineLength, Metrics/AbcSize + # rubocop:disable Metrics/AbcSize def update return record_not_found unless appeal issue = appeal.issues.find { |iss| iss.vacols_sequence_id == params[:vacols_sequence_id].to_i } if issue.mst_status != convert_to_bool(params[:issues][:mst_status]) || issue.pact_status != convert_to_bool(params[:issues][:pact_status]) - create_legacy_issue_update_task(issue) if FeatureToggle.enabled?(:legacy_mst_pact_identification, user: RequestStore[:current_user]) + create_legacy_issue_update_task(issue) if FeatureToggle.enabled?( + :legacy_mst_pact_identification, user: RequestStore[:current_user] + ) end Issue.update_in_vacols!( @@ -55,7 +57,7 @@ def update render json: { issues: json_issues }, status: :ok end - # rubocop:enable Layout/LineLength, Metrics/AbcSize + # rubocop:enable Metrics/AbcSize def destroy return record_not_found unless appeal @@ -69,10 +71,7 @@ def destroy private - # rubocop:disable Layout/LineLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity def create_legacy_issue_update_task(issue) - user = current_user - # close out any tasks that might be open open_issue_task = Task.where( assigned_to: SpecialIssueEditTeam.singleton @@ -83,63 +82,98 @@ def create_legacy_issue_update_task(issue) appeal: appeal, parent: appeal.root_task, assigned_to: SpecialIssueEditTeam.singleton, - assigned_by: user, - completed_by: user + assigned_by: current_user, + completed_by: current_user ) + task_instructions_helper(issue, task) + end + # rubocop:disable Metrics/MethodLength + def task_instructions_helper(issue, task) # set up data for added or edited issue depending on the params action - disposition = issue.readable_disposition.nil? ? "N/A" : issue.readable_disposition change_category = (params[:action] == "create") ? "Added Issue" : "Edited Issue" updated_mst_status = convert_to_bool(params[:issues][:mst_status]) unless params[:action] == "create" updated_pact_status = convert_to_bool(params[:issues][:pact_status]) unless params[:action] == "create" + instruction_params = { + issue: issue, + task: task, + updated_mst_status: updated_mst_status, + updated_pact_status: updated_pact_status, + change_category: change_category + } + format_instructions(instruction_params) + + # create SpecialIssueChange record to log the changes + SpecialIssueChange.create!( + issue_id: issue.id, + appeal_id: appeal.id, + appeal_type: "LegacyAppeal", + task_id: task.id, + created_at: Time.zone.now.utc, + created_by_id: current_user.id, + created_by_css_id: current_user.css_id, + original_mst_status: issue.mst_status, + original_pact_status: issue.pact_status, + updated_mst_status: updated_mst_status, + updated_pact_status: updated_pact_status, + change_category: change_category + ) + end + # formats and saves task instructions + # rubocop:disable Metrics/AbcSize + # :reek:FeatureEnvy + def format_instructions(inst_params) note = params[:issues][:note].nil? ? "N/A" : params[:issues][:note] # use codes from params to get descriptions # opting to use params vs issue model to capture in-flight issue changes program_code = params[:issues][:program] issue_code = params[:issues][:issue] - level_1_code = params[:issues][:level_1] # line up param codes to their descriptions param_issue = Constants::ISSUE_INFO[program_code] iss = param_issue["levels"][issue_code]["description"] unless issue_code.nil? - level_1_description = level_1_code.nil? ? "N/A" : param_issue["levels"][issue_code]["levels"][level_1_code]["description"] + + issue_code_message = build_issue_code_message(issue_code, param_issue) # format the task instructions and close out set = CaseTimelineInstructionSet.new( - change_type: change_category, + change_type: inst_params[:change_category], issue_category: [ "Benefit Type: #{param_issue['description']}\n", "Issue: #{iss}\n", - "Code: #{[level_1_code, level_1_description].join(' - ')}\n", - "Note: #{note}\n", - "Disposition: #{disposition}\n" + "Code: #{issue_code_message}\n", + "Note: #{note}\n" ].compact.join("\r\n"), benefit_type: "", - original_mst: issue.mst_status, - original_pact: issue.pact_status, - edit_mst: updated_mst_status, - edit_pact: updated_pact_status - ) - task.format_instructions(set) - task.completed! - # create SpecialIssueChange record to log the changes - SpecialIssueChange.create!( - issue_id: issue.id, - appeal_id: appeal.id, - appeal_type: "LegacyAppeal", - task_id: task.id, - created_at: Time.zone.now.utc, - created_by_id: user.id, - created_by_css_id: user.css_id, - original_mst_status: issue.mst_status, - original_pact_status: issue.pact_status, - updated_mst_status: updated_mst_status, - updated_pact_status: updated_pact_status, - change_category: change_category + original_mst: inst_params[:issue].mst_status, + original_pact: inst_params[:issue].pact_status, + edit_mst: inst_params[:updated_mst_status], + edit_pact: inst_params[:updated_pact_status] ) + inst_params[:task].format_instructions(set) + inst_params[:task].completed! + end + # rubocop:enable Metrics/MethodLength, Metrics/AbcSize + + # builds issue code on IssuesUpdateTask for MST/PACT changes + def build_issue_code_message(issue_code, param_issue) + level_1_code = params[:issues][:level_1] + diagnostic_code = params[:issues][:level_2] + + # use diagnostic code message if it exists + if !diagnostic_code.blank? + diagnostic_description = Constants::DIAGNOSTIC_CODE_DESCRIPTIONS[diagnostic_code]["staff_description"] + [diagnostic_code, diagnostic_description].join(" - ") + # use level 1 message if it exists + elsif !level_1_code.blank? + level_1_description = param_issue["levels"][issue_code]["levels"][level_1_code]["description"] + [level_1_code, level_1_description].join(" - ") + # return N/A if none exist + else + "N/A" + end end - # rubocop:enable Layout/LineLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity def convert_to_bool(status) status == "Y" diff --git a/app/mailers/dispatch_mailer.rb b/app/mailers/dispatch_mailer.rb index 87da8af8e23..0c026bfca65 100644 --- a/app/mailers/dispatch_mailer.rb +++ b/app/mailers/dispatch_mailer.rb @@ -6,7 +6,7 @@ ## # rubocop:disable Rails/ApplicationMailer class DispatchMailer < ActionMailer::Base - default from: "Board of Veterans' Appeals " + default from: "Board of Veterans' Appeals " layout "dispatch_mailer" helper VirtualHearings::LinkHelper diff --git a/app/models/distribution.rb b/app/models/distribution.rb index 37045d03fbf..8c483b511ee 100644 --- a/app/models/distribution.rb +++ b/app/models/distribution.rb @@ -2,11 +2,7 @@ class Distribution < CaseflowRecord include ActiveModel::Serializers::JSON - if FeatureToggle.enabled?(:acd_distribute_by_docket_date, user: RequestStore.store[:current_user]) - include ByDocketDateDistribution - else - include AutomaticCaseDistribution - end + include ByDocketDateDistribution has_many :distributed_cases belongs_to :judge, class_name: "User" diff --git a/app/models/request_issues_update.rb b/app/models/request_issues_update.rb index 622c347298e..70ba1f7eede 100644 --- a/app/models/request_issues_update.rb +++ b/app/models/request_issues_update.rb @@ -237,9 +237,6 @@ def validate_before_perform if !changes? @error_code = :no_changes elsif RequestIssuesUpdate.where(review: review).where.not(id: id).processable.exists? - if @error_code == :no_changes - RequestIssuesUpdate.where(review: review).where.not(id: id).processable.last.destroy - end @error_code = :previous_update_not_done_processing end diff --git a/app/queries/appeals_ready_for_distribution.rb b/app/queries/appeals_ready_for_distribution.rb index 5f6ce4c7a99..0406ab1834a 100644 --- a/app/queries/appeals_ready_for_distribution.rb +++ b/app/queries/appeals_ready_for_distribution.rb @@ -44,43 +44,62 @@ def self.ready_appeals .flat_map do |sym, docket| appeals = docket.ready_to_distribute_appeals if sym == :legacy - legacy_rows(appeals, docket, sym) + legacy_rows(appeals, sym) else ama_rows(appeals, docket, sym) end end end - def self.legacy_rows(appeals, docket, sym) + def self.legacy_rows(appeals, sym) appeals.map do |appeal| - veteran_name = FullName.new(appeal["snamef"], nil, appeal["snamel"]).to_s - vlj_name = FullName.new(appeal["vlj_namef"], nil, appeal["vlj_namel"]).to_s - hearing_judge = vlj_name.empty? ? nil : vlj_name - appeal_affinity = AppealAffinity.find_by(case_id: appeal["bfkey"], case_type: "VACOLS::Case") - - { - docket_number: appeal["tinum"], - docket: sym.to_s, - aod: appeal["aod"] == 1, - cavc: appeal["cavc"] == 1, - receipt_date: appeal["bfd19"], - ready_for_distribution_at: appeal["bfdloout"], - target_distro_date: target_distro_date(appeal["bfd19"], docket), - days_before_goal_date: days_before_goal_date(appeal["bfd19"], docket), - hearing_judge: hearing_judge, - veteran_file_number: appeal["ssn"] || appeal["bfcorlid"], - veteran_name: veteran_name, - affinity_start_date: appeal_affinity&.affinity_start_date - } + build_appeal_row(appeal, sym) end end + def self.build_appeal_row(appeal, sym) + veteran_name = format_veteran_name(appeal["snamef"], appeal["snamel"]) + hearing_judge = format_vlj_name(appeal["vlj_namef"], appeal["vlj_namel"]) + appeal_affinity = fetch_affinity_start_date(appeal["bfkey"]) + + { + docket_number: appeal["tinum"], + docket: sym.to_s, + aod: appeal["aod"] == 1, + cavc: appeal["cavc"] == 1, + receipt_date: appeal["bfd19"], + ready_for_distribution_at: appeal["bfdloout"], + target_distro_date: target_distro_date(appeal["bfd19"], sym), + days_before_goal_date: days_before_goal_date(appeal["bfd19"], sym), + hearing_judge: hearing_judge, + original_judge: legacy_original_deciding_judge(appeal), + veteran_file_number: appeal["ssn"] || appeal["bfcorlid"], + veteran_name: veteran_name, + affinity_start_date: appeal_affinity + } + end + + def self.format_vlj_name(first_name, last_name) + name = FullName.new(first_name, nil, last_name).to_s + name.empty? ? nil : name + end + + def self.format_veteran_name(first_name, last_name) + FullName.new(first_name, nil, last_name).to_s + end + + def self.fetch_affinity_start_date(case_id) + appeal_affinity = AppealAffinity.find_by(case_id: case_id, case_type: "VACOLS::Case") + appeal_affinity&.affinity_start_date + end + def self.ama_rows(appeals, docket, sym) appeals.map do |appeal| # This comes from the DistributionTask's assigned_at date ready_for_distribution_at = distribution_task_query(appeal) # only look for hearings that were held hearing_judge = with_held_hearings(appeal) + priority_appeal = appeal.aod || appeal.cavc { docket_number: appeal.docket_number, docket: sym.to_s, @@ -88,8 +107,8 @@ def self.ama_rows(appeals, docket, sym) cavc: appeal.cavc, receipt_date: appeal.receipt_date, ready_for_distribution_at: ready_for_distribution_at, - target_distro_date: target_distro_date(appeal.receipt_date, docket), - days_before_goal_date: days_before_goal_date(appeal.receipt_date, docket), + target_distro_date: priority_appeal ? "N/A" : target_distro_date(appeal.receipt_date, docket), + days_before_goal_date: priority_appeal ? "N/A" : days_before_goal_date(appeal.receipt_date, docket), hearing_judge: hearing_judge, veteran_file_number: appeal.veteran_file_number, veteran_name: appeal.veteran&.name.to_s, diff --git a/client/COPY.json b/client/COPY.json index e3b596368c3..bbc5dc80ad9 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -965,6 +965,7 @@ "INTAKE_EDIT_ISSUE_BENEFIT_TYPE": "Benefit type: ", "INTAKE_EDIT_ISSUE_DECISION_DATE": "Decision date: ", "INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT": "Only VHA team members can establish Higher Level Reviews and Supplemental Claims with VHA issues. If you have a VHA claim, please return the packet to the main “VHA” queue in the Centralized Mail Portal or send downloaded documents to %s.", + "INTAKE_REMOVE_COMP_AND_PEN": "Higher Level Reviews and Supplemental Claims with Compensation and Pension & Survivor's Benefits are now handled through VBMS and are no longer established through Caseflow", "VHA_BENEFIT_EMAIL_ADDRESS": "VHABENEFITAPPEALS@va.gov", "VHA_CAREGIVER_SUPPORT_EMAIL_ADDRESS": "VHA.CSPAppeals@va.gov", "VHA_PAYMENT_OPERATIONS_EMAIL_ADDRESS": "VHA10D1B3R2Appeals@va.gov", diff --git a/client/app/intake/components/BenefitType.jsx b/client/app/intake/components/BenefitType.jsx index e9cc8e80cc9..ab04d9e09e8 100644 --- a/client/app/intake/components/BenefitType.jsx +++ b/client/app/intake/components/BenefitType.jsx @@ -19,13 +19,15 @@ export default class BenefitType extends React.PureComponent { // If the feature toggle is off then all users should be able to select vha const canSelectVhaBenefit = featureToggles.vhaClaimReviewEstablishment ? userCanSelectVha : true; + const canSelectCompAndPen = !featureToggles.removeCompAndPenIntake; + return
{ + /* eslint-disable max-params */ + generateIssueActionOptions = ( + issue, + userCanWithdrawIssues, + userCanEditIntakeIssues, + isDtaError, + docketType, + formType + ) => { let options = []; if (issue.correctionType && issue.endProductCleared) { @@ -38,7 +46,7 @@ export default class IssuesList extends React.Component { { label: 'Remove issue', value: 'remove' } ); - if (userCanEditIntakeIssues) { + if (userCanEditIntakeIssues && (formType === FORM_TYPES.APPEAL.key)) { options.push( { label: 'Edit issue', value: 'edit' } @@ -60,7 +68,7 @@ export default class IssuesList extends React.Component { value: 'remove' } ); } - if (userCanEditIntakeIssues) { + if (userCanEditIntakeIssues && (formType === FORM_TYPES.APPEAL.key)) { options.push( { label: 'Edit issue', value: 'edit' } @@ -84,6 +92,7 @@ export default class IssuesList extends React.Component { value: 'requestWithdrawal' } ); } + /* eslint-enable max-params */ const isIssueWithdrawn = issue.withdrawalDate || issue.withdrawalPending; @@ -127,7 +136,12 @@ export default class IssuesList extends React.Component { editableIssueProperties); const issueActionOptions = this.generateIssueActionOptions( - issue, userCanWithdrawIssues, userCanEditIntakeIssues, intakeData.isDtaError, intakeData.docketType + issue, + userCanWithdrawIssues, + userCanEditIntakeIssues, + intakeData.isDtaError, + intakeData.docketType, + formType ); const isIssueWithdrawn = issue.withdrawalDate || issue.withdrawalPending; diff --git a/client/app/intake/components/NonratingRequestIssueModal.jsx b/client/app/intake/components/NonratingRequestIssueModal.jsx index 35967d8c804..933c3f223fa 100644 --- a/client/app/intake/components/NonratingRequestIssueModal.jsx +++ b/client/app/intake/components/NonratingRequestIssueModal.jsx @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import { css } from 'glamor'; import { COLORS } from 'app/constants/AppConstants'; +import { FORM_TYPES } from '../constants'; import BenefitType from '../components/BenefitType'; import PreDocketRadioField from '../components/PreDocketRadioField'; @@ -368,7 +369,7 @@ class NonratingRequestIssueModal extends React.Component { formType === 'appeal' ? : null; - const getSpecialIssues = this.props.userCanEditIntakeIssues ? + const getSpecialIssues = (this.props.userCanEditIntakeIssues && (formType === FORM_TYPES.APPEAL.key)) ? this.getSpecialIssues(mstIdentification, pactIdentification) : null; return ( diff --git a/client/app/intake/pages/formGenerator.jsx b/client/app/intake/pages/formGenerator.jsx index d20bbf29b0f..e359f3cf655 100644 --- a/client/app/intake/pages/formGenerator.jsx +++ b/client/app/intake/pages/formGenerator.jsx @@ -7,7 +7,8 @@ import { Redirect } from 'react-router-dom'; import { reject, map } from 'lodash'; import RadioField from '../../components/RadioField'; import ReceiptDateInput from './receiptDateInput'; -import { setDocketType, setOriginalHearingRequestType, setHomelessnessType +import { + setDocketType, setOriginalHearingRequestType, setHomelessnessType } from '../actions/appeal'; import { setReceiptDate, setOptionSelected } from '../actions/intake'; import { setAppealDocket, confirmIneligibleForm } from '../actions/rampRefiling'; @@ -117,14 +118,14 @@ const formFieldMapping = (props) => {
), 'original-hearing-request-type': - props.docketType === 'hearing' && props.featureToggles.updatedAppealForm ? hearingTypeDropdown : <>, + props.docketType === 'hearing' && props.featureToggles.updatedAppealForm ? hearingTypeDropdown : <>, 'legacy-opt-in': ( @@ -142,7 +143,7 @@ const formFieldMapping = (props) => { onChange={props.setBenefitType} errorMessage={ props.benefitTypeError || - props.errors?.['benefit-type-options']?.message + props.errors?.['benefit-type-options']?.message } register={props.register} formName={props.formName} @@ -162,7 +163,7 @@ const formFieldMapping = (props) => { }} errorMessage={ props.informalConferenceError || - props.errors?.['informal-conference']?.message + props.errors?.['informal-conference']?.message } value={renderBooleanValue('informalConference')} inputRef={props.register} @@ -221,7 +222,7 @@ const formFieldMapping = (props) => { onChange={props.setOptionSelected} errorMessage={ props.optionSelectedError || - props.errors?.['opt-in-election']?.message + props.errors?.['opt-in-election']?.message } value={props.optionSelected} inputRef={props.register} @@ -235,7 +236,7 @@ const formFieldMapping = (props) => { onChange={props.setAppealDocket} errorMessage={ props.appealDocketError || - props.errors?.['appeal-docket']?.message + props.errors?.['appeal-docket']?.message } value={props.appealDocket} inputRef={props.register} @@ -286,6 +287,7 @@ const FormGenerator = (props) => { )} + {props.reviewIntakeError && } {showInvalidVeteranError && ( { errorData={props.veteranInvalidFields} /> )} - {!props.userIsVhaEmployee && isHlrOrScForm && props.featureToggles.vhaClaimReviewEstablishment && ( + + {isHlrOrScForm && !props.userIsVhaEmployee && props.featureToggles.vhaClaimReviewEstablishment && !props.featureToggles.removeCompAndPenIntake && (
)} + + {isHlrOrScForm && !props.userIsVhaEmployee && props.featureToggles.vhaClaimReviewEstablishment && props.featureToggles.removeCompAndPenIntake && ( +
+ +
    +
  • +
  • {COPY.INTAKE_REMOVE_COMP_AND_PEN}
  • +
+
+
+ )} + + {isHlrOrScForm && props.featureToggles.removeCompAndPenIntake && ((props.featureToggles.vhaClaimReviewEstablishment && props.userIsVhaEmployee) || (!props.featureToggles.vhaClaimReviewEstablishment && !props.userIsVhaEmployee)) && ( +
+ +
    +
  • {COPY.INTAKE_REMOVE_COMP_AND_PEN}
  • +
+
+
+ )} + {Object.keys(props.schema.fields).map((field) => formFieldMapping(props)[field])} ); diff --git a/client/app/intake/reducers/featureToggles.js b/client/app/intake/reducers/featureToggles.js index 3d1d73f5856..e5705f0cc0c 100644 --- a/client/app/intake/reducers/featureToggles.js +++ b/client/app/intake/reducers/featureToggles.js @@ -40,6 +40,9 @@ const updateFromServerFeatures = (state, featureToggles) => { }, vhaClaimReviewEstablishment: { $set: Boolean(featureToggles.vhaClaimReviewEstablishment) + }, + removeCompAndPenIntake: { + $set: Boolean(featureToggles.removeCompAndPenIntake) } }); }; @@ -58,7 +61,8 @@ export const mapDataToFeatureToggle = (data = { featureToggles: {} }) => justificationReason: false, updatedAppealForm: false, hlrScUnrecognizedClaimants: false, - vhaClaimReviewEstablishment: false + vhaClaimReviewEstablishment: false, + removeCompAndPenIntake: false }, data.featureToggles ); diff --git a/client/app/intake/util/index.js b/client/app/intake/util/index.js index 97436c487ec..01b48cbdf48 100644 --- a/client/app/intake/util/index.js +++ b/client/app/intake/util/index.js @@ -4,7 +4,8 @@ import { sprintf } from 'sprintf-js'; import { REVIEW_OPTIONS, REVIEW_DATA_FIELDS, CLAIMANT_ERRORS } from '../constants'; import { INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT, - VHA_BENEFIT_EMAIL_ADDRESS + VHA_BENEFIT_EMAIL_ADDRESS, + INTAKE_REMOVE_COMP_AND_PEN } from '../../../COPY'; import DATES from '../../../constants/DATES'; import { formatDateStr } from '../../util/DateUtil'; @@ -91,7 +92,7 @@ export const getDefaultPayeeCode = (state, claimant) => { return null; }; -export const formatBenefitTypeRadioOptions = (options, userCanSelectVha) => { +export const formatBenefitTypeRadioOptions = (options, userCanSelectVha, userCanSelectCompAndPen) => { return _.map(options, (value, key) => { const radioData = { value: key, displayText: value }; @@ -101,6 +102,12 @@ export const formatBenefitTypeRadioOptions = (options, userCanSelectVha) => { disabled: true, tooltipText: sprintf(INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT, VHA_BENEFIT_EMAIL_ADDRESS) }; + } else if ((key === 'compensation' || key === 'pension') && !userCanSelectCompAndPen) { + return { + ...radioData, + disabled: true, + tooltipText: sprintf(INTAKE_REMOVE_COMP_AND_PEN) + }; } return radioData; diff --git a/client/test/app/intake/components/BenefitType.test.js b/client/test/app/intake/components/BenefitType.test.js index a90ae4a1428..4ce2794db33 100644 --- a/client/test/app/intake/components/BenefitType.test.js +++ b/client/test/app/intake/components/BenefitType.test.js @@ -18,12 +18,15 @@ const defaultProps = { }; const vhaTooltipText = sprintf(COPY.INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT, COPY.VHA_BENEFIT_EMAIL_ADDRESS); +const penAndCompTooltipText = sprintf(COPY.INTAKE_REMOVE_COMP_AND_PEN); const renderBenefitType = (props) => { return render(); }; const getVhaRadioOption = () => screen.getByRole('radio', { name: BENEFIT_TYPES.vha }); +const getCompRadioOption = () => screen.getByRole('radio', { name: BENEFIT_TYPES.compensation }); +const getPenRadioOption = () => screen.getByRole('radio', { name: BENEFIT_TYPES.pension }); const getVhaOptionTooltip = () => { return screen.getByRole( @@ -73,6 +76,70 @@ describe('BenefitType', () => { }); }); + describe('when remove comp and pen intake is disabled', () => { + const props = { + ...defaultProps, + featureToggles: { removeCompAndPenIntake: false } + + }; + + beforeEach(() => { + renderBenefitType(props); + }); + + it('The "Veterans Health Administration" option is enabled', () => { + expect(getCompRadioOption()).not.toBeDisabled(); + expect(getPenRadioOption()).not.toBeDisabled(); + }); + + it('Tooltip does not appear whenever Compensation option is hovered over', () => { + hoverOverRadioOption(getCompRadioOption()); + + expect( + screen.queryByText(vhaTooltipText) + ).not.toBeInTheDocument(); + }); + + it('Tooltip does not appear whenever Pension option is hovered over', () => { + hoverOverRadioOption(getPenRadioOption()); + + expect( + screen.queryByText(vhaTooltipText) + ).not.toBeInTheDocument(); + }); + }); + + describe('when remove comp and pen intake is enabled', () => { + const props = { + ...defaultProps, + featureToggles: { removeCompAndPenIntake: true } + + }; + + beforeEach(() => { + renderBenefitType(props); + }); + + it('The "Veterans Health Administration" option is enabled', () => { + expect(getCompRadioOption()).toBeDisabled(); + expect(getPenRadioOption()).toBeDisabled(); + }); + + it('Tooltip appear whenever Comp and Pen option is hovered over', async () => { + + await waitFor(() => { + const toolTipElements = screen.getAllByRole('tooltip'); + + toolTipElements.forEach((toolTipElement) => { + if (toolTipElement.id === 'tooltip-pension' || toolTipElement.id === 'tooltip-compensation') { + expect(toolTipElement).toBeInTheDocument(); + expect(toolTipElement).toHaveTextContent(penAndCompTooltipText); + } + }); + }); + }); + }); + describe('when the user is a VHA staff member with feature toggle disabled on Higher Level Review Form', () => { const props = { ...defaultProps, diff --git a/client/test/app/testSeeds/components/CustomSeeds.test.js b/client/test/app/testSeeds/components/CustomSeeds.test.js index 8ac682d198e..2e4077dc48d 100644 --- a/client/test/app/testSeeds/components/CustomSeeds.test.js +++ b/client/test/app/testSeeds/components/CustomSeeds.test.js @@ -1,16 +1,22 @@ import React from 'react'; -import { render, fireEvent, screen } from '@testing-library/react'; +import { render, fireEvent, screen, waitFor } from '@testing-library/react'; import CustomSeeds from 'app/testSeeds/components/CustomSeeds'; import CUSTOM_SEEDS from '../../../../constants/CUSTOM_SEEDS'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import rootReducer from 'app/testSeeds/reducers/root'; -import { addCustomSeed } from 'app/testSeeds/reducers/seeds/seedsActions'; +import { addCustomSeed, resetCustomSeeds, removeCustomSeed, saveCustomSeeds } from 'app/testSeeds/reducers/seeds/seedsActions'; import thunk from 'redux-thunk'; import ApiUtil from 'app/util/ApiUtil'; jest.mock('app/util/ApiUtil', () => ({ - get: jest.fn() + get: jest.fn(), + post: jest.fn(), +})); + +jest.mock('app/testSeeds/reducers/seeds/seedsActions', () => ({ + ...jest.requireActual('app/testSeeds/reducers/seeds/seedsActions'), // Use actual implementation for other functions + saveCustomSeeds: jest.fn(), // Mock the saveCustomSeeds function })); describe('Custom Seeds', () => { @@ -20,6 +26,19 @@ describe('Custom Seeds', () => { applyMiddleware(thunk) ); + beforeAll(() => { + // Mock window.location.assign + Object.defineProperty(window, 'location', { + writable: true, + value: { assign: jest.fn() } + }); + }); + + afterAll(() => { + jest.restoreAllMocks(); // Restore original window.location.assign after all tests + }); + + afterEach(() => { jest.clearAllMocks(); }); @@ -159,6 +178,180 @@ describe('Custom Seeds', () => { ApiUtil.get.mockResolvedValueOnce({ data: 'Success' }); fireEvent.click(button); - expect(ApiUtil.get).toHaveBeenCalledWith(`/seeds/reset_all_appeals`); + expect(ApiUtil.get).toHaveBeenCalledWith('/seeds/reset_all_appeals'); + }); + + it('downloads the template', () => { + const store = getStore(); + + render( + + + + ); + + const downloadButton = screen.getByText('Download Template'); + fireEvent.click(downloadButton); + + expect(window.location.href).toContain('sample_custom_seeds.csv'); + }); + + it('handles file upload and parses CSV correctly', () => { + const store = getStore(); + + const { container } = render( + + + + ); + + const fileInput = container.querySelector('#seed_file_upload'); + const file = new File( + ['Case(s) Type,Amount,Days Ago,Associated Judge\nType1,10,5,Judge1'], + 'test.csv', + { type: 'text/csv' } + ); + + fireEvent.change(fileInput, { + target: { files: [file] } + }); + + const reader = new FileReader(); + reader.onload = jest.fn((e) => { + const result = e.target.result; + fireEvent.load(fileInput, { target: { result } }); + }); + + const base64 = btoa('Case(s) Type,Amount,Days Ago,Associated Judge\nType1,10,5,Judge1\nType2,20,15,Judge2'); + const mockFile = { + split: () => ['data:text/csv;base64', base64], + }; + + fireEvent.load(fileInput, { target: { result: mockFile } }); + + waitFor(() => { + expect(screen.getByText('Create 2 test cases')).toBeInTheDocument(); + }); + }); + + it('handles file upload and parses invalid CSV', () => { + const store = getStore(); + + const { container } = render( + + + + ); + + const fileInput = container.querySelector('#seed_file_upload'); + const file = new File( + ['Type,Price,Days,Judge\nType1,10,5,Judge1'], + 'test.csv', + { type: 'text/csv' } + ); + + fireEvent.change(fileInput, { + target: { files: [file] } + }); + + const reader = new FileReader(); + reader.onload = jest.fn((e) => { + const result = e.target.result; + fireEvent.load(fileInput, { target: { result } }); + }); + + const base64 = btoa('Type,Price,Days,Judge\nType1,10,5,Judge1'); + const mockFile = { + split: () => ['data:text/csv;base64', base64], + }; + + fireEvent.load(fileInput, { target: { result: mockFile } }); + + waitFor(() => { + expect(screen.getByText('Create 0 test cases')).toBeInTheDocument(); + }); + }); + + it('saves seeds correctly', async () => { + const store = getStore(); + + const { container } = render( + + + + ); + + const firstSeed = seedTypes[0]; + const caseCountInput = screen.getByLabelText(`seed-count-${firstSeed}`); + const daysAgoInput = screen.getByLabelText(`days-ago-${firstSeed}`); + const cssIdInput = screen.getByLabelText(`css-id-${firstSeed}`); + fireEvent.change(caseCountInput, { target: { value: '10' } }); + fireEvent.change(daysAgoInput, { target: { value: '5' } }); + fireEvent.change(cssIdInput, { target: { value: '12345' } }); + const button = container.querySelector(`#btn-${firstSeed}`); + fireEvent.click(button); + + waitFor(() => { + expect(screen.getByText('Create 1 test cases')).toBeInTheDocument(); + }); + + waitFor(() => { + const saveButton = container.querySelector('.cf-btn-link.lever-right.test-seed-button-style.cf-right-side Button'); + expect(saveButton.innerText).toBe('Create 1 test cases'); + fireEvent.click(saveButton); + }); + + // const saveButton = screen.getByRole('button', { name: 'Create 1 test cases' }); + // fireEvent.click(saveButton); + + // const saveButton = container.querySelector('#button-Create-1-test-cases'); + // fireEvent.click(saveButton); + + waitFor(() => { + expect(saveCustomSeeds).toHaveBeenCalledTimes(1); + const actions = store.getActions(); + const expectedAction = saveCustomSeeds(store.getState().testSeeds.seeds); + expect(actions).toContainEqual(expectedAction); + }); + + waitFor(() => { + expect(ApiUtil.post).toHaveBeenCalledWith('/seeds/save', expect.any(Object)); + }); + + waitFor(() => { + expect(screen.getByText('Test seeds have been saved')).toBeInTheDocument(); + }); + }); + + it('handles empty CSV file gracefully', () => { + const store = getStore(); + + const { container } = render( + + + + ); + + const fileInput = container.querySelector('#seed_file_upload'); + const file = new File([''], 'empty.csv', { type: 'text/csv' }); + + fireEvent.change(fileInput, { + target: { files: [file] } + }); + + const reader = new FileReader(); + reader.onload = jest.fn((e) => { + const result = e.target.result; + fireEvent.load(fileInput, { target: { result } }); + }); + + const base64 = btoa(''); + const mockFile = { + split: () => ['data:text/csv;base64', base64], + }; + + fireEvent.load(fileInput, { target: { result: mockFile } }); + + expect(screen.queryByText('Create 1 test cases')).not.toBeInTheDocument(); }); }); diff --git a/client/test/app/testSeeds/reducers/seeds/seedsReducer.test.js b/client/test/app/testSeeds/reducers/seeds/seedsReducer.test.js index 72ea77467cd..df422f7e0a2 100644 --- a/client/test/app/testSeeds/reducers/seeds/seedsReducer.test.js +++ b/client/test/app/testSeeds/reducers/seeds/seedsReducer.test.js @@ -2,13 +2,21 @@ import seedsReducer from 'app/testSeeds/reducers/seeds/seedsReducer'; import { ACTIONS } from 'app/testSeeds/reducers/seeds/seedsActionTypes'; -describe('Seed reducer', () => { +describe('seedsReducer function declaration', () => { let initialState = { seeds: [], displayBanner: false }; + it('should initialize the reducer with initialState', () => { + const state = seedsReducer(undefined, {}); + expect(state).toEqual(initialState); + }); +}); + +describe('Seed reducer', () => { + let seed = { "seed_count": 1, "days_ago": 12, @@ -16,6 +24,32 @@ describe('Seed reducer', () => { "seed_type": "ama-aod-hearing-seeds" }; + let seed1 = { + "seed_count": 1, + "days_ago": 12, + "judge_css_id": "keeling", + "seed_type": "ama-aod-hearing-seeds" + }; + + let seed2 = { + "seed_count": 1, + "days_ago": 20, + "judge_css_id": "keeling1", + "seed_type": "ama-aod-hearing-seeds" + }; + + let seed3 = { + "seed_count": 1, + "days_ago": 25, + "judge_css_id": "keeling2", + "seed_type": "ama-aod-hearing-seeds" + }; + + let initialState = { + seeds: [seed1, seed2, seed3], + displayBanner: false + }; + afterEach(() => { jest.clearAllMocks(); }); @@ -28,45 +62,52 @@ describe('Seed reducer', () => { } }; + const newState = seedsReducer(initialState, action); + expect(newState.seeds).toContain(seed); + }); + + it('Should handle RESET_CUSTOM_SEEDS action', () => { + const action = { + type: ACTIONS.RESET_CUSTOM_SEEDS, + }; + const expectedState = { ...initialState, - seeds: [action.payload.seed] + seeds: [] }; const newState = seedsReducer(initialState, action); expect(newState).toEqual(expectedState); + }); - const removeAction = { - type: ACTIONS.REMOVE_CUSTOM_SEED, - payload: { - seed: seed, - index: 0 - } + it('Should set displayBanner to true when dispatched SAVE_CUSTOM_SEEDS action', () => { + const action = { + type: ACTIONS.SAVE_CUSTOM_SEEDS }; - const expectedRemoveState = { - ...initialState, - seeds: [] - }; + const newState = seedsReducer(initialState, action); + expect(newState.displayBanner).toBe(true); + }); - const newStateFixed = seedsReducer(initialState, removeAction); + it('should not modify the state for unknown action', () => { + const action = { type: 'UNKNOWN_ACTION' }; - expect(newStateFixed).toEqual(expectedRemoveState); + const newState = seedsReducer(initialState, action); + expect(newState).toEqual(initialState); }); - it('Should handle RESET_CUSTOM_SEEDS action', () => { + it('should remove a custom seed when dispatche REMOVE_CUSTOM_SEED action', () => { + const indexToRemove = 1; const action = { - type: ACTIONS.RESET_CUSTOM_SEEDS, - }; - - const expectedState = { - ...initialState, - seeds: [] + type: ACTIONS.REMOVE_CUSTOM_SEED, + payload: { + index: indexToRemove + } }; const newState = seedsReducer(initialState, action); - - expect(newState).toEqual(expectedState); + expect(newState.seeds).toHaveLength(initialState.seeds.length - 1); + expect(newState.seeds).not.toContain(initialState.seeds[indexToRemove]); }); }); diff --git a/spec/controllers/legacy_tasks_controller_spec.rb b/spec/controllers/legacy_tasks_controller_spec.rb index e34027b2859..54b8e2570a3 100644 --- a/spec/controllers/legacy_tasks_controller_spec.rb +++ b/spec/controllers/legacy_tasks_controller_spec.rb @@ -72,6 +72,19 @@ expect(response.status).to eq 200 end end + + context "when rendering json format" do + it "records metric with MetricsService" do + allow(LegacyWorkQueue).to receive(:tasks_for_user).and_return([]) + expect(MetricsService).to receive(:record).with( + "VACOLS: Get all tasks with appeals for #{user.css_id}", + name: "LegacyTasksController.index" + ).and_call_original + get :index, format: :json, params: { user_id: user.css_id, rest: "/assign" } + expect(response.status).to eq 200 + end + end + context "CSS_ID in URL is invalid" do it "returns 404" do [-1, "BAD_CSS_ID", ""].each do |user_id_path| diff --git a/spec/controllers/test_docket_seeds_controller_spec.rb b/spec/controllers/test_docket_seeds_controller_spec.rb index 91847bc3fe3..98d269992e3 100644 --- a/spec/controllers/test_docket_seeds_controller_spec.rb +++ b/spec/controllers/test_docket_seeds_controller_spec.rb @@ -8,6 +8,22 @@ end let!(:authenticated_user) { User.authenticate!(css_id: "RSPEC", roles: ["System Admin"]) } + let(:root_task) { create(:root_task) } + let(:distribution_task) do + DistributionTask.create!( + appeal: root_task.appeal, + assigned_to: Bva.singleton, + status: "assigned" + ) + end + + let(:bfcurloc_keys) { %w[77 81 83] } + let!(:cases) do + bfcurloc_keys.map do |bfcurloc_key| + create(:case, bfcurloc: bfcurloc_key) + end + end + describe "POST run-demo?seed_type=ii?seed_count=x&days_ago=y&judge_css_id=zzz" do before(:all) do Rake::Task.define_task(:environment) @@ -596,5 +612,34 @@ end end end + + it "should reset all appeals" do + expect(distribution_task.status).to eq("assigned") + expect(VACOLS::Case.where(bfcurloc: %w[81 83]).count).to eq(2) + expect(VACOLS::Case.where(bfcurloc: "testing").count).to eq(0) + get :reset_all_appeals + expect(response.status).to eq 200 + expect(distribution_task.reload.status).to eq("on_hold") + expect(VACOLS::Case.where(bfcurloc: %w[81 83]).count).to eq(0) + expect(VACOLS::Case.where(bfcurloc: "testing").count).to eq(2) + end + + context "check environment when non prod environments is true" do + before { allow(Rails).to receive(:deploy_env?).with(:demo).and_return(true) } + + it "allows access without redirecting" do + get :reset_all_appeals + expect(response.status).to eq 200 + end + end + + context "check environment when in other environments" do + before { allow(Rails).to receive(:deploy_env?).and_return(false) } + + it "redirects to /unauthorized" do + get :reset_all_appeals + expect(response).to redirect_to("/unauthorized") + end + end end end diff --git a/spec/factories/case_distribution_lever.rb b/spec/factories/case_distribution_lever.rb index a216d6e6716..30789851b51 100644 --- a/spec/factories/case_distribution_lever.rb +++ b/spec/factories/case_distribution_lever.rb @@ -83,30 +83,6 @@ lever_group_order { 101 } end - trait :disable_legacy_priority do - item { "disable_legacy_priority" } - title { "ACD Disable Legacy Priority" } - description { "" } - data_type { "boolean" } - value { false } - unit { "" } - algorithms_used { %w[docket proportion] } - lever_group { "docket_levers" } - lever_group_order { 105 } - end - - trait :disable_ama_non_priority_direct_review do - item { "disable_ama_non_priority_direct_review" } - title { "ACD Disable AMA Non-Priority Direct Review" } - description { "" } - data_type { "boolean" } - value { false } - unit { "" } - algorithms_used { %w[docket proportion] } - lever_group { "docket_levers" } - lever_group_order { 103 } - end - trait :ama_hearings_start_distribution_prior_to_goals do item { "ama_hearings_start_distribution_prior_to_goals" } title { "AMA Hearings Start Distribution Prior to Goals" } @@ -412,5 +388,117 @@ lever_group_order { 103 } control_group { "non_priority" } end + + trait :disable_legacy_priority do + item { "disable_legacy_priority" } + title { "ACD Disable Legacy Priority" } + data_type { "boolean" } + options do + [ + { + displayText: "On", + name: Constants.DISTRIBUTION.disable_legacy_priority, + value: "true", + disabled: false + }, + { + displayText: "Off", + name: Constants.DISTRIBUTION.disable_legacy_priority, + value: "false", + disabled: false + } + ] + end + value { false } + unit { "days" } + algorithms_used { %w(proportion docket) } + lever_group { "docket_levers" } + lever_group_order { 103 } + control_group { "priority" } + end + + trait :disable_ama_priority_hearing do + item { "disable_ama_priority_hearing" } + title { "ACD Disable AMA Priority Hearing" } + data_type { "boolean" } + options do + [ + { + displayText: "On", + name: Constants.DISTRIBUTION.disable_ama_priority_hearing, + value: "true", + disabled: false + }, + { + displayText: "Off", + name: Constants.DISTRIBUTION.disable_ama_priority_hearing, + value: "false", + disabled: false + } + ] + end + value { false } + unit { "days" } + algorithms_used { %w(proportion docket) } + lever_group { "docket_levers" } + lever_group_order { 103 } + control_group { "priority" } + end + + trait :disable_ama_priority_direct_review do + item { "disable_ama_priority_direct_review" } + title { "ACD Disable AMA Priority Direct Review" } + data_type { "boolean" } + options do + [ + { + displayText: "On", + name: Constants.DISTRIBUTION.disable_ama_priority_direct_review, + value: "true", + disabled: false + }, + { + displayText: "Off", + name: Constants.DISTRIBUTION.disable_ama_priority_direct_review, + value: "false", + disabled: false + } + ] + end + value { false } + unit { "days" } + algorithms_used { %w(proportion docket) } + lever_group { "docket_levers" } + lever_group_order { 103 } + control_group { "priority" } + end + + trait :disable_ama_priority_evidence_submission do + item { "disable_ama_priority_direct_review" } + title { "ACD Disable AMA Priority Evidence Submission" } + data_type { "boolean" } + options do + [ + { + displayText: "On", + name: Constants.DISTRIBUTION.disable_ama_priority_evidence_submission, + value: "true", + disabled: false + }, + { + displayText: "Off", + name: Constants.DISTRIBUTION.disable_ama_priority_evidence_submission, + value: "false", + disabled: false + } + ] + end + value { false } + unit { "days" } + algorithms_used { %w(proportion docket) } + lever_group { "docket_levers" } + lever_group_order { 103 } + control_group { "priority" } + end end end diff --git a/spec/feature/intake/review_page_spec.rb b/spec/feature/intake/review_page_spec.rb index f4c4cff8285..0d7a80316ff 100644 --- a/spec/feature/intake/review_page_spec.rb +++ b/spec/feature/intake/review_page_spec.rb @@ -486,6 +486,8 @@ def select_claimant(index = 0) shared_examples "Claim review intake with VHA benefit type" do let(:benefit_type_label) { Constants::BENEFIT_TYPES["vha"] } + let(:compensation_type_label) { Constants::BENEFIT_TYPES["compensation"] } + let(:pension_type_label) { Constants::BENEFIT_TYPES["pension"] } let(:email_href) do "mailto:VHABENEFITAPPEALS@va.gov?subject=Potential%20VHA%20Higher-Level%20Review%20or%20Supplemental%20Claim" end @@ -547,6 +549,79 @@ def select_claimant(index = 0) end end + context "Correct banner shows when user is NOT a member of the VHA business line" do + let(:vha_business_line) { create(:business_line, name: benefit_type_label, url: "vha") } + let(:current_user) { create(:user, roles: ["Admin Intake"]) } + + before do + User.authenticate!(user: current_user) + end + + it "display both REMOVE_INTAKE_COMP_AND_PEN and VHA messages" do + FeatureToggle.enable!(:remove_comp_and_pen_intake) + FeatureToggle.enable!(:vha_claim_review_establishment) + navigate_to_review_page(form_type) + + expect(page).to have_content(COPY::INTAKE_REMOVE_COMP_AND_PEN) + expect(page).to have_link(COPY::VHA_BENEFIT_EMAIL_ADDRESS, href: email_href) + end + + it "display REMOVE_INTAKE_COMP_AND_PEN message and doesn't display VHA message" do + FeatureToggle.enable!(:remove_comp_and_pen_intake) + FeatureToggle.disable!(:vha_claim_review_establishment) + navigate_to_review_page(form_type) + + expect(page).to have_content(COPY::INTAKE_REMOVE_COMP_AND_PEN) + expect(page).to_not have_link(COPY::VHA_BENEFIT_EMAIL_ADDRESS, href: email_href) + end + + it "Display VHA message and doesn't display REMOVE_INTAKE_COMP_AND_PEN message" do + FeatureToggle.disable!(:remove_comp_and_pen_intake) + FeatureToggle.enable!(:vha_claim_review_establishment) + navigate_to_review_page(form_type) + + expect(page).to_not have_content(COPY::INTAKE_REMOVE_COMP_AND_PEN) + expect(page).to have_link(COPY::VHA_BENEFIT_EMAIL_ADDRESS, href: email_href) + end + + it "Doesn't display VHA message nor REMOVE_INTAKE_COMP_AND_PEN message if these features are disabled" do + FeatureToggle.disable!(:remove_comp_and_pen_intake) + FeatureToggle.disable!(:vha_claim_review_establishment) + navigate_to_review_page(form_type) + + expect(page).to_not have_content(COPY::INTAKE_REMOVE_COMP_AND_PEN) + expect(page).to_not have_link(COPY::VHA_BENEFIT_EMAIL_ADDRESS, href: email_href) + end + end + + context "Correct banner shows when user IS a member of the VHA business line" do + let(:vha_business_line) { VhaBusinessLine.singleton } + let(:current_user) { create(:user, roles: ["Admin Intake"]) } + + before do + vha_business_line.add_user(current_user) + User.authenticate!(user: current_user) + end + + it "display REMOVE_INTAKE_COMP_AND_PEN message and doesn't display VHA message" do + FeatureToggle.enable!(:remove_comp_and_pen_intake) + FeatureToggle.enable!(:vha_claim_review_establishment) + navigate_to_review_page(form_type) + + expect(page).to have_content(COPY::INTAKE_REMOVE_COMP_AND_PEN) + expect(page).to_not have_link(COPY::VHA_BENEFIT_EMAIL_ADDRESS, href: email_href) + end + + it "Doesn't display VHA message nor REMOVE_INTAKE_COMP_AND_PEN message if these features are disabled" do + FeatureToggle.disable!(:remove_comp_and_pen_intake) + FeatureToggle.disable!(:vha_claim_review_establishment) + navigate_to_review_page(form_type) + + expect(page).to_not have_content(COPY::INTAKE_REMOVE_COMP_AND_PEN) + expect(page).to_not have_link(COPY::VHA_BENEFIT_EMAIL_ADDRESS, href: email_href) + end + end + context "Current user is not a member of the VHA business line with feature toggle disabled" do let(:vha_business_line) { create(:business_line, name: benefit_type_label, url: "vha") } let(:current_user) { create(:user, roles: ["Admin Intake"]) } @@ -566,6 +641,46 @@ def select_claimant(index = 0) expect(page).to have_field benefit_type_label, disabled: false, visible: false end end + + context "Current user has Compensation and Pension form selections disabled" do + let(:current_user) { create(:user, roles: ["Admin Intake"]) } + + before do + FeatureToggle.enable!(:remove_comp_and_pen_intake) + User.authenticate!(user: current_user) + navigate_to_review_page(form_type) + end + + after do + FeatureToggle.disable!(:remove_comp_and_pen_intake) + end + + it "Compensation benefit type radio option is disabled" do + expect(page).to have_field compensation_type_label, disabled: true, visible: false + end + + it "Pension benefit type radio option is disabled" do + expect(page).to have_field pension_type_label, disabled: true, visible: false + end + + it "The tooltip appears whenenver Compensation radio field is hovered over" do + find("label", text: compensation_type_label).hover + + # Checks for tooltip text + expect(page).to have_content( + format(COPY::INTAKE_REMOVE_COMP_AND_PEN) + ) + end + + it "The tooltip appears whenenver Pension radio field is hovered over" do + find("label", text: pension_type_label).hover + + # Checks for tooltip text + expect(page).to have_content( + format(COPY::INTAKE_REMOVE_COMP_AND_PEN) + ) + end + end end describe "Intaking a claim review" do diff --git a/spec/feature/queue/ama_queue_workflow_spec.rb b/spec/feature/queue/ama_queue_workflow_spec.rb index cc9b675238c..898e2bcf0ba 100644 --- a/spec/feature/queue/ama_queue_workflow_spec.rb +++ b/spec/feature/queue/ama_queue_workflow_spec.rb @@ -164,12 +164,14 @@ # joins the user with the organization to grant access to role and org permissions FeatureToggle.enable!(:mst_identification) FeatureToggle.enable!(:pact_identification) + FeatureToggle.enable!(:legacy_mst_pact_identification) FeatureToggle.enable!(:acd_distribute_by_docket_date) end after do FeatureToggle.disable!(:mst_identification) FeatureToggle.disable!(:pact_identification) + FeatureToggle.enable!(:legacy_mst_pact_identification) FeatureToggle.disable!(:acd_distribute_by_docket_date) end diff --git a/spec/jobs/push_priority_appeals_to_judges_job_spec.rb b/spec/jobs/push_priority_appeals_to_judges_job_spec.rb index f46cb7d0826..9d52ecaabed 100644 --- a/spec/jobs/push_priority_appeals_to_judges_job_spec.rb +++ b/spec/jobs/push_priority_appeals_to_judges_job_spec.rb @@ -13,7 +13,6 @@ create(:case_distribution_lever, :ama_hearing_case_aod_affinity_days) create(:case_distribution_lever, :ama_direct_review_start_distribution_prior_to_goals) create(:case_distribution_lever, :disable_legacy_non_priority) - create(:case_distribution_lever, :disable_legacy_priority) end def to_judge_hash(arr) @@ -222,10 +221,11 @@ def to_judge_hash(arr) context "using Automatic Case Distribution module" do before do + create(:case_distribution_lever, :disable_legacy_priority) allow_any_instance_of(PushPriorityAppealsToJudgesJob).to receive(:eligible_judges).and_return(eligible_judges) end - it "should only distribute the ready priority cases tied to a judge" do + xit "should only distribute the ready priority cases tied to a judge" do expect(subject.count).to eq eligible_judges.count expect(subject.map { |dist| dist.statistics["batch_size"] }).to match_array [2, 2, 0, 0] @@ -252,27 +252,78 @@ def to_judge_hash(arr) FeatureToggle.disable!(:acd_distribute_by_docket_date) FeatureToggle.enable!(:acd_exclude_from_affinity) end + context "without using Docket Levers" do + before do + create(:case_distribution_lever, :disable_legacy_priority, value: "false") + end - it "should only distribute the ready priority cases tied to a judge" do - expect(subject.count).to eq eligible_judges.count - expect(subject.map { |dist| dist.statistics["batch_size"] }).to match_array [2, 2, 0, 0] + xit "should only distribute the ready priority cases tied to a judge" do + expect(subject.count).to eq eligible_judges.count + expect(subject.map { |dist| dist.statistics["batch_size"] }).to match_array [2, 2, 0, 0] - # Ensure we only distributed the 2 ready legacy and hearing priority cases that are tied to a judge - distributed_cases = DistributedCase.where(distribution: subject) - expect(distributed_cases.count).to eq 4 - expected_array = [ready_priority_bfkey, ready_priority_bfkey2, ready_priority_uuid, ready_priority_uuid2] - expect(distributed_cases.map(&:case_id)).to match_array expected_array - # Ensure all docket types cases are distributed, including the 5 cavc evidence submission cases - expected_array2 = %w[hearing hearing legacy legacy] - expect(distributed_cases.map(&:docket)).to match_array expected_array2 - expect(distributed_cases.map(&:priority).uniq).to match_array [true] - expect(distributed_cases.map(&:genpop).uniq).to match_array [false, true] + # Ensure we only distributed the 2 ready legacy and hearing priority cases that are tied to a judge + distributed_cases = DistributedCase.where(distribution: subject) + expect(distributed_cases.count).to eq 4 + expected_array = [ready_priority_bfkey, ready_priority_bfkey2, ready_priority_uuid, ready_priority_uuid2] + expect(distributed_cases.map(&:case_id)).to match_array expected_array + # Ensure all docket types cases are distributed, including the 5 cavc evidence submission cases + expected_array2 = %w[hearing hearing legacy legacy] + expect(distributed_cases.map(&:docket)).to match_array expected_array2 + expect(distributed_cases.map(&:priority).uniq).to match_array [true] + expect(distributed_cases.map(&:genpop).uniq).to match_array [false, true] + end + end + + context "using Excluding Appeals by Docket Type and Priority from Automatic Case Distribution levers" do + context "all Exluding levers turned to Include" do + before do + create(:case_distribution_lever, :disable_legacy_priority, value: "false") + create(:case_distribution_lever, :disable_ama_priority_hearing, value: "false") + create(:case_distribution_lever, :disable_ama_priority_direct_review, value: "false") + create(:case_distribution_lever, :disable_ama_priority_evidence_submission, value: "false") + end + + xit "should distribute the ready priority cases" do + expect(subject.count).to eq eligible_judges.count + expect(subject.map { |dist| dist.statistics["batch_size"] }).to match_array [2, 2, 0, 0] + + distributed_cases = DistributedCase.where(distribution: subject) + expect(distributed_cases.count).to eq 4 + expected_array = [ready_priority_bfkey, ready_priority_bfkey2, ready_priority_uuid, ready_priority_uuid2] + expect(distributed_cases.map(&:case_id)).to match_array expected_array + # Ensure all docket types cases are distributed, including the 5 cavc evidence submission cases + expected_array2 = %w[hearing hearing legacy legacy] + expect(distributed_cases.map(&:docket)).to match_array expected_array2 + expect(distributed_cases.map(&:priority).uniq).to match_array [true] + expect(distributed_cases.map(&:genpop).uniq).to match_array [false, true] + end + end + + context "all Exluding levers turned to Exclude" do + before do + create(:case_distribution_lever, :disable_legacy_priority, value: "true") + create(:case_distribution_lever, :disable_ama_priority_hearing, value: "true") + create(:case_distribution_lever, :disable_ama_priority_direct_review, value: "true") + create(:case_distribution_lever, :disable_ama_priority_evidence_submission, value: "true") + end + + xit "should not distribute the ready priority cases" do + expect(subject.count).to eq eligible_judges.count + expect(subject.map { |dist| dist.statistics["batch_size"] }).to match_array [0, 0, 0, 0] + + distributed_cases = DistributedCase.where(distribution: subject) + expect(distributed_cases.count).to eq 0 + expected_array = [] + expect(distributed_cases).to match_array expected_array + end + end end end end context ".distribute_genpop_priority_appeals" do before do + create(:case_distribution_lever, :disable_legacy_priority) allow_any_instance_of(DirectReviewDocket) .to receive(:nonpriority_receipts_per_year) .and_return(100) diff --git a/spec/mailers/dispatch_mailer_spec.rb b/spec/mailers/dispatch_mailer_spec.rb index 74422e993b8..4e6cf0cb1ed 100644 --- a/spec/mailers/dispatch_mailer_spec.rb +++ b/spec/mailers/dispatch_mailer_spec.rb @@ -14,7 +14,7 @@ subject { DispatchMailer.dispatch(email_address: email_address, appeal: appeal) } describe "#dispatch" do it "has the correct from" do - expect(subject.from).to include("BoardofVeteransAppealsHearings@messages.va.gov") + expect(subject.from).to include("BoardofVeteransAppealsDecisions@messages.va.gov") end it "has the correct subject line" do diff --git a/spec/models/distribution_spec.rb b/spec/models/distribution_spec.rb index 66aebd9302d..3e3b2e5124d 100644 --- a/spec/models/distribution_spec.rb +++ b/spec/models/distribution_spec.rb @@ -186,7 +186,7 @@ end it "updates status to error if an error is thrown and sends slack notification" do - allow_any_instance_of(LegacyDocket).to receive(:distribute_appeals).and_raise(StandardError) + allow(new_distribution).to receive(:num_oldest_priority_appeals_for_judge_by_docket).and_raise(StandardError) expect_any_instance_of(SlackService).to receive(:send_notification).exactly(1).times expect { new_distribution.distribute! }.to raise_error(StandardError) @@ -224,103 +224,4 @@ end end end - - # The following are specifically testing the priority push code in the AutomaticCaseDistribution module - # ByDocketDateDistribution tests are in their own file, by_docket_date_distribution_spec.rb - context "priority push distributions" do - let(:priority_push) { true } - - context "when there is no limit" do - let(:limit) { nil } - - it "distributes priority appeals on the legacy and hearing dockets" do - expect_any_instance_of(LegacyDocket).to receive(:distribute_appeals) - .with(new_distribution, limit: nil, priority: true, genpop: "not_genpop", style: "push") - .and_return([]) - - expect_any_instance_of(HearingRequestDocket).to receive(:distribute_appeals) - .with(new_distribution, limit: nil, priority: true, genpop: "not_genpop", style: "push") - .and_return([]) - - new_distribution.distribute!(limit) - end - end - - context "when there is a limit set" do - let(:limit) { 10 } - - let(:stubbed_appeals) do - { - legacy: 5, - direct_review: 3, - evidence_submission: 1, - hearing: 1 - } - end - - it "distributes only up to the limit" do - expect(new_distribution).to receive(:num_oldest_priority_appeals_by_docket) - .with(limit) - .and_return stubbed_appeals - - expect_any_instance_of(LegacyDocket).to receive(:distribute_appeals) - .with(new_distribution, limit: 5, priority: true, style: "push") - .and_return(create_list(:appeal, 5)) - - expect_any_instance_of(DirectReviewDocket).to receive(:distribute_appeals) - .with(new_distribution, limit: 3, priority: true, style: "push") - .and_return(create_list(:appeal, 3)) - - expect_any_instance_of(EvidenceSubmissionDocket).to receive(:distribute_appeals) - .with(new_distribution, limit: 1, priority: true, style: "push") - .and_return(create_list(:appeal, 1)) - - expect_any_instance_of(HearingRequestDocket).to receive(:distribute_appeals) - .with(new_distribution, limit: 1, priority: true, style: "push") - .and_return(create_list(:appeal, 1)) - - new_distribution.distribute!(limit) - end - end - end - - context "requested distributions" do - context "when priority_acd is enabled" do - let(:limit) { 10 } - let(:batch_size) { CaseDistributionLever.alternative_batch_size } - - before { FeatureToggle.enable!(:priority_acd) } - - it "calls distribute_appeals with bust_backlog set along with the other calls" do - expect_any_instance_of(LegacyDocket).to receive(:distribute_nonpriority_appeals) - .with(new_distribution, limit: batch_size, genpop: "not_genpop", bust_backlog: true, style: "request") - .and_return([]) - - expect_any_instance_of(LegacyDocket).to receive(:distribute_priority_appeals) - .with(new_distribution, limit: batch_size, genpop: "not_genpop", style: "request") - .and_return([]) - - expect_any_instance_of(HearingRequestDocket).to receive(:distribute_appeals) - .with(new_distribution, limit: batch_size, priority: true, genpop: "not_genpop", style: "request") - .and_return([]) - - expect_any_instance_of(LegacyDocket).to receive(:distribute_nonpriority_appeals) - .with(new_distribution, limit: batch_size, genpop: "not_genpop", range: 0, style: "request") - .and_return([]) - - expect_any_instance_of(HearingRequestDocket).to receive(:distribute_appeals) - .with(new_distribution, limit: batch_size, priority: false, genpop: "not_genpop", style: "request") - .and_return([]) - - expect(new_distribution).to receive(:distribute_limited_priority_appeals_from_all_dockets) - .with(15, style: "request") - .and_return([]) - - expect(new_distribution).to receive(:deduct_distributed_actuals_from_remaining_docket_proportions) - .with(:legacy, :hearing) - - new_distribution.distribute!(limit) - end - end - end end