Skip to content

Case Reset (Undispatch)

zborgesva edited this page Mar 1, 2024 · 11 revisions

Taxonomy: Original Appeal type

steps to undispatch appeal/case reset https://verbose-broccoli-9868be41.pages.github.io/batteam-quickref/dispatch/reopen_completed_dispatch_task.html

sudo su -
source /opt/caseflow-certification/caseflow-certification_env.sh; cd /opt/caseflow-certification/src; bin/rails c

RequestStore[:current_user] = User.system_user
appeal = Appeal.find_by(uuid: "")

type can't be vacate or de novo

appeal.type

check for remanded or granted decision issues

appeal.decision_issues.pluck(:disposition)

If the disposition is not: "remanded", "granted", or "allowed" move to Ready to Start section

if remanded: Grab remanded claims attached to appeal. This assumes there is only one, if there's more than one repeat these steps with each claim

appeal.active_remanded_claims.count
sc = appeal.active_remanded_claims.first

Grab epes attached to Claim This assumes there is only one, if there's more than one repeat these steps with each EPE

sc.end_product_establishments.count
epe = sc.end_product_establishments.first
epe.send(:cancel!)

if granted or allowed: Grab epes attached to appeal

epes = appeal.decision_document.end_product_establishments
epes.count

note: If there is more than one EPE, go through and cancel each one. cancel epe

epe = epes.first
epe.send(:cancel!)

Grab the board grant Effectuation and delete

bges = appeal.decision_document.effectuations
bges.count

If the count is more than one, find the appropriate Effectuation(s) to be deleted

bge = bges[0]
bge.delete

########## Ready to start ############# Clear poa_participant_id on Appeal should return nil

appeal.update(poa_participant_id: nil); appeal.reload.poa_participant_id

Reopen the decided request issues aka clear the closed_at, closed_status fields

ris = appeal.request_issues; ris.pluck(:id, :closed_at, :closed_status )

Only update ones that have the closed_status set to "decided" they're all decided so

appeal.request_issues.each do |issue|; issue.update!(closed_at: nil, closed_status: nil); end
appeal.reload.request_issues.pluck(:id, :closed_at, :closed_status )

Unset caseflow_decision_date on the decision issues check that they all have a decision date

appeal.decision_issues.pluck(:id, :benefit_type, :caseflow_decision_date)

Update decisions

appeal.decision_issues.each do |issue|; issue.update!(caseflow_decision_date: nil); end
appeal.reload.decision_issues.pluck(:id, :benefit_type, :caseflow_decision_date)

Pretty print and copy the output of the decision document to send to Jen and Marie

pp appeal.decision_document

STOP - SEND DECISION DOC IN ENCRIPTED EMAIL TO JENN AND MARIE THROUGH VA EMAIL

Delete and reload decision document. it should return nil

appeal.decision_document.delete
appeal.reload.decision_document

Print out the task tree to copy into a text file

appeal.reload.treee

NOTE: It's easier and reduces user error to copy the task tree into a txt file, set the appropriate variables and then copy and paste the variables Below the tree set the appropriate attributes in the text file user will be user attached to the dispatch_user_task_id

#tree here
root_task_id = ""; dispatch_org_task_id = ""; dispatch_user_task_id = ""

user = User.find_by_css_id("") 

Update tasks

#all of the below in one line
Task.find(root_task_id).update!(status: Constants.TASK_STATUSES.on_hold, closed_at: nil); Task.find(dispatch_org_task_id).update!(status: Constants.TASK_STATUSES.on_hold, closed_at: nil); Task.find(dispatch_user_task_id).update!(status: Constants.TASK_STATUSES.assigned, closed_at: nil, assigned_to: user)

Reload and display appeal task tree The root task and bva org task should be on_hold and the bva user task should be assigned to user

appeal.reload.treee

Taxonomy: Vacate Appeal type

IF you have a Vacate appeal type, the following SOP may be utilized.

Sudo into Caseflow/rails

sudo su -c "source /opt/caseflow-certification/caseflow-certification_env.sh; cd /opt/caseflow-certification/src; bin/rails c"

Set the user

RequestStore[:current_user] = User.system_user

