-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added convert to virtual for video hearings (#15805)
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
- Loading branch information
1 parent
a6d8a24
commit 94fbc98
Showing
13 changed files
with
431 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# frozen_string_literal: true | ||
|
||
module HearingRequestTypeConcern | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
# Add Paper Trail configuration | ||
has_paper_trail only: [:changed_request_type], on: [:update] | ||
|
||
validates :changed_request_type, | ||
inclusion: { | ||
in: [ | ||
HearingDay::REQUEST_TYPES[:central], | ||
HearingDay::REQUEST_TYPES[:video], | ||
HearingDay::REQUEST_TYPES[:virtual] | ||
], | ||
message: "changed request type (%<value>s) is invalid" | ||
}, | ||
allow_nil: true | ||
end | ||
|
||
class InvalidChangedRequestType < StandardError; end | ||
|
||
# uses the paper_trail version on LegacyAppeal | ||
def latest_appeal_event | ||
TaskEvent.new(version: versions.last) if versions.any? | ||
end | ||
|
||
def original_hearing_request_type(readable: false) | ||
# Use the VACOLS value for LegacyAppeals otherwise use the closest regional office | ||
original_hearing_request_type = is_a?(LegacyAppeal) ? hearing_request_type : closest_regional_office | ||
|
||
# Format the request type into a symbol | ||
formatted_request_type = format_hearing_request_type(original_hearing_request_type) | ||
|
||
# Return the human readable request type or the symbol of request type | ||
readable ? LegacyAppeal::READABLE_HEARING_REQUEST_TYPES[formatted_request_type] : formatted_request_type | ||
end | ||
|
||
def current_hearing_request_type(readable: false) | ||
request_type = changed_request_type.presence || original_hearing_request_type | ||
|
||
# Format the request type into a symbol | ||
formatted_request_type = format_hearing_request_type(request_type) | ||
|
||
# Return the human readable request type or the symbol of request type | ||
readable ? LegacyAppeal::READABLE_HEARING_REQUEST_TYPES[formatted_request_type] : formatted_request_type | ||
end | ||
|
||
# # if `change_hearing_request` is populated meaning the hearing request type was changed, then return what the | ||
# # previous hearing request type was. Use paper trail event to derive previous type in the case the type was changed | ||
# # multple times. | ||
def previous_hearing_request_type(readable: false) | ||
diff = latest_appeal_event&.diff || {} # Example of diff: {"changed_request_type"=>[nil, "R"]} | ||
previous_hearing_request_type = diff["changed_request_type"]&.first | ||
|
||
request_type = previous_hearing_request_type.presence || original_hearing_request_type | ||
|
||
# Format the request type into a symbol | ||
formatted_request_type = format_hearing_request_type(request_type) | ||
|
||
# Return the human readable request type or the symbol of request type | ||
readable ? LegacyAppeal::READABLE_HEARING_REQUEST_TYPES[formatted_request_type] : formatted_request_type | ||
end | ||
|
||
private | ||
|
||
# rubocop:disable Metrics/CyclomaticComplexity | ||
def format_hearing_request_type(request_type) | ||
return nil if request_type.nil? | ||
|
||
case request_type | ||
when HearingDay::REQUEST_TYPES[:central], :central_office, :central | ||
is_a?(LegacyAppeal) ? :central_office : :central | ||
when :travel_board | ||
video_hearing_requested ? :video : :travel_board | ||
when HearingDay::REQUEST_TYPES[:virtual] | ||
:virtual | ||
else | ||
:video | ||
end | ||
end | ||
# rubocop:enable Metrics/CyclomaticComplexity | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ def call | |
private | ||
|
||
SKIP_ASSOCIATIONS = %w[ | ||
versions | ||
appeal_views | ||
claims_folder_searches | ||
job_notes | ||
|
8 changes: 8 additions & 0 deletions
8
db/migrate/20210115212305_add_changed_hearing_request_type_to_appeal.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AddChangedHearingRequestTypeToAppeal < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :appeals, | ||
:changed_request_type, | ||
:string, | ||
comment: "The new hearing type preference for an appellant that needs a hearing scheduled" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.