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
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ae5985f
WIP: Started adding convert to virtual workflow
Jun 24, 2020
05bca62
WIP: Started changing vh attributes
Jun 25, 2020
46d4cab
Started large refactor of details
Jun 26, 2020
ffd7903
WIP: Finished refactoring details component
Jun 29, 2020
56d5d5c
Fixed merge conflicts
Jun 29, 2020
6c18c47
Updated storybook stories
Jun 30, 2020
70d961c
Separated conversion components and got conversion flow working
Jun 30, 2020
b28c8c6
Added timezone component
Jun 30, 2020
0dc0fa7
Merge branch 'master' of https://github.com/department-of-veterans-af…
Jun 30, 2020
3e9caa8
Finished adding convert between virtual/central workflow
Jul 1, 2020
e3a789b
Consolidated new components for hearing conversion
Jul 1, 2020
213ac24
Added stories for new components
Jul 1, 2020
19a2a24
Added test stubs for components to be tested
Jul 2, 2020
338ec09
Added timezone service for rep address and rep address
Jul 7, 2020
d5d0a72
Reset serializers
Jul 10, 2020
b2203c5
Fixed merge conflicts
Jul 13, 2020
18f9f81
Fixed failing tests after merge to master
Jul 14, 2020
e4bb04b
Fixed merge conflicts
Jul 14, 2020
da4e49b
Updated unit tests for conversion components
Jul 15, 2020
2e4ccb1
Merge branch 'master' of https://github.com/department-of-veterans-af…
Jul 15, 2020
ea26986
Finished adding tests for new components
Jul 16, 2020
3479701
Merge branch 'master' of https://github.com/department-of-veterans-af…
Jul 16, 2020
4cb8f80
Merged to amster
Jul 16, 2020
d360cff
Refactored based on code climate
Jul 16, 2020
461edad
Refactored based on code climate
Jul 16, 2020
76c861f
Fixed timezone calculation for tests
Jul 16, 2020
c9472c7
Updated based on comments
Jul 16, 2020
92de6af
Updated based on comments
Jul 16, 2020
29169f0
Moved timezone functions into appeal model
Jul 16, 2020
5cb406e
Updated based on code climate
Jul 16, 2020
36a0534
Fixed failing rspec tests
Jul 16, 2020
d10e7e4
Hide timezone for formerly video hearings
Jul 16, 2020
6f594b5
Ignore codeclimate branch size
Jul 16, 2020
8150c92
Fixed lint errors
Jul 16, 2020
8be58dc
Started refactoring from feedback
Jul 17, 2020
aba96ec
Addressed feedback from PR
Jul 17, 2020
f7dcbbe
Added clear alert state when transitioning between pages
Jul 17, 2020
a824725
Refactored useEffect call
Jul 17, 2020
a91e115
Removed validation for POA email on central
Jul 17, 2020
c904d26
Merge branch 'master' into shalliburton/14421-convert-to-virtual
Jul 20, 2020
2b756c6
Merge branch 'master' into shalliburton/14421-convert-to-virtual
Jul 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/hearings/hearing_day_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
sahalliburton marked this conversation as resolved.
Show resolved Hide resolved

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

)
}
end
Expand Down
16 changes: 16 additions & 0 deletions app/models/hearing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ def representative_email_address
appeal&.representative_email_address
end

def representative_address
sahalliburton marked this conversation as resolved.
Show resolved Hide resolved
appeal&.representative_address
end

def appellant_tz
rubaiyat22 marked this conversation as resolved.
Show resolved Hide resolved
return if appeal&.address.blank?

TimezoneService.address_to_timezone(appeal&.address).identifier
end

def representative_tz
return if representative_address.blank?

TimezoneService.address_to_timezone(Address.new(representative_address)).identifier
end

def claimant_id
return nil if appeal.appellant.nil?

Expand Down
5 changes: 4 additions & 1 deletion app/models/hearings/forms/base_hearing_update_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ def should_create_or_update_virtual_hearing?
end

def only_time_updated?
sahalliburton marked this conversation as resolved.
Show resolved Hide resolved
!virtual_hearing_created? && scheduled_time_string.present?
(!virtual_hearing_created? && scheduled_time_string.present?) ||
# Also send virtual hearing time updates if the representative timezone is changed
virtual_hearing_attributes&.dig(:representative_tz).present? ||
virtual_hearing_attributes&.dig(:appellant_tz).present?
ferristseng marked this conversation as resolved.
Show resolved Hide resolved
end

def start_async_job?
Expand Down
1 change: 0 additions & 1 deletion app/models/hearings/virtual_hearing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def base_url
validates_email_format_of :judge_email, allow_nil: true
validates_email_format_of :appellant_email
validates_email_format_of :representative_email, allow_nil: true
validate :associated_hearing_is_video, on: :create
validate :hearing_is_not_virtual, on: :create

scope :eligible_for_deletion,
Expand Down
16 changes: 16 additions & 0 deletions app/models/legacy_hearing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ def representative_email_address
appeal&.representative_email_address
end

def representative_address
sahalliburton marked this conversation as resolved.
Show resolved Hide resolved
appeal&.representative_address
end

def appellant_tz
return if appeal&.appellant_address.blank?

TimezoneService.address_to_timezone(appeal&.appellant_address).identifier
end

def representative_tz
return if representative_address.blank?

TimezoneService.address_to_timezone(representative_address).identifier
end

def assigned_to_vso?(user)
appeal.tasks.any? do |task|
task.type == TrackVeteranTask.name &&
Expand Down
3 changes: 3 additions & 0 deletions app/serializers/hearings/hearing_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class HearingSerializer
attribute :regional_office_timezone
attribute :representative, if: for_full
attribute :representative_name, if: for_full
attribute :representative_address, if: for_full
attribute :representative_email_address, if: for_full
attribute :room
attribute :scheduled_for
Expand All @@ -77,6 +78,8 @@ class HearingSerializer
attribute :veteran_last_name
attribute :veteran_email_address, if: for_full
attribute :is_virtual, &:virtual?
attribute :appellant_tz
attribute :representative_tz
sahalliburton marked this conversation as resolved.
Show resolved Hide resolved
rubaiyat22 marked this conversation as resolved.
Show resolved Hide resolved
attribute :virtual_hearing do |object|
if object.virtual? || object.was_virtual?
VirtualHearingSerializer.new(object.virtual_hearing).serializable_hash[:data][:attributes]
Expand Down
3 changes: 3 additions & 0 deletions app/serializers/hearings/legacy_hearing_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class LegacyHearingSerializer
attribute :regional_office_timezone
attribute :representative, if: for_full
attribute :representative_name, if: for_full
attribute :representative_address, if: for_full
attribute :representative_email_address, if: for_full
attribute :room
attribute :scheduled_for
Expand All @@ -75,6 +76,8 @@ class LegacyHearingSerializer
end
end
attribute :is_virtual, &:virtual?
attribute :appellant_tz
attribute :representative_tz
sahalliburton marked this conversation as resolved.
Show resolved Hide resolved
sahalliburton marked this conversation as resolved.
Show resolved Hide resolved
attribute :virtual_hearing do |object|
if object.virtual? || object.was_virtual?
VirtualHearingSerializer.new(object.virtual_hearing).serializable_hash[:data][:attributes]
Expand Down
2 changes: 2 additions & 0 deletions app/serializers/hearings/virtual_hearing_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
class VirtualHearingSerializer
include FastJsonapi::ObjectSerializer

attribute :appellant_tz
attribute :representative_tz
attribute :appellant_email
attribute :representative_email
attribute :status
Expand Down
1 change: 1 addition & 0 deletions app/views/hearings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
feedbackUrl: feedback_url,
buildDate: build_date,
userCanScheduleVirtualHearings: FeatureToggle.enabled?(:schedule_virtual_hearings, user: current_user),
userCanConvertCentralHearings: FeatureToggle.enabled?(:schedule_virtual_hearings_for_central, user: current_user),
userCanAssignHearingSchedule: current_user.can_assign_hearing_schedule?,
userCanBuildHearingSchedule: current_user.can?('Build HearSched'),
userCanViewHearingSchedule: current_user.can_view_hearing_schedule?,
Expand Down
5 changes: 5 additions & 0 deletions client/COPY.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,11 @@

"VIRTUAL_HEARING_REQUEST_TYPE": "Virtual",
"VIRTUAL_HEARING_SCHEDULING_IN_PROGRESS": "Scheduling in progress",
"VIRTUAL_HEARING_TIMEZONE_HELPER_TEXT": "The hearing time in email notifications is calculated based on the timezone",
"VIRTUAL_HEARING_EMAIL_HELPER_TEXT": "Changes to the email are used to send notifications for this hearing only",

"CENTRAL_OFFICE_CHANGE_FROM_VIRTUAL": "Emails will be sent to the Veteran and POA / Representative to notify them that their virtual hearing link is no longer valid and they must appear in-person at the Board of Veterans’ Appeals Central Office.",
"CENTRAL_OFFICE_CHANGE_TO_VIRTUAL": "Email notifications will be sent to the Veteran, POA / Representative, and Veterans Law Judge (VLJ).",

"VIRTUAL_HEARING_MODAL_CHANGE_TO_VIRTUAL_TITLE": "Change to Virtual Hearing",
"VIRTUAL_HEARING_MODAL_CHANGE_TO_VIDEO_TITLE": "Change to Video Hearing",
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/TextField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class TextField extends React.Component {
const labelContents =
<span>
{label || name}
{required && !readOnly && <span className="cf-required">Required</span>}
{required && <span className="cf-required">Required</span>}
{optional && <span className="cf-optional">Optional</span>}
</span>;

Expand Down
8 changes: 4 additions & 4 deletions client/app/hearings/HearingsApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import _ from 'lodash';
import querystring from 'querystring';

import { HearingsUserContext } from './contexts/HearingsUserContext';
import { HearingsFormContextProvider } from './contexts/HearingsFormContext';
import { LOGO_COLORS } from '../constants/AppConstants';
import AppFrame from '../components/AppFrame';
import AssignHearingsContainer from './containers/AssignHearingsContainer';
Expand All @@ -28,6 +27,7 @@ import UnsupportedBrowserBanner from '../components/UnsupportedBrowserBanner';
export default class HearingsApp extends React.PureComponent {
userPermissionProps = () => {
const {
userCanConvertCentralHearings,
userCanScheduleVirtualHearings,
userCanAssignHearingSchedule,
userCanBuildHearingSchedule,
Expand All @@ -40,6 +40,7 @@ export default class HearingsApp extends React.PureComponent {
} = this.props;

return Object.freeze({
userCanConvertCentralHearings,
userCanScheduleVirtualHearings,
userCanAssignHearingSchedule,
userCanBuildHearingSchedule,
Expand Down Expand Up @@ -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

<HearingDetailsContainer hearingId={params.hearingId} history={history} />
</HearingsFormContextProvider>
<HearingDetailsContainer hearingId={params.hearingId} history={history} />
</HearingsUserContext.Provider>
);

Expand Down Expand Up @@ -191,6 +190,7 @@ HearingsApp.propTypes = {
feedbackUrl: PropTypes.string.isRequired,
buildDate: PropTypes.string,
userCanScheduleVirtualHearings: PropTypes.bool,
userCanConvertCentralHearings: PropTypes.bool,
userCanAssignHearingSchedule: PropTypes.bool,
userCanBuildHearingSchedule: PropTypes.bool,
userCanViewHearingSchedule: PropTypes.bool,
Expand Down
Loading