Grab the uuid of your appeal, for the vacate stream specifically if you can. If you are not sure, the following steps within this SOP will ensure that you are on the right appeal stream (Vacate)

appeal = Appeal.find_by(uuid: " ** UUID **")

user we want the User BVADispatchTask assigned to

user_css_id = ""

Instructions to be added to the user bva dispatch task Something along the lines of: "Case returned to Caseflow by request of USER. Please NEXT STEPS.""

instructions = "Case returned to Caseflow by request of ** USER **. Please verify that you are able to correct VBMS and work this case."

Confirm that appeal type is vacate

appeal.type

(IF the previous output is "ORIGINAL" complete the following steps to get to the vacate stream, otherwise, skip ahead to pdm step) Grab all appeal streams

streams=Appeal.where(stream_docket_number: appeal.stream_docket_number)

Check each of the streams on this appeal

streams.map(&:stream_type)

Target specifically the vacate stream (The below query works ONLY if the second stream is the vacate stream, IF NOT, you must edit this query accordingly)

v=streams.second

Check the TYPE of the post decision motion on your vacate appeal, this SOP is for "straight_vacate" ONLY at this time

pp pdm = PostDecisionMotion.where(appeal: appeal)

Pull up the Appeal tree

appeal.reload.treee(:id, :status, :ASGN_BY, :ASGN_TO, :created_at, :closed_at)

Pull the POA on the appeal

appeal.poa_participant_id -> " ** POA ID ** "

(!) Clear the poa_participant_id on the appeal

appeal.update(poa_participant_id: nil)
appeal.reload.poa_participant_id

We now have to reopen the decided request issues aka clear the closed_at, closed_status fields

appeal.request_issues.count
pp appeal.request_issues.pluck(:id, :closed_at, :closed_status)
appeal.request_issues.each do |issue|; issue.update!(closed_at: nil, closed_status: nil); end
appeal.reload.request_issues.pluck(:id, :closed_at, :closed_status )

Print out the number of decision issues

appeal.decision_issues.count

Print the results of these decision issues, they should all have a disposition of "vacated" if ANY decision issues are "remanded" or "granted", there is an issue, and DO NOT use this SOP on your ticket, as it is only for undispatching/case reset for Vacate appeal streams!

pp appeal.decision_issues.pluck(:id, :benefit_type, :caseflow_decision_date, :disposition)

Let's double check to make sure there aren't any new non-vacated decisions

appeal.decision_issues.map(&:disposition).uniq

If there's only "vacated" in your result, we're good to go

Unset caseflow_decision_date on the decision issues

appeal.decision_issues.each do |issue|
  issue.update(caseflow_decision_date: nil)
end;
appeal.reload.decision_issues.pluck(:id, :benefit_type, :caseflow_decision_date)

Pretty print and copy the output of the decision document to send to Jen and Marie

pp appeal.decision_document

STOP - SEND DECISION DOC IN ENCRIPTED EMAIL TO JENN AND MARIE THRO VA EMAIL

(!) Delete the DecisionDocument

appeal.decision_document
appeal.decision_document.delete
appeal.reload.decision_document

Reopen the root, dispatch_org, and dispatch_user (!) this step makes it actively 'workable' again!

Assign the user task to the requested user

user = User.find_by_css_id(user_css_id)

Find the task IDs

appeal.reload.treee(:id, :status, :ASGN_BY, :ASGN_TO, :closed_at)
dispatch_user_task_id = " ** DISPATCH USER TASK ID ** "
dispatch_org_task_id = " ** DISPATCH ORG TASK ID ** "
root_task_id= " ** ROOT TASK ID ** "

Set task statuses accordingly

Task.find(root_task_id).update!(status: Constants.TASK_STATUSES.on_hold, closed_at: nil)
Task.find(dispatch_org_task_id).update!(status: Constants.TASK_STATUSES.on_hold, closed_at: nil)
Task.find(dispatch_user_task_id).update!(status: Constants.TASK_STATUSES.assigned, closed_at: nil, assigned_to: user, instructions: instructions)

Verify tree looks correct

appeal.reload.treee(:id, :status, :ASGN_BY, :ASGN_TO, :closed_at)
Clone this wiki locally