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

Do not update AOD motions if they do not apply to the appeal #14087

Closed
2 tasks
hschallhorn opened this issue Apr 24, 2020 · 0 comments · Fixed by #14102
Closed
2 tasks

Do not update AOD motions if they do not apply to the appeal #14087

hschallhorn opened this issue Apr 24, 2020 · 0 comments · Fixed by #14102
Assignees
Labels
Feature: case-details Priority: High Escalations from Support, blocking issue/NO workaround, or "first in" priority for new work. Product: caseflow-queue Source: BVA Reported Stakeholder: BVA Functionality associated with the Board of Veterans' Appeals workflows/feature requests Team: Echo 🐬 Type: Bug

Comments

@hschallhorn
Copy link
Contributor

hschallhorn commented Apr 24, 2020

This is a quick patch before getting to #14085.

Description

When we check the AOD status of an appeal, we check their age

def advanced_on_docket?(appeal_receipt_date)
advanced_on_docket_based_on_age? || AdvanceOnDocketMotion.granted_for_person?(id, appeal_receipt_date)
end
and whether or not there are any granted AOD motions that were created after the appeal was received
def granted_for_person?(person_id, appeal_receipt_date)
where(
granted: true,
created_at: appeal_receipt_date..DateTime::Infinity.new,
person_id: person_id
).any?
end
.
Currently, when an AOD team member attempts to mark a case as AOD, it completes successfully, but the current case is not shown as AOD. This is because we update the existing AOD motion
motion = find_or_create_by(person_id: person_id)
for that claimant, regardless of whether or not the motion would apply to the appeal based on receipt date. If the updated AOD motion was created before the appeal was received, the motion is considered to not apply to the appeal and the AOD status is not updated.

Instead, we should only update AOD motions that were created after the appeal was received.
Also, as age related aod motions should apply at the claimant level and be granted for all subsequent appeals, do not update any age related aod motions.

Acceptance Criteria

  • create_or_update_by_appeal should only update aod motions that would apply to the current appeal
  • create_or_update_by_appeal should not update reason for age related aod motions
@hschallhorn hschallhorn added Product: caseflow-queue Type: Bug Feature: case-details Stakeholder: BVA Functionality associated with the Board of Veterans' Appeals workflows/feature requests Team: Echo 🐬 Priority: High Escalations from Support, blocking issue/NO workaround, or "first in" priority for new work. Source: BVA Reported labels Apr 24, 2020
@hschallhorn hschallhorn self-assigned this Apr 24, 2020
va-bot pushed a commit that referenced this issue Apr 29, 2020
Resolves #14087

### Description
Only updates motions that apply to an appeal. Eligible motions are motions created after the appeal receipt date. Fixes bug where users would update a case to be AOD, but the case would not appear as AOD, even though the request completed successfully.

### Acceptance Criteria
- [ ] Age related motions apply to all appeals created after the motion was created
- [ ] All other motions only apply to appeals created before that motion was created
- [ ] If a user marks an appeal as AOD and there exists a previous motion, but it was granted before the appeal receipt date, create a new motion
- [ ] If a user marks an appeal as AOD and there exists a previous motion, but the motion is age related, create a new motion

### Testing Plan
#### Age related motions apply to all appeals created after the motion was created
1. Sign in as AOD_USER and search for a random case (I used vet file # 321321324)
2. Create a previous age related motion for that appeal
```ruby
appeal = Appeal.find_by_uuid("ee8f8e09-b95c-4ed5-9210-813ba9eb5a4e")
motion = AdvanceOnDocketMotion.create(
  person: appeal.claimant.person,
  created_at: appeal.receipt_date - 5.days,
  reason: Constants.AOD_REASONS.age,
  granted: true,
  user: User.find_by_css_id("AOD_USER")
)
```
3. Go to case details and ensure case shows AOD status

#### All other motions only apply to appeals created before that motion was created
1. Update the previous motion to be not age related
```ruby
motion.financial_distress!
```
2. Refresh case details and ensure AOD status is not shown
#### If a user marks an appeal as AOD and there exists a previous motion, but it was granted before the appeal receipt date, create a new motion (BUG WE ARE TRYING TO SOLVE)
1. _Specifically_  after the previous step, click "Edit" next to "Original" case type
2. Grant AOD status for any reason and press submit
3. Ensure page now shows AOD status (persists though refresh as well)
4. Confirm we created a new AOD motion
```ruby
appeal.claimant.person.advance_on_docket_motions.count.eql? 2
=> true
```
### User Facing Changes
- [ ] After changing AOD status for an appeal, user stays on the case details page
- [ ] Updated success banner wording
![Screen Shot 2020-04-27 at 2 43 45 PM](https://user-images.githubusercontent.com/45575454/80408845-d26bb480-8895-11ea-86cc-edecc121f318.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: case-details Priority: High Escalations from Support, blocking issue/NO workaround, or "first in" priority for new work. Product: caseflow-queue Source: BVA Reported Stakeholder: BVA Functionality associated with the Board of Veterans' Appeals workflows/feature requests Team: Echo 🐬 Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant