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

Teaches BVA Dispatching Tasks to actually block #15041

Merged

Conversation

lomky
Copy link
Contributor

@lomky lomky commented Aug 21, 2020

Connects #14056

Part 2 of the stack:

Part 1: #15040
Part 2: this PR
Part 3: #15042

Description

When a task is created that blocks_dispatch, we will check whether we need to override
the parent of this task.

  • If the parent task is already a child of the active BVA Dispatch task, don't override
  • If the appeal doesn't have any BVA Dispatch Tasks yet, don't override
  • If the appeal has open BVA Dispatch Task(s), set it to be the parent, preferring open User task then falling back to open Organization Task

Acceptance Criteria

  • Code compiles correctly
  • (Stack 1) Certain tasks will have the ability to block dispatch
  • These task should be created under RootTask* or BvaDispatchTask (Stack 2)
  • (Stack 3) BvaDispatch tasks are not created when tasks that block dispatch are still open (Stack 3)
  • (Stack 3) BvaDispatchTask is created when all tasks that block dispatch are closed (Stack 3)

Testing Plan

Test creating these blocking tasks at various appeal points. You should be able to use the Realistic task tree Appeal Factory to get to JudgeDecisionReview, but beyond that cases will need to be manupulated via UI or manual task creation.

  1. An appeal at Ready for Distribution
    • parent should be the passed in task (root task)
  2. An appeal at Attorney Drafting
    • parent should be the passed in task (root task)
  3. An appeal at BvaDispatch (org & user tasks exist)
    • parent should be the BvaDispatch user task!
  4. An appeal at BvaDispatch (org & user tasks exist, user task cancelled or deleted, org task assigned)
    • parent should be the BvaDispatch org task!
  5. An appeal Returned from BvaDispatch, pass in Root Task
    • parent should be the BvaDispatch user task!
  6. An appeal Returned from BvaDispatch, pass in Judge Decision Review Task
    • parent should be the Judge Decision Review Task
  7. An appeal past BvaDispatch (org & user tasks exist and are completed)
    • parent should be the passed in task (root task)

Copy link
Contributor

@yoomlam yoomlam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some preliminary suggestions and questions.

app/models/task.rb Show resolved Hide resolved
app/models/task.rb Outdated Show resolved Hide resolved
app/models/task.rb Outdated Show resolved Hide resolved
app/models/task.rb Show resolved Hide resolved
Copy link
Contributor

@yoomlam yoomlam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicks for consistency and clarity.

spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@yoomlam yoomlam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions to make the tests easier to understand.

spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
@yoomlam
Copy link
Contributor

yoomlam commented Aug 24, 2020

Testing notes:

FeatureToggle.enable!(:block_at_dispatch) 

# Testing Plan item 1
appeal=FactoryBot.create(:appeal, :ready_for_distribution)
parent_task=FoiaColocatedTask.create!(appeal: appeal, parent: appeal.root_task, assigned_by: User.last, assigned_to: Colocated.singleton)

# Testing Plan item 2
# Logged in as atty CASPER and picked an appeal
appeal=appeal_("f68df7d3-0068-46fe-8d88-cb9158c515d6")
appeal.reload.treee
parent_task=FoiaColocatedTask.create!(appeal: appeal, parent: appeal.root_task, assigned_by: User.last, assigned_to: Colocated.singleton)
appeal.reload.treee

# Testing Plan item 3
# Logged in as Dispatch user BVAGWHITE 
appeal=appeal_("375291f3-6626-4fed-a59e-7bbf2440f707")
appeal.reload.treee
parent_task=FoiaColocatedTask.create!(appeal: appeal, parent: appeal.root_task, assigned_by: User.last, assigned_to: Colocated.singleton)
appeal.reload.treee

# Testing Plan item 4.a
# Logged in as Dispatch user BVAGWHITE 
appeal=appeal_("8786cac4-6cc0-4938-bc20-f3490f0e6f2e")
appeal.reload.treee
Task.find(990).cancelled!
Task.find(989).on_hold!
appeal.reload.treee
parent_task=FoiaColocatedTask.create!(appeal: appeal, parent: appeal.root_task, assigned_by: User.last, assigned_to: Colocated.singleton)
appeal.reload.treee

# Testing Plan item 4.b
# Logged in as Dispatch user BVAGWHITE 
appeal=appeal_("34c455d7-e6bc-455c-8634-61a39f15567f")
appeal.reload.treee
Task.find(979).delete
appeal.reload.treee
parent_task=FoiaColocatedTask.create!(appeal: appeal, parent: appeal.root_task, assigned_by: User.last, assigned_to: Colocated.singleton)
appeal.reload.treee

# Testing Plan item 5
# Logged in as Dispatch user BVAGWHITE 
appeal=appeal_("1beaa592-ec65-4b49-bc9d-ad0c8a4c2149")
# Return to judge
parent_task=FoiaColocatedTask.create!(appeal: appeal, parent: appeal.root_task, assigned_by: User.last, assigned_to: Colocated.singleton)

