Skip to content

Legacy Appeals tied to non SSC AVLJs

Matt Roth edited this page May 15, 2024 · 6 revisions

Description

Triggered at end of Push Priority Job

SQL

Job logic

When the ReturnLegacyAppealsToBoard is triggered the following happens

  1. A database record is created in the returned_appeal_jobs database table
  2. All appeals tied to non-SSC AVLJs are found
  3. If no appeals are found
    1. the record created in Step 1 is updated to have a completed date
    2. a Slack message is sent to the default Slack channels
      1. For local and demo the record created in Step 1 has its stats column updated with the Slack message
    3. EXIT POINT
  4. Appeals should be grouped by non-SSC AVLJ and then sorted in this order
    1. Priority
    2. BFD19
  5. Create an empty array to hold the BRIEFF.BFKEY of appeals to be moved (appeals_to_move)
  6. For each non-SSC AVLJ
    1. Find 2 oldest priority appeals
      1. If found 2
        1. add the 2 BRIEFF.BFKEY values to appeals_to_move
      2. else if found 1
        1. add the BRIEFF.BFKEY value to appeals_to_move
        2. Find the oldest non-priority appeal
        3. add the BRIEFF.BFKEY value to appeals_to_move
      3. else if found 0
        1. Find the 2 oldest non-priority appeal
        2. add the 2 BRIEFF.BFKEY values to appeals_to_move
      4. Go to next non-SSC AVLJ
  7. For all BRIEFF.BFKEY of appeals to be moved (appeals_to_move) move those appeals to location 63
    1. use VACOLS::Case.batch_update_vacols_location('63', appeals_to_move)
  8. After appeals have been moved
    1. the record created in Step 1 is updated to have an end date
    2. all BRIEFF.BFKEY of appeals to be moved (appeals_to_move) are put into the returned_appeals column of the record created in Step 1
    3. stats are recorded for the record created in Step 1
      1. Number of priority appeals returned to the board
      2. Number of non-priority appeals returned to the board
      3. Number of remaining priority appeals tied to non-SSC AVLJs
      4. Number of remaining non-priority appeals to non-SSC AVLJs
      5. List of non-SSC AVLJs that appeals were moved from to location '63'
        1. Keys of the hash the holds "Appeals should be grouped by non-SSC AVLJ"
    4. An informative Slack message is sent to the default Slack channels
      1. For local and demo the record created in Step 1 has its stats column updated with the Slack message as one of the json properties
  9. If an error occurs during the job
    1. the record created in Step 1 is updated to have an errored date
    2. The error is included as a property in the stats column for the record created in Step 1
    3. a Slack message is sent to the default Slack channels
      1. For local and demo the record created in Step 1 has its stats column updated with the Slack message as one of the json properties
    4. Error is logged using CaseflowJob.log_error
    5. EXIT POINT
  10. Ensure that metrics are recorded for the job before it exits using CaseflowJob.metrics_service_report_runtime
Clone this wiki locally