Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…fairs/caseflow into feature/APPEALS-43179
  • Loading branch information
craigrva committed Aug 22, 2024
2 parents 7e2af42 + 6dd9870 commit 2b84666
Show file tree
Hide file tree
Showing 26 changed files with 845 additions and 244 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
KNAPSACK_PRO_LOG_LEVEL: info
KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN: "spec/seeds/**/*_spec.rb"
WD_INSTALL_DIR: .webdrivers
CI: true
REDIS_URL_CACHE: redis://redis:6379/0/cache/
Expand Down Expand Up @@ -125,7 +126,7 @@ jobs:
- name: Install Chrome
run: |
apt-get update
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_127.0.6533.119-1_amd64.deb \
&& apt install -y /tmp/chrome.deb \
&& rm /tmp/chrome.deb
echo "Chrome exe name: $(ls /usr/bin | chrome)"
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/intakes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def intake_ui_hash
{ unread_messages: unread_messages? }
end

# rubocop:disable Metrics/AbcSize
def feature_toggle_ui_hash
{
useAmaActivationDate: FeatureToggle.enabled?(:use_ama_activation_date, user: current_user),
Expand All @@ -160,9 +161,11 @@ def feature_toggle_ui_hash
updatedAppealForm: FeatureToggle.enabled?(:updated_appeal_form, user: current_user),
hlrScUnrecognizedClaimants: FeatureToggle.enabled?(:hlr_sc_unrecognized_claimants, user: current_user),
vhaClaimReviewEstablishment: FeatureToggle.enabled?(:vha_claim_review_establishment, user: current_user),
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user),
removeCompAndPenIntake: FeatureToggle.enabled?(:remove_comp_and_pen_intake, user: current_user)
}
end
# rubocop:enable Metrics/AbcSize

