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

Release R2.3.0 FY24Q4.3.0 #22517

Merged
merged 6 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
65 changes: 42 additions & 23 deletions app/queries/appeals_ready_for_distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,52 +44,71 @@ 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|
veteran_name = FullName.new(appeal["snamef"], nil, appeal["snamel"]).to_s
vlj_name = FullName.new(appeal["vlj_namef"], nil, appeal["vlj_namel"]).to_s
hearing_judge = vlj_name.empty? ? nil : vlj_name
appeal_affinity = AppealAffinity.find_by(case_id: appeal["bfkey"], case_type: "VACOLS::Case")

{
docket_number: appeal["tinum"],
docket: sym.to_s,
aod: appeal["aod"] == 1,
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: hearing_judge,
veteran_file_number: appeal["ssn"] || appeal["bfcorlid"],
veteran_name: veteran_name,
affinity_start_date: appeal_affinity&.affinity_start_date
}
build_appeal_row(appeal, sym)
end
end

def self.build_appeal_row(appeal, sym)
veteran_name = format_veteran_name(appeal["snamef"], appeal["snamel"])
hearing_judge = format_vlj_name(appeal["vlj_namef"], appeal["vlj_namel"])
appeal_affinity = fetch_affinity_start_date(appeal["bfkey"])

{
docket_number: appeal["tinum"],
docket: sym.to_s,
aod: appeal["aod"] == 1,
cavc: appeal["cavc"] == 1,
receipt_date: appeal["bfd19"],
ready_for_distribution_at: appeal["bfdloout"],
target_distro_date: target_distro_date(appeal["bfd19"], sym),
days_before_goal_date: days_before_goal_date(appeal["bfd19"], sym),
hearing_judge: hearing_judge,
original_judge: legacy_original_deciding_judge(appeal),
veteran_file_number: appeal["ssn"] || appeal["bfcorlid"],
veteran_name: veteran_name,
affinity_start_date: appeal_affinity
}
end

def self.format_vlj_name(first_name, last_name)
name = FullName.new(first_name, nil, last_name).to_s
name.empty? ? nil : name
end

def self.format_veteran_name(first_name, last_name)
FullName.new(first_name, nil, last_name).to_s
end

def self.fetch_affinity_start_date(case_id)
appeal_affinity = AppealAffinity.find_by(case_id: case_id, case_type: "VACOLS::Case")
appeal_affinity&.affinity_start_date
end

def self.ama_rows(appeals, docket, sym)
appeals.map do |appeal|
# This comes from the DistributionTask's assigned_at date
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,
veteran_file_number: appeal.veteran_file_number,
veteran_name: appeal.veteran&.name.to_s,
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
Loading
Loading