Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVLJs cannot perform attorney rework tasks #14886

Closed
4 tasks
hschallhorn opened this issue Aug 5, 2020 · 1 comment
Closed
4 tasks

AVLJs cannot perform attorney rework tasks #14886

hschallhorn opened this issue Aug 5, 2020 · 1 comment
Labels
Feature: caseflow-decisions Priority: Medium Blocking issue w/workaround, or "second in" priority for new work. Product: caseflow-queue Team: Echo 🐬 Type: Investigation User: AVLJ Acting Veterans Law Judge

Comments

@hschallhorn
Copy link
Contributor

hschallhorn commented Aug 5, 2020

Currently, we determine if a legacy case is "assigned" to someone if the current location of the case is that user, used both when pulling all tasks for a user in queue and all tasks for an appeal in case details. There is no way in vacols to determine if the case is assigned to a judge or an attorney, so we previously assumed based on the users role. With AVLJs however, legacy appeals can be assigned to them as a judge OR as an attorney. To determine if the user should see actions for a judge (ready to be dispatched) or actions for an attorney (decision ready for review), we check to see if a decision document has already been drafted for the case but looking at the document id on the associated DAS record. If there is already a decision drafted, this document id will be non null and we assume this case is with the AVLJ to review (as a judge). If there is no document id, we assume this case is with the AVLJ to draft said document (as an attorney).

# If the user is a judge they are only assigned JudgeLegacyTasks
# If the user is an acting judge, assume any case that already has a decision doc is assigned to them as a judge
if user&.vacols_roles&.first&.downcase == "judge" ||
(user&.acting_judge_in_vacols? && appeal.vacols_case_review.valid_document_id?)
task_class = JudgeLegacyTask
end

This was implemented as a quick fix as the deprecation of DAS would solve this issue. One of the many issues with this is that cases cannot be sent back to AVLJs to be reworked as an attorney. As they have already completed a decision, our current logic assumes the case is with them to review the decision they already wrote. This disallows AVLJs from being able to edit dispositions in caseflow

AC

  • One of
    • Implement a way to be more explicit about the actions an AVLJ should have when they are assigned a legacy case
    • Write a tech spec

Other fun legacy task things

We determine if a task is a judge assign task or a judge decision review task by checking the DAS record's dereceive, used to indicate that the case has be reassigned beck to the judge.

if record.reassigned_to_judge_date.present?
# If task action is 'assign' that means there was no previous task record yet
JudgeLegacyDecisionReviewTask.new(
task.instance_values.merge(
"previous_task" => LegacyTask.new(assigned_at: record.assigned_to_attorney_date.try(:to_date))
)
)
else
JudgeLegacyAssignTask.new(task.instance_values)
end

Open questions

  • Can we work with Jed to add something to VACOLS/DAS so that we can easily determine if the case is assigned as a judge or as an attorney?
@hschallhorn hschallhorn added Type: Investigation Product: caseflow-queue Feature: caseflow-decisions Team: Echo 🐬 Priority: Medium Blocking issue w/workaround, or "second in" priority for new work. User: AVLJ Acting Veterans Law Judge labels Aug 5, 2020
@hschallhorn
Copy link
Contributor Author

Timeboxing to a 5 rather than a 3 to give appropriate time to look into implementations before writing a spec

va-bot pushed a commit that referenced this issue Nov 16, 2020
…ine what actions they see in LegacyTasks (#15591)

Resolves issue is some cases where a legacy appeal is sent back to the decision drafting attorney but they only see judge actions as they are an avlj.

### Description
Another hacky fix in the ever evolving saga of "how the heck do we determine if a legacy case is assigned to an acting judge to write a decision to to sign a decision". Some context is provided in #14886.

Initially, we tried to use the logic that if a decision had already been drafted for an appeal, this appeal is probably assigned to the user to sign the decision as a judge.

To implement this, we initially checked if an attorney case review existed for the case in caseflow. While this was an alright start, sometimes cases are sent from an attorney to a judge outside of caseflow and no attorney case review will exist.

To resolve this, we moved to checking to see if there was a decision document listed on the vacols case assignment. The thought process here is that this will always be populated whether sent to the judge in caseflow or vacols.

The problem with this is outlined in #14886. If the case returns to the acting judge, say for rewriting the decision, our code assumes they are being assigned the case to sign the decision they wrote.

For some of these cases that _were_ worked in caseflow, we can reach a happier middleground. We should check to see if they are the attorney that created the case review. If they are, the task will be an attorney task. It they were the judge on the case review, the task will be a judge task. If neither, we can fall back to old logic of checking to see if there is a decision already written.

While this will not resolve all cases, it will cut down on the number of batteam requests we get about this.

For instance, [this batteam request](https://dsva.slack.com/archives/CHX8FMP28/p1604942204005500) could have been avoided if we had implemented this check.
```ruby
user = User.find_by(css_id: "bvamsopko".upcase)
user.acting_judge_in_vacols?
=> true

appeal = LegacyAppeal.find_by(vacols_id: "3848262")
appeal.vacols_case_review.valid_document_id?
=> true
# based on our current logic, we should show this user judge actions as a decision exists already. SAD

appeal.attorney_case_review.attorney == user
=> true
# !! information in caseflow exists that definitively stipulates this user was the attorney on the case, we should show them attorney actions 
```

### Acceptance Criteria
- [ ] If an acting judge was the drafting attorney on a legacy case in caseflow, they should see attorney actions for the case assigned to them
- [ ] If an acting judge was the reviewing judge on a legacy case in caseflow, they should see judge actions for the case assigned to them
- [ ] If there is no attorney case review or if the user was neither the judge or attorney, fall back to checking if a decision has already been written for the case.

### Testing plan
1. Ensure das deprecation is turned off
```ruby
FeatureToggle.enabled?(:legacy_das_deprication)
=> false
```
2. Log in as bvaaaaaaabshire and go to your assign queue
1. Assign a case to an acting judge
1. If you get a "Case already assigned" error, you may need to fix some vacols data
```ruby
judge = User.find_by(css_id: "BVAAABSHIRE")
judge.vacols_uniq_id
=> "ID6"
# Should be "AABSHIRE"

VACOLS::Staff.where(sdomainid: "BVAAABSHIRE").pluck(:slogid)
=> ["ID6", "ID7", "AABSHIRE"]
VACOLS::Staff.where.not(slogid: "AABSHIRE").where(sdomainid: "BVAAABSHIRE").destroy_all
VACOLS::Staff.where(sdomainid: "BVAAABSHIRE").pluck(:slogid)
=> ["AABSHIRE"]

# Clear our cache and try again 
Rails.cache.delete("#{Rails.env}_staff_record_#{judge.css_id}")
User.find_by(css_id: "BVAAABSHIRE").vacols_uniq_id
=> "AABSHIRE"
```
5. If you get a "Deteam cannot be blank" error
```ruby
acting_judge = User.find_by(css_id: "BVAACTING")
acting_judge.vacols_group_id
=> ""

VACOLS::Staff.find_by(sdomainid: "BVAACTING").update!(stitle: "D#{Random.rand(1..5)}")
Rails.cache.delete("#{Rails.env}_staff_record_#{acting_judge.css_id}")
User.find_by(css_id: "BVAACTING").vacols_group_id
=> "D5"
```
6. Log in as the acting judge and go through checkout to send the case back to the judge
1. Cases are being sent back to these avljs through vacols, so let's do that manually
```ruby
VACOLS::Case.find(3662856).update_vacols_location!(acting_judge.vacols_uniq_id)
```
8. Return to the case and ensure the user has "Decision ready for review" action, not "Ready for dispatch"
1. Checkout master to see what the user used to see

### UI changes

Before (user sees judge actions)|After (user sees attorney actions)
---|---
<img width="728" alt="Screen Shot 2020-11-09 at 5 47 10 PM" src="https://user-images.githubusercontent.com/45575454/98605594-ae147a00-22b3-11eb-9814-e3fe696f630b.png">|<img width="728" alt="Screen Shot 2020-11-09 at 5 46 50 PM" src="https://user-images.githubusercontent.com/45575454/98605596-ae147a00-22b3-11eb-9c9e-446420c745f0.png">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: caseflow-decisions Priority: Medium Blocking issue w/workaround, or "second in" priority for new work. Product: caseflow-queue Team: Echo 🐬 Type: Investigation User: AVLJ Acting Veterans Law Judge
Projects
None yet
Development

No branches or pull requests

2 participants