# Testing Plan item 6
# Logged in as Dispatch user BVAGWHITE 
# Choose an appeal or delete tasks
Task.where(id: [2734,2735,2736,2737,2738]).map(&:delete)
# Return to judge
appeal.reload.treee
jdrt=JudgeDispatchReturnTask.find(2728)
parent_task=FoiaColocatedTask.create!(appeal: appeal, parent: jdrt, assigned_by: User.last, assigned_to: Colocated.singleton)
appeal.reload.treee

# Testing Plan item 7
appeal.reload.treee
# Mark user-assignee DispatchTask complete
Task.find(1001).completed!
parent_task=FoiaColocatedTask.create!(appeal: appeal, parent: appeal.root_task, assigned_by: User.last, assigned_to: Colocated.singleton)
appeal.reload.treee

Copy link
Contributor

@yoomlam yoomlam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 👍

Copy link
Contributor

@hschallhorn hschallhorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 2 issues when testing part 3
#15042 (review)
#15042 (review)

@lomky
Copy link
Contributor Author

lomky commented Aug 26, 2020

Thanks @hschallhorn!

I think I've fixed it:
AMA:

                                                     ┌─────────────────────────────────────────────────────────────────────────────┐
Appeal 32 (direct_review) ────────────────────────── │ ID   │ STATUS   │ ASGN_BY           │ ASGN_TO     │ UPDATED_AT              │
└── RootTask                                         │ 1938 │ on_hold  │                   │ Bva         │ 2020-08-26 14:11:04 UTC │
    ├── JudgeDecisionReviewTask                      │ 1939 │ on_hold  │ CSS_ID585         │ BVAAABSHIRE │ 2020-08-26 14:11:04 UTC │
    │   └── AttorneyTask                             │ 1940 │ on_hold  │ BVAAABSHIRE       │ BVASCASPER1 │ 2020-08-26 14:11:04 UTC │
    │       └── AddressVerificationColocatedTask     │ 1941 │ on_hold  │ BVASCASPER1       │ Colocated   │ 2020-08-26 14:11:04 UTC │
    │           └── AddressVerificationColocatedTask │ 1942 │ assigned │ BVASCASPER1       │ CSS_ID1     │ 2020-08-26 14:11:04 UTC │
    └── PrivacyActTask                               │ 2674 │ assigned │ VLJ_SUPPORT_ADMIN │ PrivacyTeam │ 2020-08-26 14:17:37 UTC │
                                                     └─────────────────────────────────────────────────────────────────────────────┘

And Foia:
AMA:

                                ┌──────────────────────────────────────────────────────────────────────────┐
Appeal 24 (direct_review) ───── │ ID   │ STATUS      │ ASGN_BY     │ ASGN_TO     │ UPDATED_AT              │
└── RootTask                    │ 1932 │ on_hold     │             │ Bva         │ 2020-08-26 14:11:04 UTC │
    ├── JudgeDecisionReviewTask │ 1933 │ in_progress │ CSS_ID579   │ BVAAABSHIRE │ 2020-08-26 14:27:50 UTC │
    │   └── AttorneyTask        │ 1934 │ completed   │ BVAAABSHIRE │ BVASCASPER1 │ 2020-08-26 14:11:04 UTC │
    └── FoiaColocatedTask       │ 2675 │ on_hold     │ BVAAABSHIRE │ PrivacyTeam │ 2020-08-26 14:28:47 UTC │
        └── FoiaTask            │ 2676 │ assigned    │ BVAAABSHIRE │ PrivacyTeam │ 2020-08-26 14:28:47 UTC │
                                └──────────────────────────────────────────────────────────────────────────┘

and now the messaging for Judges is wrong though - moving that fix back to PR 3

Copy link
Contributor

@yoomlam yoomlam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording suggestions.

app/models/task.rb Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
spec/models/task_spec.rb Outdated Show resolved Hide resolved
lomky and others added 4 commits August 26, 2020 13:00
* Teaches BVA Dispatch blocking tasks to invoke Dispatch on close

When a task that blocks BVA Dispatch is closed, it evaluates the state of the appeal and attempts to create a BVA Dispatch Task if the appeal is otherwise ready

Teaches BvaDispatchTask to refuse to create if there open dispatch_blocking? tasks

* Enables the feature

* Updates Privacy Task messaging to VLJ Support

* Adds messaging for FOIA ama task assignment
@lomky lomky merged commit a9a6449 into kat/14056_blocking_dispatch_stack_1 Aug 28, 2020
@lomky lomky deleted the kat/14056_blocking_dispatch_stack_2 branch August 28, 2020 17:23
@va-bot
Copy link
Collaborator

va-bot commented Aug 28, 2020

1 Warning
⚠️ This PR modifies React components — consider adding/updating corresponding Storybook file

Generated by 🚫 Danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants