Skip to content

Commit

Permalink
Merge branch 'master' into sandra/15330-add-end-product-update-model
Browse files Browse the repository at this point in the history
  • Loading branch information
va-bot committed Oct 8, 2020
2 parents 34190f2 + a9a2e30 commit f10fb43
Show file tree
Hide file tree
Showing 25 changed files with 161 additions and 69 deletions.
4 changes: 2 additions & 2 deletions app/controllers/hearings/schedule_hearing_tasks_controller.rb
Expand Up @@ -18,7 +18,7 @@ def index
)

# Select `power_of_attorney_name`, `hearing_request_type`, and
# `formally_travel` from the `CachedAppeal` table. This is an
# `former_travel` from the `CachedAppeal` table. This is an
# optimization that fetches these values from the `CachedAppeal` table,
# where they are already cached for filtering. The `TaskColumnSerializer` is
# "aware" of these optimizations, and will serialize the cached values instead
Expand All @@ -29,7 +29,7 @@ def index
"tasks.*,
#{CachedAppeal.table_name}.power_of_attorney_name,
#{CachedAppeal.table_name}.hearing_request_type,
#{CachedAppeal.table_name}.formally_travel"
#{CachedAppeal.table_name}.former_travel"
)

render json: {
Expand Down
18 changes: 9 additions & 9 deletions app/jobs/update_cached_appeals_attributes_job.rb
Expand Up @@ -168,7 +168,7 @@ def cache_legacy_appeal_vacols_data(all_vacols_ids)
vacols_id: folder[:vacols_id],
case_type: vacols_case[:status],
docket_number: folder[:docket_number],
formally_travel: vacols_case[:formally_travel], # true or false
former_travel: vacols_case[:former_travel], # true or false
hearing_request_type: vacols_case[:hearing_request_type],
issue_count: issue_counts_to_cache[folder[:vacols_id]] || 0,
is_aod: aod_status_to_cache[folder[:vacols_id]],
Expand All @@ -178,7 +178,7 @@ def cache_legacy_appeal_vacols_data(all_vacols_ids)

update_columns = [
:docket_number,
:formally_travel,
:former_travel,
:hearing_request_type,
:issue_count,
:veteran_name,
Expand Down Expand Up @@ -256,14 +256,14 @@ def representative_names_for_appeals(appeals)
def case_fields_for_vacols_ids(vacols_ids)
# array of arrays will become hash with bfkey as key.
# [
# [ 123, { location: 57, status: "Original", hearing_request_type: "Video", formally_travel: true} ],
# [ 456, { location: 2, status: "Court Remand", hearing_request_type: "Video", formally_travel: true } ],
# [ 123, { location: 57, status: "Original", hearing_request_type: "Video", former_travel: true} ],
# [ 456, { location: 2, status: "Court Remand", hearing_request_type: "Video", former_travel: true } ],
# ...
# ]
# becomes
# {
# 123: { location: 57, status: "Original", hearing_request_type: "Video", formally_travel: true },
# 456: { location: 2, status: "Court Remand", hearing_request_type: "Video", formally_travel: true },
# 123: { location: 57, status: "Original", hearing_request_type: "Video", former_travel: true },
# 456: { location: 2, status: "Court Remand", hearing_request_type: "Video", former_travel: true },
# ...
# }
VACOLS::Case.where(bfkey: vacols_ids).map do |vacols_case|
Expand All @@ -275,7 +275,7 @@ def case_fields_for_vacols_ids(vacols_ids)
location: vacols_case.bfcurloc,
status: VACOLS::Case::TYPES[vacols_case.bfac],
hearing_request_type: legacy_appeal.readable_hearing_request_type,
formally_travel: formally_travel?(legacy_appeal)
former_travel: former_travel?(legacy_appeal)
}
]
end.to_h
Expand Down Expand Up @@ -304,8 +304,8 @@ def veteran_names_for_file_numbers(veteran_file_numbers)
end.to_h
end

# checks to see if the hearing request type was formally travel
def formally_travel?(legacy_appeal)
# checks to see if the hearing request type was former_travel
def former_travel?(legacy_appeal)
# the current request type is travel
if legacy_appeal.readable_hearing_request_type == LegacyAppeal::READABLE_HEARING_REQUEST_TYPES[:travel_board]
return false
Expand Down
1 change: 1 addition & 0 deletions app/models/attorney_case_review.rb
Expand Up @@ -35,6 +35,7 @@ def update_in_caseflow!
if task.assigned_by_id != reviewing_judge_id
task.parent.update(assigned_to_id: reviewing_judge_id)
end
task.parent.update(assigned_by_id: task.assigned_to_id)
update_issue_dispositions_in_caseflow!
end

Expand Down
2 changes: 0 additions & 2 deletions app/models/decision_issue.rb
Expand Up @@ -9,8 +9,6 @@ class DecisionIssue < CaseflowRecord

with_options if: :appeal? do
validates :disposition, inclusion: { in: Constants::ISSUE_DISPOSITIONS_BY_ID.keys.map(&:to_s) }
validates :diagnostic_code, inclusion: { in: Constants::DIAGNOSTIC_CODE_DESCRIPTIONS.keys.map(&:to_s) },
allow_nil: true
end

# Attorneys will be entering in a description of the decision manually for appeals
Expand Down
9 changes: 8 additions & 1 deletion app/models/legacy_appeal.rb
Expand Up @@ -1028,7 +1028,14 @@ def find_or_create_by_vacols_id(vacols_id)

fail ActiveRecord::RecordNotFound unless appeal.check_and_load_vacols_data!

appeal.save
# recover if another process has saved a record for this
# appeal since this method started
begin
appeal.save
rescue ActiveRecord::RecordNotUnique
appeal = find_by!(vacols_id: vacols_id)
end

appeal
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/queue_tabs/assign_hearing_tab.rb
Expand Up @@ -95,7 +95,7 @@ def hearing_request_type_options
QueueColumn.filter_option_hash(option, label)
end

former_travel_count = tasks.with_cached_appeals.where("cached_appeal_attributes.formally_travel = ?", true).count
former_travel_count = tasks.with_cached_appeals.where("cached_appeal_attributes.former_travel = ?", true).count

if former_travel_count > 0
label = QueueColumn.format_option_label(
Expand Down
4 changes: 2 additions & 2 deletions app/models/serializers/work_queue/task_column_serializer.rb
Expand Up @@ -196,10 +196,10 @@ def self.serialize_attribute?(params, columns)
columns = [Constants.QUEUE_CONFIG.HEARING_REQUEST_TYPE_COLUMN_NAME]

if serialize_attribute?(params, columns)
# The `formally_travel` field doesn't exist on the actual model. This
# The `former_travel` field doesn't exist on the actual model. This
# field needs to be added in a select statement and represents the field from
# the `cached_appeal_attributes` table in `Hearings::ScheduleHearingTasksController`.
object&.[](:formally_travel)
object&.[](:former_travel)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/task_filter.rb
Expand Up @@ -34,7 +34,7 @@ def create_where_clause(filter)
end

def extract_former_travel_clause(filter, orig_clause)
is_former_travel_clause = "cached_appeal_attributes.formally_travel = true"
is_former_travel_clause = "cached_appeal_attributes.former_travel = true"
(filter.values.size == 1) ? is_former_travel_clause : "(#{orig_clause} OR #{is_former_travel_clause})"
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/tasks/docket_switch_mail_task.rb
Expand Up @@ -6,7 +6,7 @@ def available_actions(user)

if ClerkOfTheBoard.singleton.user_has_access?(user)
if assigned_to.is_a?(User) && FeatureToggle.enabled?(:docket_change, user: user)
actions.push(Constants.TASK_ACTIONS.DOCKET_CHANGE_SEND_TO_JUDGE.to_h)
actions.push(Constants.TASK_ACTIONS.DOCKET_SWITCH_SEND_TO_JUDGE.to_h)
end
end

Expand Down
17 changes: 17 additions & 0 deletions app/models/tasks/docket_switch_ruling_task.rb
@@ -0,0 +1,17 @@
# frozen_string_literal: true

class DocketSwitchRulingTask < JudgeTask
def additional_available_actions(user)
actions = []

if assigned_to.is_a?(User) && FeatureToggle.enabled?(:docket_change, user: user)
actions.push(Constants.TASK_ACTIONS.DOCKET_SWITCH_JUDGE_RULING.to_h)
end

actions
end

def self.label
COPY::DOCKET_SWITCH_RULING_TASK_LABEL
end
end
2 changes: 2 additions & 0 deletions client/COPY.json
Expand Up @@ -591,6 +591,8 @@
"VACATE_MOTION_MAIL_TASK_LABEL": "Motion to vacate",
"REVIEW_MOTION_TO_VACATE_TASK_LABEL": "Review motion to vacate",

"DOCKET_SWITCH_RULING_TASK_LABEL": "Rule on Docket Switch",

"CORRECT_REQUEST_ISSUES_LINK": "Correct issues",
"CORRECT_REQUEST_ISSUES_WITHDRAW": "Withdraw",
"CORRECT_REQUEST_ISSUES_SAVE": "Save",
Expand Down
2 changes: 1 addition & 1 deletion client/app/hearings/components/HearingTime.jsx
Expand Up @@ -19,7 +19,7 @@ export const HearingTime = (
'' :
hearing.virtualHearing?.appellantTz || hearing.regionalOfficeTimezone;

// Determine what timezone to use; always use RO timezone for video/formally-video hearings
// Determine what timezone to use; always use RO timezone for video/formerly-video hearings
const timezone = (hearing.isVirtual && hearing.readableRequestType !== 'Video') ?
repTimezone :
hearing.regionalOfficeTimezone || 'America/New_York';
Expand Down
10 changes: 7 additions & 3 deletions client/app/hearings/components/ScheduleVeteran.jsx
Expand Up @@ -16,7 +16,7 @@ import { showSuccessMessage, showErrorMessage, requestPatch } from '../../queue/
import { onReceiveAppealDetails } from '../../queue/QueueActions';
import { formatDateStr } from '../../util/DateUtil';
import Alert from '../../components/Alert';
import { marginTop, regionalOfficeSection, saveButton, cancelButton } from './details/style';
import { setMargin, marginTop, regionalOfficeSection, saveButton, cancelButton } from './details/style';
import { find, get } from 'lodash';
import { getAppellantTitle, processAlerts, parseVirtualHearingErrors } from '../utils';
import {
Expand Down Expand Up @@ -280,13 +280,17 @@ export const ScheduleVeteran = ({
});
};

// Create the header styling based on video/virtual type
const headerStyle = virtual ? setMargin('0 0 0.75rem 0') : setMargin(0);
const helperTextStyle = virtual ? setMargin('0 0 2rem 0') : setMargin(0);

return (
<div {...regionalOfficeSection}>
<AppSegment filledBackground >
<h1>{header}</h1>
<h1 {...headerStyle}>{header}</h1>
{error && <Alert title={error.title} type="error">{error.detail}</Alert>}
{virtual ?
<div {...marginTop(0)}>{COPY.SCHEDULE_VETERAN_DIRECT_TO_VIRTUAL_HELPER_LABEL}</div> :
<div {...helperTextStyle}>{COPY.SCHEDULE_VETERAN_DIRECT_TO_VIRTUAL_HELPER_LABEL}</div> :
!fullHearingDay && <div {...marginTop(45)} />}

{fullHearingDay && (
Expand Down
5 changes: 5 additions & 0 deletions client/app/hearings/components/details/style.jsx
Expand Up @@ -186,3 +186,8 @@ export const spacing = (space, el) => css({
export const cancelButton = css({ float: 'left', paddingLeft: 0, paddingRight: 0 });

export const saveButton = css({ float: 'right' });

export const setMargin = (margin) =>
css({
margin
});
8 changes: 4 additions & 4 deletions client/app/queue/docketChange/docketChangeRoutes.js
Expand Up @@ -7,19 +7,19 @@ import TASK_ACTIONS from '../../../constants/TASK_ACTIONS';
const PageRoutes = [
<PageRoute
path={`/queue/appeals/:appealId/tasks/:taskId/${
TASK_ACTIONS.DOCKET_CHANGE_SEND_TO_JUDGE.value
TASK_ACTIONS.DOCKET_SWITCH_SEND_TO_JUDGE.value
}`}
title={`${TASK_ACTIONS.DOCKET_CHANGE_SEND_TO_JUDGE.label} | Caseflow`}
title={`${TASK_ACTIONS.DOCKET_SWITCH_SEND_TO_JUDGE.label} | Caseflow`}
>
{/* Replace with actual component */}
<h2>Send to Judge</h2>
</PageRoute>,

<PageRoute
path={`/queue/appeals/:appealId/tasks/:taskId/${
TASK_ACTIONS.DOCKET_CHANGE_JUDGE_RULING.value
TASK_ACTIONS.DOCKET_SWITCH_JUDGE_RULING.value
}`}
title={`${TASK_ACTIONS.DOCKET_CHANGE_JUDGE_RULING.label} | Caseflow`}
title={`${TASK_ACTIONS.DOCKET_SWITCH_JUDGE_RULING.label} | Caseflow`}
>
{/* Replace with actual component */}
<h2>Judge Ruling</h2>
Expand Down
6 changes: 3 additions & 3 deletions client/constants/TASK_ACTIONS.json
Expand Up @@ -80,15 +80,15 @@
"value": "sign_motion_to_vacate",
"func": "sign_motion_to_vacate_data"
},
"DOCKET_CHANGE_SEND_TO_JUDGE": {
"DOCKET_SWITCH_SEND_TO_JUDGE": {
"label": "Send to Judge",
"value": "docket_change/recommend"
},
"DOCKET_CHANGE_JUDGE_RULING": {
"DOCKET_SWITCH_JUDGE_RULING": {
"label": "Send to Judge",
"value": "docket_change/ruling"
},
"DOCKET_CHANGE_CHECKOUT": {
"DOCKET_SWITCH_CHECKOUT": {
"label": "Send to Judge",
"value": "docket_change/checkout/review"
},
Expand Down

0 comments on commit f10fb43

Please sign in to comment.