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

Connect backend and frontend for convert hearing type page #15314

Merged
merged 26 commits into from
Sep 30, 2020

Conversation

ferristseng
Copy link
Contributor

@ferristseng ferristseng commented Sep 24, 2020

Resolves #15159

Description

  • Create HearingTypeConversion component which wraps the HearingTypeConversionForm
  • Create new route that's connected to the convert hearing type task action
  • Small refactors
    • Made the logic to determine whether or not to display the veteran vs. appellant name consistent
    • Attempt to consolidate where hearing request type mappings are defined in a single location

Acceptance Criteria

  • Selecting "Convert hearing type to virtual" on a ChangeHearingRequestTypeTask shows the non-modal "Convert Hearing to Virtual" form (created in Non-modal form for converting travel board request type to virtual #15217)
  • Submitting the "Convert hearing to virtual" form causes the new request type to be recorded correctly
  • The expected alert is shown when the conversion has successfully taken place
    • If the appeal has been geomatched:
    The hearing request is in the scheduling queue for the [Regional office name] regional office.
    
    • If the appeal has not been geomatched:
    The hearing request is in the scheduling queue for the appropriate regional office.
    

Testing Plan

N/A

User Facing Changes

Note: The task tree is a bit messed up because I was reusing the same appeal over and over again. When I completed the task the first time, it unlocks the schedule hearing task. From there, I was able to schedule the appeal, which is why you see the select hearing disposition task in the screencap.

Screen Recording 2020-09-28 at 10 52 01 AM mov

Code Documentation Updates

  • Add or update code comments at the top of the class, module, and/or component.

Storybook Story

For Frontend (Presentationa) Components

  • Add a Storybook file alongside the component file (e.g. create MyComponent.stories.js alongside MyComponent.jsx)
  • Give it a title that reflects the component's location within the overall Caseflow hierarchy
  • Write a separate story (within the same file) for each discrete variation of the component

@va-bot
Copy link
Collaborator

va-bot commented Sep 24, 2020

2 Warnings
⚠️ This is a Big PR. Try to break this down if possible. Stacked pull requests encourage more detailed and thorough code reviews
⚠️ This PR modifies React components — consider adding/updating corresponding Storybook file

Generated by 🚫 Danger

@codeclimate
Copy link

codeclimate bot commented Sep 24, 2020

Code Climate has analyzed commit 69926a5 and detected 0 issues on this pull request.

View more on Code Climate.

@ferristseng ferristseng requested review from a team, rubaiyat22 and sahalliburton and removed request for a team and rubaiyat22 September 28, 2020 14:59
@@ -106,6 +106,8 @@ def update
render json: {
tasks: tasks_hash
}
rescue ActiveRecord::RecordInvalid => error
invalid_record_error(error.record)
Copy link
Contributor Author

@ferristseng ferristseng Sep 28, 2020

Choose a reason for hiding this comment

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

I was using this to test the error handling code on the frontend. I figured it probably makes sense to always JSONify any validation errors, so I kept it in the PR.

travel: "T",
central: "C"
}.freeze
REQUEST_TYPES = Constants::HEARING_REQUEST_TYPES.with_indifferent_access.freeze
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved these mappings to a JSON constants file so the frontend would have access to them too.


// Depending on where this component is used, the *FullName fields will be available.
// If they aren't, the *FirstName/*LastName fields should be available.
const appellantName = hearing?.appellantIsNotVeteran ?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this based on the appellantIsNotVeteran flag, which is how we determine whether or not to use appellant vs. veteran in other places.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks thats a much better way to check

@@ -126,9 +126,3 @@ export const HEARING_CONVERSION_TYPES = [
'change_email_or_timezone',
'change_hearing_time'
];

export const HEARING_REQUEST_TYPES = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed this and preferred directly importing VIDEO_HEARING, CENTRAL_OFFICE_HEARING, and VIRTUAL_HEARING. We declare these kinds of mappings in a bunch of different places, so I'm trying to consolidate where possible.

Copy link
Contributor

@sahalliburton sahalliburton left a comment

Choose a reason for hiding this comment

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

LGTM, I tested both scenarios and when geomatched it does show the regional office and when not it shows the correct text. There is just one issue I noticed and that is when the hearing is converted to travel, I need to refresh the page in order to see the hearing type change to "Virtual"

@ferristseng ferristseng force-pushed the ftseng/15159-connect-travel-board-page branch from 530f91b to 2ac01b3 Compare September 29, 2020 22:15
@ferristseng
Copy link
Contributor Author

ferristseng commented Sep 29, 2020

There is just one issue I noticed and that is when the hearing is converted to travel, I need to refresh the page in order to see the hearing type change to "Virtual"

It looks like this is an issue because the appeal never gets refreshed after the change is made. I updated the submit call to delete the appeal from the store, which forces the case details page to do a full reload of the appeals data.

Commit: 2ac01b3

Copy link
Contributor

@sahalliburton sahalliburton left a comment

Choose a reason for hiding this comment

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

LGTM

@ferristseng ferristseng added the Ready-to-Merge This PR is ready to be merged and will be picked up by va-bot to automatically merge to master label Sep 30, 2020
@va-bot va-bot merged commit 89c7ca7 into master Sep 30, 2020
@va-bot va-bot deleted the ftseng/15159-connect-travel-board-page branch September 30, 2020 15:15
va-bot pushed a commit that referenced this pull request Jan 25, 2021
Resolves [CASEFLOW-210](https://vajira.max.gov/browse/CASEFLOW-210)

### Description

Gives Hearing Coordinators the ability to convert the hearing request type on any appeal applying the same workflow as was used to convert Travel Board request types implemented in #15314. 

### Acceptance Criteria
- [ ] Code compiles correctly
- [ ] Users are able to successfully convert hearing request types from Central Office/Video to Virtual

### Testing Plan

1. Shadow user `BVASYELOW`: http://localhost:3000/test/users
2. Navigate to the hearing schedule: http://localhost:3000/hearings/schedule
3. Click the "Schedule Veterans" button
4. Search for "St. Petersburg, FL" in the Regional Office dropdown and navigate to the "AMA Veterans Waiting" tab
5. Select 1 of the Veterans from the list to navigate to their case details page
6. Once the case details page loads, check the actions dropdown for the Convert to Virtual Hearing action and select that
7. Review the conversion page and based on whether you selected the Central Office or another regional office, you should see a message at the top indicating in which queue this request will be
8. Click the Convert to Virtual Hearing button
9. Ensure you receive a success banner and that the action to Convert to Virtual Hearing is no longer available
10. Ensure that the Hearing Request type in the claims header now says Virtual
11. Scroll down and check that there is a ChangeHearingRequestType indicating the conversion
12. Scroll back up and click the Schedule Veteran action and ensure that the Virtual option is preselected

### Code Documentation Updates
- [x] Add or update code comments at the top of the class, module, and/or component.

### Database Changes
*Only for Schema Changes*

* [x] Column comments updated
* [x] Verify that `migrate:rollback` works as desired ([`change` supported functions](https://edgeguides.rubyonrails.org/active_record_migrations.html#using-the-change-method))
* [x] DB schema docs updated with `make docs` (after running `make migrate`)
* [x] #appeals-schema notified with summary and link to this PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready-to-Merge This PR is ready to be merged and will be picked up by va-bot to automatically merge to master Team: Tango 💃
Projects
None yet
3 participants