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

Add convert central to virtual and virtual to central hearings workflow #14704

Merged
merged 41 commits into from
Jul 20, 2020

Conversation

sahalliburton
Copy link
Contributor

Resolves #14421

Description

This PR adds the convert-to-virtual workflow for Central Office hearings. This work is currently behind the feature flag schedule_virtual_hearings_for_central and offers users with this permission to change currently scheduled Central Office hearings to virtual hearings.

Acceptance Criteria

  • Code compiles correctly (tests pass etc.)
  • Storybook stories work as expected

Testing Plan

Central Office Hearing

  1. Select a hearings admin user (BVASYELLOW)
  2. Navigate to the hearings schedule and choose a 'Central' hearing from the list: http://localhost:3000/hearings/schedule
  3. Click the 'Edit hearing details' link
  4. In the hearing type dropdown choose 'Virtual'
  5. Ensure the Hearing Conversion page matches the Figma mock from the ticket
  6. Ensure that you can successfully convert back and forth between Virtual and Central

Video Hearing

  1. Select a hearings admin user (BVASYELLOW)
  2. Navigate to the hearings schedule and choose a 'Video' hearing from the list: http://localhost:3000/hearings/schedule
  3. Click the 'Edit hearing details' link
  4. In the hearing type dropdown choose 'Virtual'
  5. Ensure the video hearing modal is displayed and all the functionality is unchanged
  6. Ensure that you can successfully convert back and forth between Virtual and Video

User Facing Changes

  • Screenshots of UI changes added to PR & Original Issue
BEFORE AFTER
- ConvertCentralToVirtual
- ConvertVirtualToCentral

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

@sahalliburton sahalliburton requested review from ferristseng and rubaiyat22 and removed request for ferristseng July 16, 2020 14:18
@va-bot
Copy link
Collaborator

va-bot commented Jul 16, 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

@@ -75,9 +76,7 @@ export default class HearingsApp extends React.PureComponent {

routeForHearingDetails = ({ match: { params }, history }) => (
<HearingsUserContext.Provider value={this.userPermissionProps()}>
<HearingsFormContextProvider>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the forms context into the DetailsContainer component to inherit state that we already have


return {
hearingDetailsForm: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of this state was moved into the HearingsFormContext

@codeclimate
Copy link

codeclimate bot commented Jul 16, 2020

Code Climate has analyzed commit 2b756c6 and detected 0 issues on this pull request.

View more on Code Climate.

...(virtualHearingForm || {})
}
const submit = async (editedEmails) => {
try {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

convert to try-catch block with async/await to remove all of the callbacks

Copy link

@rubaiyat22 rubaiyat22 left a comment

Choose a reason for hiding this comment

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

some comments for backend

app/models/hearing.rb Outdated Show resolved Hide resolved
app/models/hearing.rb Outdated Show resolved Hide resolved
app/models/hearings/forms/base_hearing_update_form.rb Outdated Show resolved Hide resolved
app/models/legacy_hearing.rb Outdated Show resolved Hide resolved
app/models/legacy_hearing.rb Outdated Show resolved Hide resolved
app/models/legacy_hearing.rb Outdated Show resolved Hide resolved
@@ -34,7 +34,7 @@ def index
def show
render json: {
hearing_day: hearing_day.to_hash.merge(
hearings: hearing_day.hearings_for_user(current_user).map { |hearing| hearing.quick_to_hash(current_user.id) }
hearings: hearing_day.hearings_for_user(current_user).map { |hearing| hearing.to_hash(current_user.id) }

Choose a reason for hiding this comment

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

I have some concerns that this may affect the performance of DailyDocket as the quick_to_hash does not serialize things that DailyDocket does not need yet like appellant_email_address which make calls VACOLS
cc: @ferristseng

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there will be a performance tradeoff whether we use the quick_to_hash here or make an additional call on the details page, this preloads data that will be needed to reduce the number of roundtrips

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 ended up reverting this and removing the frontend caching for now as it was creating too much of a bottleneck on the daily docket page @rubaiyat22 and @ferristseng, we should create a separate ticket though to revisit frontend caching so that we can improve client-side performance

app/models/hearing.rb Outdated Show resolved Hide resolved
app/serializers/hearings/hearing_serializer.rb Outdated Show resolved Hide resolved
app/serializers/hearings/legacy_hearing_serializer.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@ferristseng ferristseng left a comment

Choose a reason for hiding this comment

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

Looks great! I think there are some small things that I noted in the feedback to fix (some of the out-of-date stuff might be mislabelled in that it is still relevant). Thank you for all the new tests and stories!

app/controllers/hearings/hearing_day_controller.rb Outdated Show resolved Hide resolved
app/models/hearings/forms/base_hearing_update_form.rb Outdated Show resolved Hide resolved
app/serializers/hearings/hearing_serializer.rb Outdated Show resolved Hide resolved
app/serializers/hearings/legacy_hearing_serializer.rb Outdated Show resolved Hide resolved
import React from 'react';
import PropTypes from 'prop-types';

export const FormLabel = ({ label, name, required, optional }) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Good refactors 🛠️

client/app/hearings/constants.js Outdated Show resolved Hide resolved
0
);

expect(details).toMatchSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

Great tests!!

Copy link

@rubaiyat22 rubaiyat22 left a comment

Choose a reason for hiding this comment

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

Some differences I noticed between design and my dev. let me know if you wanna talk about any of these.

  1. Text under the hearing time dropdown is missing
    Figma:
    108306063_281588556244707_2135829603604302309_n

  2. if have some unsaved on details page and I choose to convert a central to Virtual, it does not indicate that there some unsaved changes (Maybe be out of scope for this PR as we did not decide to go with a new page. If out of scope, me may want to write that somwhere/create a ticket)

  3. POA email is being validated when converting to virtual .

Screen Shot 2020-07-17 at 11 41 15 AM
Also the convert button changes to disabled loading button and does not allow me to make any edits without reloading the page
4. Updating the timezone for Veteran the modal looks like this
Screen Shot 2020-07-17 at 12 03 53 PM
but in figma it looks like this
107936059_3297515650309154_610957542589701227_n

this also applies to the success message which in figma looks like this
107668984_749781169166997_9109222447498423562_n

  1. Upading the timezone for a poa looks the same as update timezone for veteran
    Screen Shot 2020-07-17 at 12 08 16 PM
    but in figma it looks like this
    107340198_761450664602382_3922393549357951696_n

  2. changing timezone for both appellant and veteran also looks the same as above
    Screen Shot 2020-07-17 at 12 12 11 PM
    But in figma it looks like this:
    Screen Shot 2020-07-16 at 3 53 49 PM


/**
* Hearing Details Component
* @param {Object} props -- React props inherited from client/app/hearings/containers/DetailsContainer.jsx

Choose a reason for hiding this comment

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

Nice and clear comment!

});

// Focus to the error
return document.getElementById('email-section').scrollIntoView();

Choose a reason for hiding this comment

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

Cool idea!

// Set the Virtual Hearing errors
setVirtualHearingErrors({
[!hearing.virtualHearing.appellantEmail && 'appellantEmail']: 'Appellant email is required',
[!hearing.virtualHearing.representativeEmail && 'representativeEmail']: 'Representative email is required',

Choose a reason for hiding this comment

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

[note] I think there's a ticket out to remove this required constraint for representative email

@@ -3,253 +3,182 @@ import { connect } from 'react-redux';
import { css } from 'glamor';
import AppSegment from '@department-of-veterans-affairs/caseflow-frontend-toolkit/components/AppSegment';
import PropTypes from 'prop-types';
import React, { useState, useEffect, useContext } from 'react';
import _ from 'lodash';

Choose a reason for hiding this comment

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

great idea to import specifics

import { JudgeDropdown } from '../../components/DataDropdowns/index';
import { marginTop, noMaxWidth } from './details/style';
import COPY from '../../../COPY';
import { AddressLine } from './details/Address';

Choose a reason for hiding this comment

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

Noticed that there is an Address component in /queue/components. This might be place where we could take it out to the shared components and reuse it but that's out of scope for this PR

Copy link

@rubaiyat22 rubaiyat22 left a comment

Choose a reason for hiding this comment

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

Great job putting all these together. It looks great!!
It looks like we're sending confirmation emails to both appellant and poa when either of the timezone changes so i think we have to change our backend to send confirmation emails to only the recipient whose timezone was updated. I added some comments about some differences i found in figma and your PR hence requested changes but let me know if anything is too out of scope and you want to create a follow up ticket instead.
Also would you mind adding some screens shots of the changes in the PR.

Copy link

@rubaiyat22 rubaiyat22 left a comment

Choose a reason for hiding this comment

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

Going to go ahead and approve as @sahalliburton and I resolved some of comments async and we created some follow up tickets

@sahalliburton sahalliburton 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 Jul 20, 2020
@va-bot va-bot merged commit e8164bc into master Jul 20, 2020
@va-bot va-bot deleted the shalliburton/14421-convert-to-virtual branch July 20, 2020 15:25
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build new Convert to Virtual page for Central Office hearings
4 participants