def user_information_ui_hash
{
Expand Down
114 changes: 74 additions & 40 deletions app/controllers/issues_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class IssuesController < ApplicationController
handle_non_critical_error("issues", e)
end

# rubocop:disable Layout/LineLength
def create
return record_not_found unless appeal

Expand All @@ -27,21 +26,24 @@ def create
if convert_to_bool(create_params[:mst_status]) ||
convert_to_bool(create_params[:pact_status])
issue_in_caseflow = appeal.issues.find { |iss| iss.vacols_sequence_id == issue.issseq.to_i }
create_legacy_issue_update_task(issue_in_caseflow) if FeatureToggle.enabled?(:legacy_mst_pact_identification, user: RequestStore[:current_user])
create_legacy_issue_update_task(issue_in_caseflow) if FeatureToggle.enabled?(
:legacy_mst_pact_identification, user: RequestStore[:current_user]
)
end

render json: { issues: json_issues }, status: :created
end
# rubocop:enable Layout/LineLength

# rubocop:disable Layout/LineLength, Metrics/AbcSize
# rubocop:disable Metrics/AbcSize
def update
return record_not_found unless appeal

issue = appeal.issues.find { |iss| iss.vacols_sequence_id == params[:vacols_sequence_id].to_i }
if issue.mst_status != convert_to_bool(params[:issues][:mst_status]) ||
issue.pact_status != convert_to_bool(params[:issues][:pact_status])
create_legacy_issue_update_task(issue) if FeatureToggle.enabled?(:legacy_mst_pact_identification, user: RequestStore[:current_user])
create_legacy_issue_update_task(issue) if FeatureToggle.enabled?(
:legacy_mst_pact_identification, user: RequestStore[:current_user]
)
end

Issue.update_in_vacols!(
Expand All @@ -55,7 +57,7 @@ def update

render json: { issues: json_issues }, status: :ok
end
# rubocop:enable Layout/LineLength, Metrics/AbcSize
# rubocop:enable Metrics/AbcSize

def destroy
return record_not_found unless appeal
Expand All @@ -69,10 +71,7 @@ def destroy

private

# rubocop:disable Layout/LineLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
def create_legacy_issue_update_task(issue)
user = current_user

# close out any tasks that might be open
open_issue_task = Task.where(
assigned_to: SpecialIssueEditTeam.singleton
Expand All @@ -83,63 +82,98 @@ def create_legacy_issue_update_task(issue)
appeal: appeal,
parent: appeal.root_task,
assigned_to: SpecialIssueEditTeam.singleton,
assigned_by: user,
completed_by: user
assigned_by: current_user,
completed_by: current_user
)
task_instructions_helper(issue, task)
end

# rubocop:disable Metrics/MethodLength
def task_instructions_helper(issue, task)
# set up data for added or edited issue depending on the params action
disposition = issue.readable_disposition.nil? ? "N/A" : issue.readable_disposition
change_category = (params[:action] == "create") ? "Added Issue" : "Edited Issue"
updated_mst_status = convert_to_bool(params[:issues][:mst_status]) unless params[:action] == "create"
updated_pact_status = convert_to_bool(params[:issues][:pact_status]) unless params[:action] == "create"
instruction_params = {
issue: issue,
task: task,
updated_mst_status: updated_mst_status,
updated_pact_status: updated_pact_status,
change_category: change_category
}
format_instructions(instruction_params)

# create SpecialIssueChange record to log the changes
SpecialIssueChange.create!(
issue_id: issue.id,
appeal_id: appeal.id,
appeal_type: "LegacyAppeal",
task_id: task.id,
created_at: Time.zone.now.utc,
created_by_id: current_user.id,
created_by_css_id: current_user.css_id,
original_mst_status: issue.mst_status,
original_pact_status: issue.pact_status,
updated_mst_status: updated_mst_status,
updated_pact_status: updated_pact_status,
change_category: change_category
)
end

# formats and saves task instructions
# rubocop:disable Metrics/AbcSize
# :reek:FeatureEnvy
def format_instructions(inst_params)
note = params[:issues][:note].nil? ? "N/A" : params[:issues][:note]
# use codes from params to get descriptions
# opting to use params vs issue model to capture in-flight issue changes
program_code = params[:issues][:program]
issue_code = params[:issues][:issue]
level_1_code = params[:issues][:level_1]

# line up param codes to their descriptions
param_issue = Constants::ISSUE_INFO[program_code]
iss = param_issue["levels"][issue_code]["description"] unless issue_code.nil?
level_1_description = level_1_code.nil? ? "N/A" : param_issue["levels"][issue_code]["levels"][level_1_code]["description"]

issue_code_message = build_issue_code_message(issue_code, param_issue)

# format the task instructions and close out
set = CaseTimelineInstructionSet.new(
change_type: change_category,
change_type: inst_params[:change_category],
issue_category: [
"Benefit Type: #{param_issue['description']}\n",
"Issue: #{iss}\n",
"Code: #{[level_1_code, level_1_description].join(' - ')}\n",
"Note: #{note}\n",
"Disposition: #{disposition}\n"
"Code: #{issue_code_message}\n",
"Note: #{note}\n"
].compact.join("\r\n"),
benefit_type: "",
original_mst: issue.mst_status,
original_pact: issue.pact_status,
edit_mst: updated_mst_status,
edit_pact: updated_pact_status
)
task.format_instructions(set)
task.completed!
# create SpecialIssueChange record to log the changes
SpecialIssueChange.create!(
issue_id: issue.id,
appeal_id: appeal.id,
appeal_type: "LegacyAppeal",
task_id: task.id,
created_at: Time.zone.now.utc,
created_by_id: user.id,
created_by_css_id: user.css_id,
original_mst_status: issue.mst_status,
original_pact_status: issue.pact_status,
updated_mst_status: updated_mst_status,
updated_pact_status: updated_pact_status,
change_category: change_category
original_mst: inst_params[:issue].mst_status,
original_pact: inst_params[:issue].pact_status,
edit_mst: inst_params[:updated_mst_status],
edit_pact: inst_params[:updated_pact_status]
)
inst_params[:task].format_instructions(set)
inst_params[:task].completed!
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize

# builds issue code on IssuesUpdateTask for MST/PACT changes
def build_issue_code_message(issue_code, param_issue)
level_1_code = params[:issues][:level_1]
diagnostic_code = params[:issues][:level_2]

# use diagnostic code message if it exists
if !diagnostic_code.blank?
diagnostic_description = Constants::DIAGNOSTIC_CODE_DESCRIPTIONS[diagnostic_code]["staff_description"]
[diagnostic_code, diagnostic_description].join(" - ")
# use level 1 message if it exists
elsif !level_1_code.blank?
level_1_description = param_issue["levels"][issue_code]["levels"][level_1_code]["description"]
[level_1_code, level_1_description].join(" - ")
# return N/A if none exist
else
"N/A"
end
end
# rubocop:enable Layout/LineLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity

def convert_to_bool(status)
status == "Y"
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/dispatch_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
##
# rubocop:disable Rails/ApplicationMailer
class DispatchMailer < ActionMailer::Base
default from: "Board of Veterans' Appeals <BoardofVeteransAppealsHearings@messages.va.gov>"
default from: "Board of Veterans' Appeals <BoardofVeteransAppealsDecisions@messages.va.gov>"
layout "dispatch_mailer"
helper VirtualHearings::LinkHelper

Expand Down
6 changes: 1 addition & 5 deletions app/models/distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

class Distribution < CaseflowRecord
include ActiveModel::Serializers::JSON
if FeatureToggle.enabled?(:acd_distribute_by_docket_date, user: RequestStore.store[:current_user])
include ByDocketDateDistribution
else
include AutomaticCaseDistribution
end
include ByDocketDateDistribution

has_many :distributed_cases
belongs_to :judge, class_name: "User"
Expand Down
3 changes: 0 additions & 3 deletions app/models/request_issues_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@ def validate_before_perform
if !changes?
@error_code = :no_changes
elsif RequestIssuesUpdate.where(review: review).where.not(id: id).processable.exists?
if @error_code == :no_changes
RequestIssuesUpdate.where(review: review).where.not(id: id).processable.last.destroy
end
@error_code = :previous_update_not_done_processing
end

Expand Down
16 changes: 8 additions & 8 deletions app/queries/appeals_ready_for_distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ def self.ready_appeals
.flat_map do |sym, docket|
appeals = docket.ready_to_distribute_appeals
if sym == :legacy
legacy_rows(appeals, docket, sym)
legacy_rows(appeals, sym)
else
ama_rows(appeals, docket, sym)
end
end
end

def self.legacy_rows(appeals, docket, sym)
def self.legacy_rows(appeals, sym)
appeals.map do |appeal|
vlj_name = FullName.new(appeal["vlj_namef"], nil, appeal["vlj_namel"]).to_s
appeal_affinity = AppealAffinity.find_by(case_id: appeal["bfkey"], case_type: "VACOLS::Case")

{
Expand All @@ -64,9 +63,9 @@ def self.legacy_rows(appeals, docket, sym)
cavc: appeal["cavc"] == 1,
receipt_date: appeal["bfd19"],
ready_for_distribution_at: appeal["bfdloout"],
target_distro_date: target_distro_date(appeal["bfd19"], docket),
days_before_goal_date: days_before_goal_date(appeal["bfd19"], docket),
hearing_judge: vlj_name.empty? ? nil : vlj_name,
target_distro_date: "N/A",
days_before_goal_date: "N/A",
hearing_judge: FullName.new(appeal["vlj_namef"], nil, appeal["vlj_namel"]).to_s,
original_judge: appeal["prev_deciding_judge"].nil? ? nil : legacy_original_deciding_judge(appeal),
veteran_file_number: appeal["ssn"] || appeal["bfcorlid"],
veteran_name: FullName.new(appeal["snamef"], nil, appeal["snamel"]).to_s,
Expand All @@ -81,15 +80,16 @@ def self.ama_rows(appeals, docket, sym)
ready_for_distribution_at = distribution_task_query(appeal)
# only look for hearings that were held
hearing_judge = with_held_hearings(appeal)
priority_appeal = appeal.aod || appeal.cavc
{
docket_number: appeal.docket_number,
docket: sym.to_s,
aod: appeal.aod,
cavc: appeal.cavc,
receipt_date: appeal.receipt_date,
ready_for_distribution_at: ready_for_distribution_at,
target_distro_date: target_distro_date(appeal.receipt_date, docket),
days_before_goal_date: days_before_goal_date(appeal.receipt_date, docket),
target_distro_date: priority_appeal ? "N/A" : target_distro_date(appeal.receipt_date, docket),
days_before_goal_date: priority_appeal ? "N/A" : days_before_goal_date(appeal.receipt_date, docket),
hearing_judge: hearing_judge,
original_judge: appeal.cavc? ? ama_cavc_original_deciding_judge(appeal) : nil,
veteran_file_number: appeal.veteran_file_number,
Expand Down
1 change: 1 addition & 0 deletions client/COPY.json
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@
"INTAKE_EDIT_ISSUE_BENEFIT_TYPE": "Benefit type: ",
"INTAKE_EDIT_ISSUE_DECISION_DATE": "Decision date: ",
"INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT": "Only VHA team members can establish Higher Level Reviews and Supplemental Claims with VHA issues. If you have a VHA claim, please return the packet to the main “VHA” queue in the Centralized Mail Portal or send downloaded documents to %s.",
"INTAKE_REMOVE_COMP_AND_PEN": "Higher Level Reviews and Supplemental Claims with Compensation and Pension & Survivor's Benefits are now handled through VBMS and are no longer established through Caseflow",
"VHA_BENEFIT_EMAIL_ADDRESS": "VHABENEFITAPPEALS@va.gov",
"VHA_CAREGIVER_SUPPORT_EMAIL_ADDRESS": "VHA.CSPAppeals@va.gov",
"VHA_PAYMENT_OPERATIONS_EMAIL_ADDRESS": "VHA10D1B3R2Appeals@va.gov",
Expand Down
4 changes: 3 additions & 1 deletion client/app/intake/components/BenefitType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ export default class BenefitType extends React.PureComponent {
// If the feature toggle is off then all users should be able to select vha
const canSelectVhaBenefit = featureToggles.vhaClaimReviewEstablishment ? userCanSelectVha : true;

const canSelectCompAndPen = !featureToggles.removeCompAndPenIntake;

return <div className="cf-benefit-type" style={{ marginTop: '10px' }} >
<RadioField
name="benefit-type-options"
label="What is the Benefit Type?"
strongLabel
vertical
options={formatBenefitTypeRadioOptions(BENEFIT_TYPES, canSelectVhaBenefit)}
options={formatBenefitTypeRadioOptions(BENEFIT_TYPES, canSelectVhaBenefit, canSelectCompAndPen)}
onChange={onChange}
value={value}
errorMessage={errorMessage}
Expand Down
22 changes: 18 additions & 4 deletions client/app/intake/components/IssueList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ const nonEditableIssueStyling = css({
});

export default class IssuesList extends React.Component {
generateIssueActionOptions = (issue, userCanWithdrawIssues, userCanEditIntakeIssues, isDtaError, docketType) => {
/* eslint-disable max-params */
generateIssueActionOptions = (
issue,
userCanWithdrawIssues,
userCanEditIntakeIssues,
isDtaError,
docketType,
formType
) => {
let options = [];

if (issue.correctionType && issue.endProductCleared) {
Expand All @@ -38,7 +46,7 @@ export default class IssuesList extends React.Component {
{ label: 'Remove issue',
value: 'remove' }
);
if (userCanEditIntakeIssues) {
if (userCanEditIntakeIssues && (formType === FORM_TYPES.APPEAL.key)) {
options.push(
{ label: 'Edit issue',
value: 'edit' }
Expand All @@ -60,7 +68,7 @@ export default class IssuesList extends React.Component {
value: 'remove' }
);
}
if (userCanEditIntakeIssues) {
if (userCanEditIntakeIssues && (formType === FORM_TYPES.APPEAL.key)) {
options.push(
{ label: 'Edit issue',
value: 'edit' }
Expand All @@ -84,6 +92,7 @@ export default class IssuesList extends React.Component {
value: 'requestWithdrawal' }
);
}
/* eslint-enable max-params */

const isIssueWithdrawn = issue.withdrawalDate || issue.withdrawalPending;

Expand Down Expand Up @@ -127,7 +136,12 @@ export default class IssuesList extends React.Component {
editableIssueProperties);

const issueActionOptions = this.generateIssueActionOptions(
issue, userCanWithdrawIssues, userCanEditIntakeIssues, intakeData.isDtaError, intakeData.docketType
issue,
userCanWithdrawIssues,
userCanEditIntakeIssues,
intakeData.isDtaError,
intakeData.docketType,
formType
);

const isIssueWithdrawn = issue.withdrawalDate || issue.withdrawalPending;
Expand Down
Loading

0 comments on commit 2b84666

Please sign in to comment.