From 5453d67c3c31dbcd3e63a18fa6f12a7831e891ec Mon Sep 17 00:00:00 2001 From: cacevesva <109166981+cacevesva@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:04:06 -0700 Subject: [PATCH 001/203] Legacy appeal fix (#18449) Co-authored-by: Maite Piedra Yera --- app/models/tasks/distribution_task.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/tasks/distribution_task.rb b/app/models/tasks/distribution_task.rb index ce02e513ed4..d3baf187191 100644 --- a/app/models/tasks/distribution_task.rb +++ b/app/models/tasks/distribution_task.rb @@ -33,7 +33,11 @@ def available_actions(user) end def special_case_movement_task(user) - SpecialCaseMovementTeam.singleton.user_has_access?(user) && appeal.ready_for_distribution? + if appeal.is_a?(Appeal) + SpecialCaseMovementTeam.singleton.user_has_access?(user) && appeal.ready_for_distribution? + else + SpecialCaseMovementTeam.singleton.user_has_access?(user) + end end def blocked_special_case_movement(user) From d65d3e321ce106c4f6f52ef0edbc0d5ad496a27a Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Tue, 18 Apr 2023 15:00:10 -0500 Subject: [PATCH 002/203] VLJ legacy appeals feature toggle (#18462) --- app/views/queue/index.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/queue/index.html.erb b/app/views/queue/index.html.erb index 88b5f34ca42..9a3e719d088 100644 --- a/app/views/queue/index.html.erb +++ b/app/views/queue/index.html.erb @@ -52,7 +52,8 @@ split_appeal_workflow: FeatureToggle.enabled?(:split_appeal_workflow, user: current_user), cavc_remand_granted_substitute_appellant: FeatureToggle.enabled?(:cavc_remand_granted_substitute_appellant, user: current_user), cavc_dashboard_workflow: FeatureToggle.enabled?(:cavc_dashboard_workflow, user: current_user), - cc_appeal_workflow: FeatureToggle.enabled?(:cc_appeal_workflow, user: current_user) - } + cc_appeal_workflow: FeatureToggle.enabled?(:cc_appeal_workflow, user: current_user), + vlj_legacy_appeal: FeatureToggle.enabled?(:vlj_legacy_appeal, user: current_user) +} }) %> <% end %> From a2cae46b2d68de84fe7e37764aab7fa5ac819ffe Mon Sep 17 00:00:00 2001 From: MuhGrayVA <98366428+MuhGrayVA@users.noreply.github.com> Date: Thu, 20 Apr 2023 12:50:18 -0400 Subject: [PATCH 003/203] Matt g/appeals 19796 task action case movement (#18475) * APPEALS-19796 Added logic to check if appeal is a legacy appeal and added new logic to check if said legacy appeal is not ready for distribution * APPEALS-19796 Code Climate fixes * APPEALS-19796 Updated spec coverage --- app/models/tasks/distribution_task.rb | 13 ++++++++++--- client/constants/TASK_ACTIONS.json | 5 +++++ spec/models/tasks/distribution_task_spec.rb | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/app/models/tasks/distribution_task.rb b/app/models/tasks/distribution_task.rb index d3baf187191..a699c0bde04 100644 --- a/app/models/tasks/distribution_task.rb +++ b/app/models/tasks/distribution_task.rb @@ -21,7 +21,11 @@ def actions_available?(user) def available_actions(user) return [] unless user - if special_case_movement_task(user) + if !appeal.is_a?(Appeal) + if !any_active_distribution_task_legacy() + return [Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h] + end + elsif special_case_movement_task(user) return [Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT.to_h] elsif SpecialCaseMovementTeam.singleton.user_has_access?(user) && blocked_special_case_movement(user) return [Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT.to_h] @@ -32,11 +36,14 @@ def available_actions(user) [] end + def any_active_distribution_task_legacy() + tasks = Task.where(appeal_type: "LegacyAppeal", appeal_id: appeal.id) + tasks.active.of_type(:DistributionTask).any? + end + def special_case_movement_task(user) if appeal.is_a?(Appeal) SpecialCaseMovementTeam.singleton.user_has_access?(user) && appeal.ready_for_distribution? - else - SpecialCaseMovementTeam.singleton.user_has_access?(user) end end diff --git a/client/constants/TASK_ACTIONS.json b/client/constants/TASK_ACTIONS.json index 5849e3ffcc6..6f359f67f8d 100644 --- a/client/constants/TASK_ACTIONS.json +++ b/client/constants/TASK_ACTIONS.json @@ -236,6 +236,11 @@ "value": "distribute_to_judge", "func": "blocked_special_case_movement_data" }, + "BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY": { + "label": "Case Movement: Cancel blocking tasks and advance to judge", + "value": "distribute_to_judge", + "func": "blocked_special_case_movement_data" + }, "TOGGLE_TIMED_HOLD": { "func": "toggle_timed_hold" }, diff --git a/spec/models/tasks/distribution_task_spec.rb b/spec/models/tasks/distribution_task_spec.rb index 9605a1e23d3..377c2139648 100644 --- a/spec/models/tasks/distribution_task_spec.rb +++ b/spec/models/tasks/distribution_task_spec.rb @@ -5,12 +5,22 @@ let(:scm_user) { create(:user) } let(:scm_org) { SpecialCaseMovementTeam.singleton } let(:root_task) { create(:root_task) } + let(:legacy_appeal) { create(:legacy_appeal, :with_schedule_hearing_tasks) } + let(:root_task_legacy) { create(:root_task, :legacy_appeal) } let(:distribution_task) do DistributionTask.create!( appeal: root_task.appeal, assigned_to: Bva.singleton ) end + let(:distribution_task_legacy) do + DistributionTask.create!( + appeal: root_task_legacy.appeal, + assigned_to: Bva.singleton + ) + end + + let(:distribution_task_legacy) { legacy_appeal.tasks.find { |task| task.type == "DistributionTask" } } before do MailTeam.singleton.add_user(user) @@ -61,6 +71,10 @@ ) end end + + it "with legacy case" do + expect(distribution_task.available_actions(scm_user).count).to eq(1) + end end describe ".actions_available?" do From 1264337265b4e9214d96abf3c6a392cf8e3cf35f Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Fri, 21 Apr 2023 13:47:55 -0500 Subject: [PATCH 004/203] Create Reassign Case page (#18491) --- app/repositories/task_action_repository.rb | 8 + .../queue/BlockedAdvanceToJudgeLegacyView.jsx | 302 ++++++++++++++++++ client/app/queue/QueueApp.jsx | 13 + client/app/queue/components/QueueFlowPage.jsx | 8 +- client/constants/TASK_ACTIONS.json | 4 +- 5 files changed, 330 insertions(+), 5 deletions(-) create mode 100644 client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx diff --git a/app/repositories/task_action_repository.rb b/app/repositories/task_action_repository.rb index fa4618f832e..74dc16a077e 100644 --- a/app/repositories/task_action_repository.rb +++ b/app/repositories/task_action_repository.rb @@ -528,6 +528,14 @@ def blocked_special_case_movement_data(task, _user = nil) } end + def blocked_special_case_movement_data_legacy(task, _user = nil) + { + options: users_to_options(Judge.list_all), + type: BlockedSpecialCaseMovementTask.name, + blocking_tasks: task.visible_blocking_tasks.map(&:serialize_for_cancellation) + } + end + def toggle_timed_hold(task, user) action = Constants.TASK_ACTIONS.PLACE_TIMED_HOLD.to_h action = Constants.TASK_ACTIONS.END_TIMED_HOLD.to_h if task.on_timed_hold? diff --git a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx new file mode 100644 index 00000000000..57cf715687f --- /dev/null +++ b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx @@ -0,0 +1,302 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import { withRouter } from 'react-router-dom'; +import { sprintf } from 'sprintf-js'; +import { css } from 'glamor'; + +import COPY from '../../COPY'; + +import { onReceiveAmaTasks } from './QueueActions'; +import { requestSave, resetSuccessMessages, highlightInvalidFormItems } from './uiReducer/uiActions'; +import { taskActionData } from './utils'; +import { taskById, appealWithDetailSelector } from './selectors'; + +import QueueFlowPage from './components/QueueFlowPage'; +import SearchableDropdown from '../components/SearchableDropdown'; +import TextareaField from '../components/TextareaField'; +import RadioField from '../components/RadioField'; +import Modal from '../components/Modal'; +import Alert from '../components/Alert'; + +const ADVANCEMENT_REASONS = [ + 'Death dismissal', + 'Withdrawal', + 'Medical', + 'Other' +]; + +const caseInfoStyling = css({ + '& span': { marginRight: '30px' } +}); + +const bottomBorderStyling = css({ + borderBottom: '.1rem solid lightgray', + paddingBottom: '15px', + marginBottom: '15px' +}); + +const bottomMarginStyling = css({ + marginBottom: '1.6rem' +}); + +class BlockedAdvanceToJudgeLegacyView extends React.Component { + constructor(props) { + super(props); + + this.state = { + cancellationInstructions: '', + error: null, + instructions: '', + selectedAssignee: null, + selectedReason: null, + showModal: false, + isRadioButtonSelected: false, + isTextFieldSelected: false + }; + } + + componentDidMount = () => this.props.resetSuccessMessages(); + + validAssignee = () => this.state.selectedAssignee !== null; + validInstructions = () => this.state.instructions.length > 0; + validCancellationInstructions = () => this.state.cancellationInstructions.length > 0; + validReason = () => this.state.selectedReason !== null; + + validatePage = () => this.validCancellationInstructions() && this.validReason(); + validateModal = () => this.validInstructions() && this.validAssignee(); + + goToNextStep = () => this.setState({ showModal: true }); + + actionData = () => taskActionData(this.props); + + getAssigneeLabel = () => { + let assignee = 'person'; + + this.actionData().options.forEach((opt) => { + if (opt.value === this.state.selectedAssignee) { + assignee = opt.label; + } + }); + + return assignee; + }; + + submit = () => { + if (!this.validateModal()) { + this.props.highlightInvalidFormItems(true); + + return; + } + + const { appeal, task } = this.props; + + const payload = { + data: { + tasks: [ + { + type: this.actionData().type, + external_id: appeal.externalId, + parent_id: task.taskId, + assigned_to_id: this.state.selectedAssignee, + assigned_to_type: 'User', + instructions: [ + `${this.state.selectedReason}: ${this.state.cancellationInstructions}`, + this.state.instructions + ] + } + ] + } + }; + + const successMessage = { + title: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE, this.getAssigneeLabel()), + detail: this.actionData().message_detail + }; + + return this.props. + requestSave('/tasks', payload, successMessage). + then((resp) => { + this.props.history.replace(`/queue/appeals/${appeal.externalId}`); + this.props.onReceiveAmaTasks(resp.body.tasks.data); + }). + catch((err) => { + this.setState({ + error: { + title: sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_ERROR_TITLE, this.getAssigneeLabel()), + details: JSON.parse(err?.message)?.errors[0]?.detail + } + }); + }); + }; + + blockingTaskListItem = (blockingTask) => +
  • {blockingTask.type} - assigned to: {this.blockingTaskAssigneeLink(blockingTask)}
  • ; + + blockingTaskAssigneeLink = (blockingTask) => { + const { appeal } = this.props; + + if (blockingTask.assigned_to_email) { + const body = `Case Link: ${window.location.origin}/queue/appeals/${appeal.externalId}`, + emailAddress = blockingTask.assigned_to_email, + subject = `${blockingTask.type}: ${appeal.veteranFullName}`; + + return {blockingTask.assigned_to_name}; + } + + return blockingTask.assigned_to_name; + } + + modalAlert = () => { + if (!this.state.error) { + return; + } + + return {this.state.error.details}; + } + + warningModal = () => { + if (!this.state.showModal) { + return; + } + + const { highlightFormItems } = this.props; + + const options = this.actionData().options; + const selectedJudgeName = this.getAssigneeLabel() || 'judge'; + + return
    + this.setState({ showModal: false }) + }, { + classNames: ['usa-button-secondary', 'usa-button-hover', 'usa-button-warning'], + name: COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_SUBMIT, + onClick: this.submit + }]} + closeHandler={() => this.setState({ showModal: false })} + icon="warning" + > + {this.modalAlert()} +
    + Please Note: {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}
    + Cancellation of task(s) are final. +
    +

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_JUDGE_HEADER}

    + this.setState({ selectedAssignee: option ? option.value : null })} + options={options} + /> +

    {sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_INSTRUCTIONS_HEADER, selectedJudgeName)}

    + this.setState({ instructions: value })} + value={this.state.instructions} + /> +
    +
    ; + } + + render = () => { + const { highlightFormItems, appeal } = this.props; + + const blockingTasks = this.actionData().blocking_tasks; + + return + {this.warningModal()} + +

    {sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TITLE, appeal.veteranFullName)}

    +
    + Veteran ID: {appeal.veteranFileNumber} + Task: Reassign +
    +
    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}
    +

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER}

    +
      {blockingTasks.map((blockingTask) => this.blockingTaskListItem(blockingTask))}
    +

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER}

    + { + return { displayText: reason, value: reason }; + })} + id="advancementReason" + value={this.state.selectedReason} + onChange={(value) => this.setState({ selectedReason: value, isRadioButtonSelected: true })} + vertical={false} + /> + this.setState({ cancellationInstructions: value, isTextFieldSelected: true })} + value={this.state.cancellationInstructions} + /> +
    +
    ; + }; +} + +BlockedAdvanceToJudgeLegacyView.propTypes = { + appeal: PropTypes.shape({ + externalId: PropTypes.string, + id: PropTypes.string, + veteranFullName: PropTypes.string, + veteranFileNumber: PropTypes.string, + }), + highlightInvalidFormItems: PropTypes.func, + highlightFormItems: PropTypes.bool, + history: PropTypes.object, + onReceiveAmaTasks: PropTypes.func, + requestSave: PropTypes.func, + resetSuccessMessages: PropTypes.func, + task: PropTypes.shape({ + instructions: PropTypes.string, + taskId: PropTypes.string + }) +}; + +const mapStateToProps = (state, ownProps) => { + return { + highlightFormItems: state.ui.highlightFormItems, + task: taskById(state, { taskId: ownProps.taskId }), + appeal: appealWithDetailSelector(state, ownProps) + }; +}; + +const mapDispatchToProps = (dispatch) => + bindActionCreators( + { + requestSave, + onReceiveAmaTasks, + resetSuccessMessages, + highlightInvalidFormItems + }, + dispatch + ); + +export default withRouter( + connect( + mapStateToProps, + mapDispatchToProps + )(BlockedAdvanceToJudgeLegacyView) +); diff --git a/client/app/queue/QueueApp.jsx b/client/app/queue/QueueApp.jsx index cb95aa5a2fa..3e7810ba1ea 100644 --- a/client/app/queue/QueueApp.jsx +++ b/client/app/queue/QueueApp.jsx @@ -41,6 +41,7 @@ import TeamAssignTaskListView from './TeamAssignTaskListView'; import EvaluateDecisionView from './caseEvaluation/EvaluateDecisionView'; import AddColocatedTaskView from './colocatedTasks/AddColocatedTaskView'; import BlockedAdvanceToJudgeView from './BlockedAdvanceToJudgeView'; +import BlockedAdvanceToJudgeLegacyView from './BlockedAdvanceToJudgeLegacyView'; import AddCavcRemandView from './cavc/AddCavcRemandView'; import AddCavcDatesModal from './cavc/AddCavcDatesModal'; import CompleteTaskModal from './components/CompleteTaskModal'; @@ -272,6 +273,10 @@ class QueueApp extends React.PureComponent { ); + routedBlockedCaseMovementLegacy = (props) => ( + + ); + routedAddCavcRemand = (props) => ( ); @@ -832,6 +837,14 @@ class QueueApp extends React.PureComponent { render={this.routedBlockedCaseMovement} /> + + { diff --git a/client/constants/TASK_ACTIONS.json b/client/constants/TASK_ACTIONS.json index 6f359f67f8d..299a22f6006 100644 --- a/client/constants/TASK_ACTIONS.json +++ b/client/constants/TASK_ACTIONS.json @@ -238,8 +238,8 @@ }, "BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY": { "label": "Case Movement: Cancel blocking tasks and advance to judge", - "value": "distribute_to_judge", - "func": "blocked_special_case_movement_data" + "value": "distribute_to_judge_legacy", + "func": "blocked_special_case_movement_data_legacy" }, "TOGGLE_TIMED_HOLD": { "func": "toggle_timed_hold" From f3de348847418321e93fe5085d83a552061d3c78 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:19:30 -0500 Subject: [PATCH 005/203] Added Grey Button Functionality (#18494) --- .../queue/BlockedAdvanceToJudgeLegacyView.jsx | 20 ++++++++++++++----- client/app/queue/components/QueueFlowPage.jsx | 8 +++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx index 57cf715687f..a36a4a3e565 100644 --- a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx @@ -52,8 +52,7 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { selectedAssignee: null, selectedReason: null, showModal: false, - isRadioButtonSelected: false, - isTextFieldSelected: false + disableButton: true }; } @@ -83,6 +82,17 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { return assignee; }; + setOnChangeValue = (stateValue, value) => { + this.setState({ [stateValue]: value }, function () { + if ((this.state.selectedReason !== null && this.state.cancellationInstructions !== '')) { + this.setState({ disableButton: false }); + } + if ((this.state.cancellationInstructions === '' && this.state.selectedReason !== null)) { + this.setState({ disableButton: true }); + } + }); + }; + submit = () => { if (!this.validateModal()) { this.props.highlightInvalidFormItems(true); @@ -220,7 +230,7 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { validateForm={this.validatePage} appealId={appeal.externalId} hideCancelButton - isContinueButtonDisabled={!(this.state.isRadioButtonSelected && this.state.isTextFieldSelected)} + disableNext={this.state.disableButton} >

    {sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TITLE, appeal.veteranFullName)}

    @@ -239,7 +249,7 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { })} id="advancementReason" value={this.state.selectedReason} - onChange={(value) => this.setState({ selectedReason: value, isRadioButtonSelected: true })} + onChange={(value) => this.setOnChangeValue('selectedReason', value)} vertical={false} /> this.setState({ cancellationInstructions: value, isTextFieldSelected: true })} + onChange={(value) => this.setOnChangeValue('cancellationInstructions', value)} value={this.state.cancellationInstructions} /> diff --git a/client/app/queue/components/QueueFlowPage.jsx b/client/app/queue/components/QueueFlowPage.jsx index 8ccfd121f77..ce079af1624 100644 --- a/client/app/queue/components/QueueFlowPage.jsx +++ b/client/app/queue/components/QueueFlowPage.jsx @@ -71,7 +71,7 @@ class QueueFlowPage extends React.PureComponent { callback: this.goToNextStep, loading: this.props.savePending, name: 'next-button', - disabled: (this.props.disableNext || this.props.isContinueButtonDisabled), + disabled: this.props.disableNext, displayText: this.props.continueBtnText, loadingText: 'Submitting...', styling: css({ marginLeft: '1rem' }) @@ -206,8 +206,7 @@ QueueFlowPage.propTypes = { showModal: PropTypes.func, hideModal: PropTypes.func, checkoutStagedAppeal: PropTypes.func, - resetDecisionOptions: PropTypes.func, - isContinueButtonDisabled: PropTypes.bool + resetDecisionOptions: PropTypes.func }; QueueFlowPage.defaultProps = { @@ -218,8 +217,7 @@ QueueFlowPage.defaultProps = { goToNextStep: null, goToPrevStep: null, getNextStepUrl: null, - getPrevStepUrl: null, - isContinueButtonDisabled: false + getPrevStepUrl: null }; const mapStateToProps = (state, props) => { From de344e34ed65afe5a5c9866901eb313166533f68 Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Tue, 25 Apr 2023 09:31:11 -0500 Subject: [PATCH 006/203] rspec for Reassign case page (#18501) --- .../special_case_movement_task_legacy_spec.rb | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 spec/feature/queue/special_case_movement_task_legacy_spec.rb diff --git a/spec/feature/queue/special_case_movement_task_legacy_spec.rb b/spec/feature/queue/special_case_movement_task_legacy_spec.rb new file mode 100644 index 00000000000..62829393efe --- /dev/null +++ b/spec/feature/queue/special_case_movement_task_legacy_spec.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +RSpec.feature "SpecialCaseMovementTask", :all_dbs do + let(:scm_user) { create(:user) } + + let(:judge_user) { create(:user) } + let!(:vacols_judge) { create(:staff, :judge_role, sdomainid: judge_user.css_id) } + let!(:judgeteam) { JudgeTeam.create_for_judge(judge_user) } + let(:veteran) { create(:veteran, first_name: "Samuel", last_name: "Purcell") } + let(:ssn) { Generators::Random.unique_ssn } + + let(:appeal) { create(:legacy_appeal, vacols_case: create(:case, bfcorlid: "#{ssn}S")) } + let(:root_task) { create(:root_task, appeal: appeal) } + let(:distribution_task) { create(:distribution_task, parent: root_task) } + + let(:hearing_task) { create(:hearing_task, parent: distribution_task) } + + before do + SpecialCaseMovementTeam.singleton.add_user(scm_user) + User.authenticate!(user: scm_user) + end + describe "Accessing task actions" do + context "With the Appeal in the right state" do + it "successfully assigns the task to judge" do + visit("queue/appeals/#{hearing_task.appeal.external_id}") + dropdown = find(".cf-select__control", text: COPY::TASK_ACTION_DROPDOWN_BOX_LABEL) + dropdown.click + expect(page).to have_content(Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.label) + end + + it "Checking validations on hearing task is cancelled and case assigns to judge" do + visit("/queue") + visit("/queue/appeals/#{hearing_task.appeal.external_id}") + prompt = COPY::TASK_ACTION_DROPDOWN_BOX_LABEL + text = Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.label + click_dropdown(prompt: prompt, text: text) + + # check modal content + expect(page).to have_content(format(COPY::BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE)) + + expect(page).to have_button("Continue", disabled: true) + + page.all(".cf-form-radio-option > label")[1].click + expect(page).to have_button("Continue", disabled: true) + + # fill out instructions + fill_in("cancellationInstructions", with: "instructions") + expect(page).to have_button("Continue", disabled: false) + + # remove instructions in text field + fill_in("cancellationInstructions", with: "") + expect(page).to have_button("Continue", disabled: true) + + click_button "Cancel" + expect(page).to have_content "Currently active tasks" + end + end + end +end From ac210f8f2f57d1d0cddf33f4aaf46e6fe2e6406e Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Tue, 25 Apr 2023 10:37:35 -0400 Subject: [PATCH 007/203] =?UTF-8?q?vinner57/APPEALS-19800=20-=20modal=20ch?= =?UTF-8?q?anges=20with=20regards=20to=20blocked=20advanc=E2=80=A6=20(#184?= =?UTF-8?q?98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * vinner57/APPEALS-19800 - modal changes with regards to blocked advance to judge view page * vinner57/APPEALS-19800 - fixing the lint failures --- client/COPY.json | 2 +- .../queue/BlockedAdvanceToJudgeLegacyView.jsx | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/client/COPY.json b/client/COPY.json index 0e4682cb276..ea31b4b55c5 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -592,7 +592,7 @@ "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE": "This case currently has blocking tasks that will be cancelled to move this case", "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER": "The following task(s) will be cancelled:", "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER": "Please provide reason(s) and context for the cancellation:", - + "BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY_MODAL_TITLE": "Confirm Cancellation", "BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_TITLE": "Confirm Cancellation and Reassign", "BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_WARNING": "To cancel tasks you must select a user to move the case to as well as provide a reason and context for the reassignment below.", "BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_JUDGE_HEADER": "Reassign to", diff --git a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx index a36a4a3e565..2c5bb727a71 100644 --- a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx @@ -52,7 +52,8 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { selectedAssignee: null, selectedReason: null, showModal: false, - disableButton: true + disableButton: true, + modalDisableButton: true }; } @@ -91,6 +92,16 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { this.setState({ disableButton: true }); } }); + } + + setModalOnChangeValue = (stateValue, value) => { + this.setState({ [stateValue]: value }, function () { + if (this.state.selectedAssignee !== null && this.state.instructions !== '') { + this.setState({ modalDisableButton: false }); + } else { + this.setState({ modalDisableButton: true }); + } + }); }; submit = () => { @@ -178,18 +189,18 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { return
    this.setState({ showModal: false }) }, { - classNames: ['usa-button-secondary', 'usa-button-hover', 'usa-button-warning'], + classNames: ['usa-button-hover', 'usa-button-warning'], name: COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_SUBMIT, + disabled: this.state.modalDisableButton, onClick: this.submit }]} closeHandler={() => this.setState({ showModal: false })} - icon="warning" > {this.modalAlert()}
    @@ -203,7 +214,7 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { hideLabel errorMessage={this.props.highlightFormItems && !this.validAssignee() ? COPY.FORM_ERROR_FIELD_REQUIRED : null} value={this.state.selectedAssignee} - onChange={(option) => this.setState({ selectedAssignee: option ? option.value : null })} + onChange={(option) => this.setModalOnChangeValue('selectedAssignee', option ? option.value : null)} options={options} />

    {sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_INSTRUCTIONS_HEADER, selectedJudgeName)}

    @@ -211,7 +222,7 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { required errorMessage={highlightFormItems && !this.validInstructions() ? 'Judge instructions field is required' : null} id="judgeInstructions" - onChange={(value) => this.setState({ instructions: value })} + onChange={(value) => this.setModalOnChangeValue('instructions', value)} value={this.state.instructions} /> From a7e0d46ce81fd1136ebd461317bdae3e5b6d9c43 Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Thu, 27 Apr 2023 12:15:27 -0400 Subject: [PATCH 008/203] =?UTF-8?q?Cancel=20Tasks=20and=20Reassign?= =?UTF-8?q?=E2=80=9D=20button=20functionality=20(#18514)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Cancel Tasks and Reassign” button functionality * update for feature branch and remove function that no need anymore --- client/COPY.json | 6 +++ .../queue/BlockedAdvanceToJudgeLegacyView.jsx | 30 ++++++++---- client/app/queue/CaseDetailsView.jsx | 2 + client/app/queue/CaseTimeline.jsx | 4 +- client/app/queue/TaskSnapshot.jsx | 4 +- client/app/queue/components/TaskRows.jsx | 47 +++++++++++++++++-- client/app/styles/queue/_timeline.scss | 9 ++++ 7 files changed, 88 insertions(+), 14 deletions(-) diff --git a/client/COPY.json b/client/COPY.json index ea31b4b55c5..a16cc63eee8 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -746,6 +746,12 @@ "REASSIGN_TASK_SUCCESS_MESSAGE": "Task reassigned to %s", "HEARING_ASSIGN_TASK_SUCCESS_MESSAGE_DETAIL": "You can continue to assign tasks to yourself and others using this queue.", + "ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ": "You have successfully reassigned %s’s case to %s", + "ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ_MESSAGE_DETAIL": " All blocking task have been cancelled.", + "LEGACY_APPEALS_VLJ_REASON_INTRUCTIONS" : "Reason:", + "LEGACY_APPEALS_VLJ_NEW_JUDGE_INTRUCTIONS" : "New Judge:", + "LEGACY_APPEALS_VLJ_DETAILS_INTRUCTIONS" : "Details:", + "CREATE_MAIL_TASK_TITLE": "Create new mail task", "MAIL_TASK_DROPDOWN_TYPE_SELECTOR_LABEL": "Select correspondence type", "MAIL_TASK_CREATION_SUCCESS_MESSAGE": "Created %s task", diff --git a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx index 2c5bb727a71..175d442b363 100644 --- a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx @@ -61,7 +61,7 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { validAssignee = () => this.state.selectedAssignee !== null; validInstructions = () => this.state.instructions.length > 0; - validCancellationInstructions = () => this.state.cancellationInstructions.length > 0; + validCancellationInstructions = () => this.state.cancellationInstructions.trim().length > 0; validReason = () => this.state.selectedReason !== null; validatePage = () => this.validCancellationInstructions() && this.validReason(); @@ -85,10 +85,10 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { setOnChangeValue = (stateValue, value) => { this.setState({ [stateValue]: value }, function () { - if ((this.state.selectedReason !== null && this.state.cancellationInstructions !== '')) { + if ((this.state.selectedReason !== null && this.state.cancellationInstructions.trim().length > 0)) { this.setState({ disableButton: false }); } - if ((this.state.cancellationInstructions === '' && this.state.selectedReason !== null)) { + if ((this.state.cancellationInstructions.trim().length === 0 && this.state.selectedReason !== null)) { this.setState({ disableButton: true }); } }); @@ -96,7 +96,7 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { setModalOnChangeValue = (stateValue, value) => { this.setState({ [stateValue]: value }, function () { - if (this.state.selectedAssignee !== null && this.state.instructions !== '') { + if (this.state.selectedAssignee !== null && this.state.instructions.trim().length > 0) { this.setState({ modalDisableButton: false }); } else { this.setState({ modalDisableButton: true }); @@ -123,17 +123,28 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { assigned_to_id: this.state.selectedAssignee, assigned_to_type: 'User', instructions: [ - `${this.state.selectedReason}: ${this.state.cancellationInstructions}`, - this.state.instructions + `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions.trim()}`, + `${task.taskId}`, + `${this.state.instructions}` ] } ] } }; + const assignedByListItem = () => { + const assignor = task.assignedBy.firstName ? + this.getAbbrevName(task.assignedBy) : + null; + + return assignor; + }; + const successMessage = { - title: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE, this.getAssigneeLabel()), - detail: this.actionData().message_detail + title: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ, + assignedByListItem(), + this.getAssigneeLabel()), + detail: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ_MESSAGE_DETAIL) }; return this.props. @@ -292,7 +303,8 @@ BlockedAdvanceToJudgeLegacyView.propTypes = { resetSuccessMessages: PropTypes.func, task: PropTypes.shape({ instructions: PropTypes.string, - taskId: PropTypes.string + taskId: PropTypes.string, + assignedBy: PropTypes.string }) }; diff --git a/client/app/queue/CaseDetailsView.jsx b/client/app/queue/CaseDetailsView.jsx index 223e2348691..9950f07b0a1 100644 --- a/client/app/queue/CaseDetailsView.jsx +++ b/client/app/queue/CaseDetailsView.jsx @@ -325,6 +325,7 @@ export const CaseDetailsView = (props) => {
    @@ -416,6 +417,7 @@ export const CaseDetailsView = (props) => { )} diff --git a/client/app/queue/CaseTimeline.jsx b/client/app/queue/CaseTimeline.jsx index efabb253e3d..ffe4c25df7e 100644 --- a/client/app/queue/CaseTimeline.jsx +++ b/client/app/queue/CaseTimeline.jsx @@ -20,6 +20,7 @@ export const CaseTimeline = ({ appeal }) => { editNodDateEnabled={!appeal.isLegacyAppeal && canEditNodDate} timeline statusSplit + VLJ_featureToggles /> @@ -29,5 +30,6 @@ export const CaseTimeline = ({ appeal }) => { CaseTimeline.propTypes = { appeal: PropTypes.object, - statusSplit: PropTypes.bool + statusSplit: PropTypes.bool, + VLJ_featureToggles: PropTypes.string, }; diff --git a/client/app/queue/TaskSnapshot.jsx b/client/app/queue/TaskSnapshot.jsx index 8ca19247998..f04453cccf0 100644 --- a/client/app/queue/TaskSnapshot.jsx +++ b/client/app/queue/TaskSnapshot.jsx @@ -32,6 +32,7 @@ export const TaskSnapshot = ({ appeal, hideDropdown, tasks, showPulacCerulloAler timeline={false} editNodDateEnabled={!appeal.isLegacyAppeal && canEditNodDate} hideDropdown={hideDropdown} + VLJ_featureToggles /> @@ -73,7 +74,8 @@ TaskSnapshot.propTypes = { tasks: PropTypes.array, appeal: PropTypes.object, hideDropdown: PropTypes.bool, - showPulacCerulloAlert: PropTypes.bool + showPulacCerulloAlert: PropTypes.bool, + VLJ_featureToggles: PropTypes.string, }; const mapStateToProps = (state, ownProps) => { diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index 423aef3772b..ce0fd53a1cd 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -306,7 +306,47 @@ class TaskRows extends React.PureComponent { // We specify the same 2.4rem margin-bottom as paragraphs to each set of instructions // to ensure a consistent margin between instruction content and the "Hide" button - const divStyles = { marginBottom: '2.4rem' }; + const divStyles = { marginTop: '2rem' }; + + if (task.appealType === 'LegacyAppeal' && this.props.VLJ_featureToggles) { + const values = [`${COPY.LEGACY_APPEALS_VLJ_REASON_INTRUCTIONS}`, + `${COPY.LEGACY_APPEALS_VLJ_NEW_JUDGE_INTRUCTIONS}`, + `${COPY.LEGACY_APPEALS_VLJ_DETAILS_INTRUCTIONS}`]; + + return ( + + {task.instructions.map((text, index) => { + if (index === 1) { + return ( + +
    + {values[index]} + {task.assigneeName} +
    +
    + ); + } + + return ( + +
    + {values[index]} + {formatBreaks(text)} +
    +
    + ); + })} +
    + ); + } return ( @@ -344,7 +384,7 @@ class TaskRows extends React.PureComponent { )}
    )} - { task.previousAssignee && ( - -
    - {COPY.LEGACY_APPEALS_VLJ_ORIGINAL_JUDGE_INSTRUCTIONS} - {formatBreaks(task.previousAssignee)} -
    -
    - )} {task.assigneeName && !(task.type === ('AttorneyTask' || 'AttorneyRewriteTask')) && (
    { status: task.attributes.status, onHoldDuration: task.attributes.on_hold_duration, instructions: task.attributes.instructions, - previousAssignee: task.attributes.previous_assignee, decisionPreparedBy, availableActions: task.attributes.available_actions, caseReviewId: task.attributes.attorney_case_review_id, diff --git a/db/migrate/20230616044038_add_previous_assignee_to_tasks.rb b/db/migrate/20230616044038_add_previous_assignee_to_tasks.rb deleted file mode 100644 index 7cff707dc47..00000000000 --- a/db/migrate/20230616044038_add_previous_assignee_to_tasks.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPreviousAssigneeToTasks < ActiveRecord::Migration[5.2] - def change - add_column :tasks, :previous_assignee, :string - end -end diff --git a/db/schema.rb b/db/schema.rb index 10eb7dd1feb..eafc2b8ab21 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_06_16_044038) do +ActiveRecord::Schema.define(version: 2023_03_17_164013) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1684,7 +1684,6 @@ t.text "instructions", default: [], array: true t.integer "parent_id" t.datetime "placed_on_hold_at" - t.string "previous_assignee" t.datetime "started_at" t.string "status", default: "assigned" t.string "type" From a8bbfbce27883c81a3284933897a3d488df896df Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Tue, 20 Jun 2023 13:17:24 -0500 Subject: [PATCH 042/203] Fixed Button vaidations and SuccessBanner (#18827) --- app/repositories/task_action_repository.rb | 3 +- .../queue/AssignToAttorneyLegacyModalView.jsx | 38 +++++++++++++++---- .../AssignToAttorneyLegacyWidget.jsx | 12 ++++-- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/app/repositories/task_action_repository.rb b/app/repositories/task_action_repository.rb index 8ead28129de..143b50608e1 100644 --- a/app/repositories/task_action_repository.rb +++ b/app/repositories/task_action_repository.rb @@ -183,7 +183,8 @@ def assign_to_attorney_legacy_data(task, user) { selected: nil, options: user.can_act_on_behalf_of_legacy_judges? ? users_to_options(Attorney.list_all) : nil, - type: task.is_a?(LegacyTask) ? AttorneyLegacyTask.name : AttorneyTask.name + type: task.is_a?(LegacyTask) ? AttorneyLegacyTask.name : AttorneyTask.name, + message_title: COPY::DISTRIBUTE_TASK_SUCCESS_MESSAGE_NON_BLOCKING } end diff --git a/client/app/queue/AssignToAttorneyLegacyModalView.jsx b/client/app/queue/AssignToAttorneyLegacyModalView.jsx index 97f4f2280b9..e7877856a1f 100644 --- a/client/app/queue/AssignToAttorneyLegacyModalView.jsx +++ b/client/app/queue/AssignToAttorneyLegacyModalView.jsx @@ -2,14 +2,13 @@ import * as React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import PropTypes from 'prop-types'; +import { taskActionData } from './utils'; +import { sprintf } from 'sprintf-js'; import { AssignToAttorneyLegacyWidgetModal } from './components/AssignToAttorneyLegacyWidget'; +import { taskById } from './selectors'; import COPY from '../../COPY'; -import { - taskById -} from './selectors'; - import { initialAssignTasksToUser, reassignTasksToUser, @@ -18,9 +17,17 @@ import { class AssignToAttorneyLegacyModalView extends React.PureComponent { handleAssignment = ( - { tasks, assigneeId, instructions } + { tasks, assigneeId, instructions, assignee } ) => { const previousAssigneeId = tasks[0].assignedTo.id.toString(); + const previousAssignee = tasks[0].assigneeName; + + const assignTaskSuccessMessage = { + title: taskActionData(this.props).message_title ? sprintf(taskActionData(this.props).message_title, + previousAssignee, + assignee) : sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()), + detail: taskActionData(this.props).message_detail || null + }; if ([COPY.JUDGE_ASSIGN_TASK_LABEL, COPY.JUDGE_QUALITY_REVIEW_TASK_LABEL].includes(tasks[0].label)) { return this.props.initialAssignTasksToUser({ @@ -33,7 +40,7 @@ class AssignToAttorneyLegacyModalView extends React.PureComponent { this.props.legacyReassignToJudgeAttorney({ tasks, assigneeId - }); + }, assignTaskSuccessMessage); } }); } @@ -48,11 +55,28 @@ class AssignToAttorneyLegacyModalView extends React.PureComponent { this.props.legacyReassignToJudgeAttorney({ tasks, assigneeId - }); + }, assignTaskSuccessMessage); } }); } + getAssignee = () => { + let assignee = 'person'; + + taskActionData(this.props).options.forEach((opt) => { + if (opt.value === this.state.selectedValue) { + assignee = opt.label; + } + }); + const splitAssignee = assignee.split(' '); + + if (splitAssignee.length >= 3) { + assignee = `${splitAssignee[0] } ${ splitAssignee[2]}`; + } + + return assignee; + }; + render = () => { const { task, userId, match } = this.props; const previousAssigneeId = task ? task.assignedTo.id.toString() : null; diff --git a/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx b/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx index e16162472cd..7d8b1f6cd31 100644 --- a/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx @@ -42,8 +42,9 @@ export class AssignToAttorneyLegacyWidget extends React.PureComponent { super(props); const instructions = (this.props.selectedTasks[0].instructions.length === 0 ? null : - this.props.selectedTasks[0].instructions); - const instructionType = Array.isArray(this.props.selectedTasks[0].instructions) ? instructions : null; + this.props.selectedTasks[0].instructions.filter((instructionData) => instructionData)); + const isInstructionArray = (instructions.length === 0 ? null : instructions); + const instructionType = Array.isArray(this.props.selectedTasks[0].instructions) ? isInstructionArray : null; this.state = { @@ -150,7 +151,8 @@ export class AssignToAttorneyLegacyWidget extends React.PureComponent { { tasks: selectedTasks, assigneeId: assignee.id, previousAssigneeId, - instructions }). + instructions, + assignee: assignee.full_name }). then(() => { const isReassign = selectedTasks[0].type === 'AttorneyTask'; @@ -281,8 +283,10 @@ export class AssignToAttorneyLegacyWidget extends React.PureComponent { return isModal ? {Widget} : Widget; From 3faa704dd3a2cc5bba1e47755daa89518bacca0e Mon Sep 17 00:00:00 2001 From: cacevesva <109166981+cacevesva@users.noreply.github.com> Date: Thu, 22 Jun 2023 13:00:12 -0700 Subject: [PATCH 043/203] APPEALS-24442 - fix assign hearing disposition task spec (#18847) * Revert code back to using dig method * Revert code back for flattened_instructions --- app/models/task.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/task.rb b/app/models/task.rb index 68da0f9dfae..df376843e01 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -526,7 +526,7 @@ def update_with_instructions(params) end def flattened_instructions(params) - params[:instructions] + [instructions, params.dig(:instructions).presence].flatten.compact end def append_instruction(instruction) From 4c7a0fe3ce4394f92511407cea72b10371500ce8 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 23 Jun 2023 16:33:13 -0400 Subject: [PATCH 044/203] Kamala/APPEALS-21597 (#18854) * Added previous to tasks schema * added an if statement to the new judge assignment * rspec errors * Label change * rspec fixes --- app/controllers/tasks_controller.rb | 2 +- .../serializers/work_queue/task_serializer.rb | 1 + app/models/task.rb | 7 ++- client/COPY.json | 2 +- client/app/queue/AssignToView.jsx | 7 ++- .../queue/BlockedAdvanceToJudgeLegacyView.jsx | 3 +- client/app/queue/components/TaskRows.jsx | 60 ++++++++++++++++--- client/app/queue/utils.js | 1 + .../20230622170913_add_previous_to_tasks.rb | 5 ++ db/schema.rb | 3 +- 10 files changed, 77 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20230622170913_add_previous_to_tasks.rb diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 773b41f3de3..d742a8261ba 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -378,7 +378,7 @@ def update_params :select_opc, :radio_value, :parent_id, - reassign: [:assigned_to_id, :assigned_to_type, :instructions], + reassign: [:assigned_to_id, :assigned_to_type, :instructions, previous: [:details, :old_judge, :new_judge]], business_payloads: [:description, values: {}] ) end diff --git a/app/models/serializers/work_queue/task_serializer.rb b/app/models/serializers/work_queue/task_serializer.rb index 0c81caca05c..3ea28bb06a7 100644 --- a/app/models/serializers/work_queue/task_serializer.rb +++ b/app/models/serializers/work_queue/task_serializer.rb @@ -17,6 +17,7 @@ class WorkQueue::TaskSerializer attribute :instructions do |object| object.instructions.presence || object.default_instructions.presence || [] end + attribute :previous attribute :appeal_type attribute :parent_id attribute :timeline_title diff --git a/app/models/task.rb b/app/models/task.rb index df376843e01..d83debbca71 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -71,6 +71,7 @@ class Task < CaseflowRecord include_association :cancelled_by_id include_association :closed_at include_association :instructions + include_association :previous include_association :placed_on_hold_at include_association :started_at include_association :type @@ -507,7 +508,6 @@ def create_twin_of_type(_params) def update_from_params(params, current_user) verify_user_can_update!(current_user) - return reassign(params[:reassign], current_user) if params[:reassign] update_with_instructions(params) @@ -629,11 +629,14 @@ def reassign(reassign_params, current_user) replacement = dup.tap do |task| begin ActiveRecord::Base.transaction do + if !reassign_params[:previous].nil? + reassign_params[:previous][:new_judge] = self.class.child_task_assignee(parent, reassign_params).css_id + end task.assigned_by_id = self.class.child_assigned_by_id(parent, current_user) task.assigned_to = self.class.child_task_assignee(parent, reassign_params) task.instructions = [reassign_params[:instructions]] task.status = Constants.TASK_STATUSES.assigned - + task.previous ? (task.previous << reassign_params[:previous]) : (task.previous = [reassign_params[:previous]]) task.save! end ensure diff --git a/client/COPY.json b/client/COPY.json index 863aa1c9cb4..a1118f07f91 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -532,7 +532,7 @@ "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE": "This case currently has blocking tasks that will be cancelled to move this case", "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER": "The following task(s) will be cancelled:", "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER": "Please provide reason(s) and context for the cancellation:", - "BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY_MODAL_TITLE": "Confirm Cancellation", + "BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY_MODAL_TITLE": "Confirm Cancellation and Reassign", "BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_TITLE": "Confirm Cancellation and Reassign", "BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_WARNING": "To cancel tasks you must select a user to move the case to as well as provide a reason and context for the reassignment below.", "BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_JUDGE_HEADER": "Reassign to", diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index de0bdf9fb2b..fe5510ac76a 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -179,7 +179,12 @@ class AssignToView extends React.Component { reassign: { assigned_to_id: this.state.selectedValue, assigned_to_type: 'User', - instructions: this.state.instructions + instructions: this.state.instructions, + previous: { + details: this.state.instructions, + old_judge: task.assigneeName, + new_judge: this.state.selectedValue + } } } } diff --git a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx index 69da6878315..dcbb977d9eb 100644 --- a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx @@ -123,7 +123,8 @@ class BlockedAdvanceToJudgeLegacyView extends React.Component { assigned_to_id: this.state.selectedAssignee, assigned_to_type: 'User', // cancellation_reason: `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions.trim()}`, - instructions: this.state.instructions + instructions: [this.state.instructions, + `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions.trim()}`] } ] } diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index 87e550d4183..43615a68010 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -308,20 +308,66 @@ class TaskRows extends React.PureComponent { // to ensure a consistent margin between instruction content and the "Hide" button const divStyles = { marginTop: '2rem' }; + if ((task.previous.length >= 1) && (task.type === 'JudgeAssignTask')) { + return ( + + {task.previous.toReversed().map((prev) => ( +
    + {prev.old_judge && ( +
    + {COPY.LEGACY_APPEALS_VLJ_ORIGINAL_JUDGE_INSTRUCTIONS} + {formatBreaks(prev.old_judge)} +
    +
    + )} + {prev.new_judge && ( +
    + {COPY.LEGACY_APPEALS_VLJ_NEW_JUDGE_INSTRUCTIONS} + {formatBreaks(prev.new_judge)} +
    +
    + )} + {prev.details && ( + +
    + {COPY.LEGACY_APPEALS_VLJ_DETAILS_INSTRUCTIONS} + {formatBreaks(prev.details)} +
    +
    + )} +
    + ))} +
    + ); + } + return ( - {task.cancelReason && ( + {task.instructions[1] && (
    {COPY.LEGACY_APPEALS_VLJ_REASON_INSTRUCTIONS} - {formatBreaks(task.cancelReason)} + {formatBreaks(task.instructions[1])}
    )} - {task.assigneeName && !(task.type === ('AttorneyTask' || 'AttorneyRewriteTask')) && ( + {task.assigneeName && !(task.type === ('AttorneyTask' || 'AttorneyRewriteTask')) && + (
    )} - {task.instructions.map((text) => ( - + {task.instructions && + (
    {COPY.LEGACY_APPEALS_VLJ_DETAILS_INSTRUCTIONS} - {formatBreaks(text)} + {formatBreaks(task.instructions[0])}
    - ))} + )}
    ); }; diff --git a/client/app/queue/utils.js b/client/app/queue/utils.js index 111166a3b31..77c4fb19a91 100644 --- a/client/app/queue/utils.js +++ b/client/app/queue/utils.js @@ -130,6 +130,7 @@ const taskAttributesFromRawTask = (task) => { status: task.attributes.status, onHoldDuration: task.attributes.on_hold_duration, instructions: task.attributes.instructions, + previous: task.attributes.previous, decisionPreparedBy, availableActions: task.attributes.available_actions, caseReviewId: task.attributes.attorney_case_review_id, diff --git a/db/migrate/20230622170913_add_previous_to_tasks.rb b/db/migrate/20230622170913_add_previous_to_tasks.rb new file mode 100644 index 00000000000..5d62d8960ae --- /dev/null +++ b/db/migrate/20230622170913_add_previous_to_tasks.rb @@ -0,0 +1,5 @@ +class AddPreviousToTasks < ActiveRecord::Migration[5.2] + def change + add_column :tasks, :previous, :jsonb, default: [], array: true + end +end diff --git a/db/schema.rb b/db/schema.rb index c43d1649e9d..ede495292b5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_05_08_202742) do +ActiveRecord::Schema.define(version: 2023_06_22_170913) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1684,6 +1684,7 @@ t.text "instructions", default: [], array: true t.integer "parent_id" t.datetime "placed_on_hold_at" + t.jsonb "previous", default: [], array: true t.datetime "started_at" t.string "status", default: "assigned" t.string "type" From e66269001d20619a8ce4168ad9489659b6919bfe Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Mon, 26 Jun 2023 12:52:56 -0400 Subject: [PATCH 045/203] Vinner57/appeals 21608 (#18860) * resolving conflicts with feature branch * correcting the changes with respect to decision draft to review * resolving conflicts * resolving conflicts * fixing the rspec test case --- app/models/attorney_case_review.rb | 4 +- app/models/concerns/case_review_concern.rb | 2 + .../judge_case_assignment_to_attorney.rb | 2 +- app/repositories/queue_repository.rb | 53 +++++++++++-------- .../queue/AssignToAttorneyLegacyModalView.jsx | 9 ++-- client/app/queue/QueueActions.js | 2 +- client/app/queue/SubmitDecisionView.jsx | 5 +- .../AssignToAttorneyLegacyWidget.jsx | 9 ++-- 8 files changed, 49 insertions(+), 37 deletions(-) diff --git a/app/models/attorney_case_review.rb b/app/models/attorney_case_review.rb index 7bd22bda983..c4838a2469a 100644 --- a/app/models/attorney_case_review.rb +++ b/app/models/attorney_case_review.rb @@ -63,11 +63,11 @@ def note_label def reassign_case_to_judge_in_vacols! attorney.fail_if_no_access_to_legacy_task!(vacols_id) - AttorneyCaseReview.repository.reassign_case_to_judge!( vacols_id: vacols_id, + assigned_by: attorney, created_in_vacols_date: created_in_vacols_date, - judge_vacols_user_id: reviewing_judge.vacols_uniq_id, + judge_vacols_user_id: reviewing_judge, decass_attrs: { work_product: work_product, document_id: document_id, diff --git a/app/models/concerns/case_review_concern.rb b/app/models/concerns/case_review_concern.rb index 2fe7b38bff9..b66450362cb 100644 --- a/app/models/concerns/case_review_concern.rb +++ b/app/models/concerns/case_review_concern.rb @@ -41,6 +41,8 @@ def legacy? # use column values if they exist return appeal.is_a?(LegacyAppeal) if appeal_association? + return task.appeal.is_a?(LegacyAppeal) if task && task.appeal + # fall back to original implementation (task_id =~ LegacyTask::TASK_ID_REGEX) ? true : false end diff --git a/app/models/judge_case_assignment_to_attorney.rb b/app/models/judge_case_assignment_to_attorney.rb index a8225a46eb2..17c5ee0e465 100644 --- a/app/models/judge_case_assignment_to_attorney.rb +++ b/app/models/judge_case_assignment_to_attorney.rb @@ -6,7 +6,7 @@ class JudgeCaseAssignmentToAttorney attr_accessor :appeal_id, :assigned_to, :task_id, :assigned_by, :judge validates :assigned_by, :assigned_to, presence: true - validates :task_id, format: { with: /\A[0-9A-Z]+-[0-9]{4}-[0-9]{2}-[0-9]{2}\Z/i }, allow_blank: true + # validates :task_id, format: { with: /\A[0-9A-Z]+-[0-9]{4}-[0-9]{2}-[0-9]{2}\Z/i }, allow_blank: true validate :assigned_by_role_is_valid def assign_to_attorney! diff --git a/app/repositories/queue_repository.rb b/app/repositories/queue_repository.rb index 1171d5b49bd..0af424e10ff 100644 --- a/app/repositories/queue_repository.rb +++ b/app/repositories/queue_repository.rb @@ -56,19 +56,22 @@ def appeals_by_vacols_ids(vacols_ids) appeals end - def reassign_case_to_judge!(vacols_id:, created_in_vacols_date:, judge_vacols_user_id:, decass_attrs:) - decass_record = find_decass_record(vacols_id, created_in_vacols_date) - # In attorney checkout, we are automatically selecting the judge who - # assigned the attorney the case. But we also have a drop down for the - # attorney to select a different judge if they are checking it out to someone else - if decass_record.deadusr != judge_vacols_user_id - BusinessMetrics.record(service: :queue, name: "reassign_case_to_different_judge") - end - - update_decass_record(decass_record, decass_attrs) - - # update location with the judge's slogid - decass_record.update_vacols_location!(judge_vacols_user_id) + def reassign_case_to_judge!(vacols_id:, assigned_by:, created_in_vacols_date:, judge_vacols_user_id:, decass_attrs:) + begin + decass_record = find_decass_record(vacols_id, created_in_vacols_date) + # In attorney checkout, we are automatically selecting the judge who + # assigned the attorney the case. But we also have a drop down for the + # attorney to select a different judge if they are checking it out to someone else + if decass_record.deadusr != judge_vacols_user_id.vacols_uniq_id + BusinessMetrics.record(service: :queue, name: "reassign_case_to_different_judge") + end + update_decass_record(decass_record, decass_attrs) + # update location with the judge's slogid + decass_record.update_vacols_location!(judge_vacols_user_id.vacols_uniq_id) + rescue Caseflow::Error::QueueRepositoryError => e + attrs = assign_to_attorney_attrs(vacols_id, assigned_by, judge_vacols_user_id) + decass_record = create_decass_record(attrs.merge(adding_user: judge_vacols_user_id.vacols_uniq_id)) + end true end @@ -157,15 +160,19 @@ def incomplete_decass_record(vacols_id) def reassign_case_to_attorney!(judge:, attorney:, vacols_id:, created_in_vacols_date:) transaction do - update_location_to_attorney(vacols_id, attorney) - - decass_record = find_decass_record(vacols_id, created_in_vacols_date) - update_decass_record(decass_record, - attorney_id: attorney.vacols_attorney_id, - group_name: attorney.vacols_group_id[0..2], - assigned_to_attorney_date: VacolsHelper.local_time_with_utc_timezone, - deadline_date: VacolsHelper.local_date_with_utc_timezone + 30.days, - modifying_user: judge.vacols_uniq_id) + #update_location_to_attorney(vacols_id, attorney) + begin + decass_record = find_decass_record(vacols_id, created_in_vacols_date) + update_decass_record(decass_record, + attorney_id: attorney.vacols_attorney_id, + group_name: attorney.vacols_group_id[0..2], + assigned_to_attorney_date: VacolsHelper.local_time_with_utc_timezone, + deadline_date: VacolsHelper.local_date_with_utc_timezone + 30.days, + modifying_user: judge.vacols_uniq_id) + rescue Caseflow::Error::QueueRepositoryError => e + attrs = assign_to_attorney_attrs(vacols_id, attorney, judge) + create_decass_record(attrs.merge(adding_user: judge.vacols_uniq_id)) + end end end @@ -219,7 +226,7 @@ def update_decass_record(decass_record, decass_attrs) end def create_decass_record(decass_attrs) - decass_attrs = decass_attrs.merge(added_at_date: VacolsHelper.local_date_with_utc_timezone, deteam: "SB") + decass_attrs = decass_attrs.merge(added_at_date: VacolsHelper.local_date_with_utc_timezone, deteam: "DF") decass_attrs = QueueMapper.new(decass_attrs).rename_and_validate_decass_attrs VACOLS::Decass.create!(decass_attrs) end diff --git a/client/app/queue/AssignToAttorneyLegacyModalView.jsx b/client/app/queue/AssignToAttorneyLegacyModalView.jsx index e7877856a1f..0b37347c4ee 100644 --- a/client/app/queue/AssignToAttorneyLegacyModalView.jsx +++ b/client/app/queue/AssignToAttorneyLegacyModalView.jsx @@ -12,7 +12,8 @@ import COPY from '../../COPY'; import { initialAssignTasksToUser, reassignTasksToUser, - legacyReassignToJudgeAttorney + legacyReassignToJudgeAttorney, + legacyReassignToJudge } from './QueueActions'; class AssignToAttorneyLegacyModalView extends React.PureComponent { @@ -105,7 +106,8 @@ AssignToAttorneyLegacyModalView.propTypes = { match: PropTypes.object, initialAssignTasksToUser: PropTypes.func, reassignTasksToUser: PropTypes.func, - legacyReassignToJudgeAttorney: PropTypes.func + legacyReassignToJudgeAttorney: PropTypes.func, + legacyReassignToJudge: PropTypes.func }; const mapStateToProps = (state, ownProps) => { @@ -117,7 +119,8 @@ const mapStateToProps = (state, ownProps) => { const mapDispatchToProps = (dispatch) => bindActionCreators({ initialAssignTasksToUser, reassignTasksToUser, - legacyReassignToJudgeAttorney + legacyReassignToJudgeAttorney, + legacyReassignToJudge }, dispatch); export default (connect( diff --git a/client/app/queue/QueueActions.js b/client/app/queue/QueueActions.js index fc4d0c20dfb..66f5d39fa6e 100644 --- a/client/app/queue/QueueActions.js +++ b/client/app/queue/QueueActions.js @@ -605,7 +605,7 @@ export const legacyReassignToJudgeAttorney = ({ } }; - return ApiUtil.post('/legacy_tasks/assign_to_judge', params). + return ApiUtil.put(`/legacy_tasks/${tasks[0].uniqueId}`, params). then((resp) => resp.body). then((resp) => { const allTasks = prepareAllTasksForStore([resp.task.data]); diff --git a/client/app/queue/SubmitDecisionView.jsx b/client/app/queue/SubmitDecisionView.jsx index cf0bdff80ef..716b123bb9a 100644 --- a/client/app/queue/SubmitDecisionView.jsx +++ b/client/app/queue/SubmitDecisionView.jsx @@ -103,8 +103,8 @@ class SubmitDecisionView extends React.PureComponent { judges } = this.props; - const issuesToPass = isLegacyAppeal ? issues : decisionIssues; - const payload = buildCaseReviewPayload(checkoutFlow, decision, true, issuesToPass, { isLegacyAppeal }); + const issuesToPass = decisionIssues; + const payload = buildCaseReviewPayload(checkoutFlow, decision, true, issuesToPass, { isLegacyAppeal: isLegacyAppeal }); const fields = { type: checkoutFlow === DECISION_TYPES.DRAFT_DECISION ? 'decision' : 'outside medical opinion (OMO) request', @@ -114,6 +114,7 @@ class SubmitDecisionView extends React.PureComponent { const successMsg = `Thank you for drafting ${fields.veteran}'s ${fields.type}. It's been sent to ${fields.judge} for review.`; + try { const res = await this.props.requestSave(`/case_reviews/${taskId}/complete`, payload, { title: successMsg }); diff --git a/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx b/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx index 7d8b1f6cd31..29b4a0c9478 100644 --- a/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx @@ -40,11 +40,10 @@ const OTHER = 'OTHER'; export class AssignToAttorneyLegacyWidget extends React.PureComponent { constructor(props) { super(props); - - const instructions = (this.props.selectedTasks[0].instructions.length === 0 ? null : - this.props.selectedTasks[0].instructions.filter((instructionData) => instructionData)); - const isInstructionArray = (instructions.length === 0 ? null : instructions); - const instructionType = Array.isArray(this.props.selectedTasks[0].instructions) ? isInstructionArray : null; + const instructions = (props.selectedTasks[0].instructions.length === 0 ? null : + props.selectedTasks[0].instructions.filter((instructionData) => instructionData)); + const isInstructionArray = (instructions === null ? null : instructions); + const instructionType = Array.isArray(props.selectedTasks[0].instructions) ? isInstructionArray : null; this.state = { From d8044b9262b0b64b42703710664a5e1a370e0455 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Tue, 27 Jun 2023 10:44:20 -0400 Subject: [PATCH 046/203] Rspec fixes (#18867) * Rspec fixes * fixed rspec errors --- app/workflows/tasks_for_appeal.rb | 6 +++++- spec/feature/queue/attorney_checkout_flow_spec.rb | 2 +- spec/feature/queue/judge_checkout_flow_spec.rb | 2 +- spec/feature/queue/special_case_movement_task_spec.rb | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/workflows/tasks_for_appeal.rb b/app/workflows/tasks_for_appeal.rb index b09b35779fe..b2b4d641447 100644 --- a/app/workflows/tasks_for_appeal.rb +++ b/app/workflows/tasks_for_appeal.rb @@ -66,6 +66,10 @@ def tasks_actionable_to_vso_employee end end + def only_root_task? + !appeal.tasks.active.where(type: RootTask.name).empty? + end + def all_tasks_except_for_decision_review_tasks appeal.tasks.not_decisions_review.includes(*task_includes) end @@ -92,7 +96,7 @@ def legacy_appeal_tasks def hide_legacy_tasks? active_tasks = all_tasks_except_for_decision_review_tasks.active legacy_tasks = legacy_appeal_tasks - (active_tasks && legacy_tasks) ? true : false + (active_tasks && legacy_tasks && !only_root_task?) ? true : false end def task_includes diff --git a/spec/feature/queue/attorney_checkout_flow_spec.rb b/spec/feature/queue/attorney_checkout_flow_spec.rb index 400c37ca0c7..002601bf18e 100644 --- a/spec/feature/queue/attorney_checkout_flow_spec.rb +++ b/spec/feature/queue/attorney_checkout_flow_spec.rb @@ -99,7 +99,7 @@ click_on "Save" - expect(page).to have_content "Text box field is required" + expect(page).to have_content "This field is required" fill_in "Text Box", with: decision_issue_text find(".cf-select__control", text: "Select disposition").click diff --git a/spec/feature/queue/judge_checkout_flow_spec.rb b/spec/feature/queue/judge_checkout_flow_spec.rb index 18bdfcd2fdd..200340773fe 100644 --- a/spec/feature/queue/judge_checkout_flow_spec.rb +++ b/spec/feature/queue/judge_checkout_flow_spec.rb @@ -58,7 +58,7 @@ # Change JudgeDecisionReviewTask status so that "Ready for Dispatch" action is available jdr_task.update(status: :assigned) appeal.request_issues.update_all(closed_at: nil) - visit "queue/appeals/#{appeal.uuid}" + visit "queue/appeals/#{appeal.external_id}" # Below is needed so that the frontend will load the actions dropdown before the jdr task's status changes expect(page).to have_content("Actions", wait: 10) diff --git a/spec/feature/queue/special_case_movement_task_spec.rb b/spec/feature/queue/special_case_movement_task_spec.rb index 54d6e357458..f4443e5b05b 100644 --- a/spec/feature/queue/special_case_movement_task_spec.rb +++ b/spec/feature/queue/special_case_movement_task_spec.rb @@ -93,7 +93,7 @@ # Validate before moving on click_on "Continue" - expect(page).to have_content(COPY::INSTRUCTIONS_ERROR_FIELD_REQUIRED) + expect(page).to have_content(COPY::FORM_ERROR_FIELD_REQUIRED) find("label", text: "Death dismissal").click fill_in("cancellationInstructions", with: "Instructions for cancellation") click_on "Continue" From d6c7c4a4f8e34958450b83e5b9b9615a430be103 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Tue, 27 Jun 2023 13:11:31 -0400 Subject: [PATCH 047/203] Calvin/appeals 21605 vacols (#18877) * fix storybook error in demo * flaky test fix attempt * assign_to_attorney fix to update vacols --------- Co-authored-by: Clay Sheppard Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com> Co-authored-by: Shruthi Sibi <109103820+shruthisibi@users.noreply.github.com> --- .../app/queue/AssignToAttorneyLegacyModalView.jsx | 13 ++++++++----- client/app/queue/AssignToView.stories.js | 2 +- .../queue/components/CompleteTaskModal.stories.js | 2 +- client/app/queue/components/EndHoldModal.stories.js | 8 ++++---- .../app/queue/components/StartHoldModal.stories.js | 2 +- spec/feature/hearings/edit_hearing_day_spec.rb | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/client/app/queue/AssignToAttorneyLegacyModalView.jsx b/client/app/queue/AssignToAttorneyLegacyModalView.jsx index 0b37347c4ee..5fa212bed60 100644 --- a/client/app/queue/AssignToAttorneyLegacyModalView.jsx +++ b/client/app/queue/AssignToAttorneyLegacyModalView.jsx @@ -13,7 +13,8 @@ import { initialAssignTasksToUser, reassignTasksToUser, legacyReassignToJudgeAttorney, - legacyReassignToJudge + legacyReassignToJudge, + legacyReassignToAttorney } from './QueueActions'; class AssignToAttorneyLegacyModalView extends React.PureComponent { @@ -38,7 +39,7 @@ class AssignToAttorneyLegacyModalView extends React.PureComponent { instructions }).then(() => { if (tasks[0].appealType === 'LegacyAppeal') { - this.props.legacyReassignToJudgeAttorney({ + this.props.legacyReassignToAttorney({ tasks, assigneeId }, assignTaskSuccessMessage); @@ -53,7 +54,7 @@ class AssignToAttorneyLegacyModalView extends React.PureComponent { instructions }).then(() => { if (tasks[0].appealType === 'LegacyAppeal') { - this.props.legacyReassignToJudgeAttorney({ + this.props.legacyReassignToAttorney({ tasks, assigneeId }, assignTaskSuccessMessage); @@ -107,7 +108,8 @@ AssignToAttorneyLegacyModalView.propTypes = { initialAssignTasksToUser: PropTypes.func, reassignTasksToUser: PropTypes.func, legacyReassignToJudgeAttorney: PropTypes.func, - legacyReassignToJudge: PropTypes.func + legacyReassignToJudge: PropTypes.func, + legacyReassignToAttorney: PropTypes.func }; const mapStateToProps = (state, ownProps) => { @@ -120,7 +122,8 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({ initialAssignTasksToUser, reassignTasksToUser, legacyReassignToJudgeAttorney, - legacyReassignToJudge + legacyReassignToJudge, + legacyReassignToAttorney }, dispatch); export default (connect( diff --git a/client/app/queue/AssignToView.stories.js b/client/app/queue/AssignToView.stories.js index 5579d46c2d9..a2543bbe8d5 100644 --- a/client/app/queue/AssignToView.stories.js +++ b/client/app/queue/AssignToView.stories.js @@ -22,7 +22,7 @@ import { getAppealId, getTaskId } from '../../test/app/queue/components/modalUtils'; -import AssignToView from './AssignToView'; +import { AssignToView } from './AssignToView'; export default { title: 'Queue/Components/Task Action Modals/AssignToView', diff --git a/client/app/queue/components/CompleteTaskModal.stories.js b/client/app/queue/components/CompleteTaskModal.stories.js index e7ee3a6aea7..013df0159c2 100644 --- a/client/app/queue/components/CompleteTaskModal.stories.js +++ b/client/app/queue/components/CompleteTaskModal.stories.js @@ -20,7 +20,7 @@ import { returnToOrgData } from '../../../test/data/queue/taskActionModals/taskActionModalData'; import TASK_ACTIONS from '../../../constants/TASK_ACTIONS'; -import CompleteTaskModal from './CompleteTaskModal'; +import { CompleteTaskModal } from './CompleteTaskModal'; export default { title: 'Queue/Components/Task Action Modals/CompleteTaskModal', diff --git a/client/app/queue/components/EndHoldModal.stories.js b/client/app/queue/components/EndHoldModal.stories.js index a431b602135..100c6a87cd7 100644 --- a/client/app/queue/components/EndHoldModal.stories.js +++ b/client/app/queue/components/EndHoldModal.stories.js @@ -12,11 +12,11 @@ import { import { visnOnHoldData } from '../../../test/data/queue/taskActionModals/taskActionModalData'; -import EndHoldModel from './EndHoldModal'; +import { EndHoldModal } from './EndHoldModal'; export default { - title: 'Queue/Components/Task Action Modals/EndHoldModel', - component: EndHoldModel, + title: 'Queue/Components/Task Action Modals/EndHoldModal', + component: EndHoldModal, parameters: { docs: { inlineStories: false, @@ -43,7 +43,7 @@ const Template = (args) => { { - return ; + return ; }} path={`/queue/appeals/:appealId/tasks/:taskId/modal/${modalType}`} /> diff --git a/client/app/queue/components/StartHoldModal.stories.js b/client/app/queue/components/StartHoldModal.stories.js index a64dd75836a..116c4199ec3 100644 --- a/client/app/queue/components/StartHoldModal.stories.js +++ b/client/app/queue/components/StartHoldModal.stories.js @@ -12,7 +12,7 @@ import { } from '../../../test/app/queue/components/modalUtils'; import { vhaPOToCAMOData } from '../../../test/data/queue/taskActionModals/taskActionModalData'; import TASK_ACTIONS from '../../../constants/TASK_ACTIONS'; -import StartHoldModal from './StartHoldModal'; +import { StartHoldModal } from './StartHoldModal'; export default { title: 'Queue/Components/Task Action Modals/StartHoldModal', diff --git a/spec/feature/hearings/edit_hearing_day_spec.rb b/spec/feature/hearings/edit_hearing_day_spec.rb index ed23b63dd04..b1ad7a915df 100644 --- a/spec/feature/hearings/edit_hearing_day_spec.rb +++ b/spec/feature/hearings/edit_hearing_day_spec.rb @@ -8,7 +8,7 @@ let(:sample_room) { "1 (1W200A)" } let!(:current_user) do - user = create(:user, css_id: "BVATWARNER", roles: ["Build HearSched"]) + user = create(:user, css_id: "EDITHEARINGDAY", roles: ["Build HearSched"]) HearingsManagement.singleton.add_user(user) User.authenticate!(user: user) end From 4696b3d8c99e03ba417f392481e08bbf4f26b128 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Tue, 27 Jun 2023 14:07:17 -0500 Subject: [PATCH 048/203] added assert (#18879) --- spec/feature/queue/attorney_checkout_flow_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/feature/queue/attorney_checkout_flow_spec.rb b/spec/feature/queue/attorney_checkout_flow_spec.rb index 002601bf18e..b970d3733ff 100644 --- a/spec/feature/queue/attorney_checkout_flow_spec.rb +++ b/spec/feature/queue/attorney_checkout_flow_spec.rb @@ -295,8 +295,8 @@ expect(page).to have_content("Evaluate Decision") - find("label", text: Constants::JUDGE_CASE_REVIEW_OPTIONS["COMPLEXITY"]["easy"]).click - find("label", text: "5 - #{Constants::JUDGE_CASE_REVIEW_OPTIONS['QUALITY']['outstanding']}").click + assert find("label", text: Constants::JUDGE_CASE_REVIEW_OPTIONS["COMPLEXITY"]["easy"]).click + assert find("label", text: "5 - #{Constants::JUDGE_CASE_REVIEW_OPTIONS['QUALITY']['outstanding']}").click click_on "Continue" expect(page).to have_content(COPY::JUDGE_CHECKOUT_DISPATCH_SUCCESS_MESSAGE_TITLE % appeal.veteran_full_name) From 74ae139bc4e6f081838f7489f25d46c4488a2601 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 28 Jun 2023 16:34:23 -0400 Subject: [PATCH 049/203] Calvin/appeals 24660 (#18889) * added ability for ssc users to see dropdown on leg * comment --- app/models/tasks/attorney_task.rb | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/app/models/tasks/attorney_task.rb b/app/models/tasks/attorney_task.rb index b7e7c3d244a..5c044864d7e 100644 --- a/app/models/tasks/attorney_task.rb +++ b/app/models/tasks/attorney_task.rb @@ -26,16 +26,17 @@ def available_actions(user) Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h ].compact - if appeal.is_a?(LegacyAppeal) && FeatureToggle.enable!(:vlj_legacy_appeal) - movement_actions = [ - Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h, - Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h] - else - movement_actions = [ - Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.to_h, - Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h - ] - end + movement_actions = if appeal.is_a?(LegacyAppeal) && FeatureToggle.enable!(:vlj_legacy_appeal) + [ + Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h, + Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h + ] + else + [ + Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.to_h, + Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h + ] + end actions_based_on_assignment(user, atty_actions, movement_actions) end @@ -97,6 +98,11 @@ def update_params_will_cancel_attorney_task?(params) def can_be_moved_by_user?(user) return false unless parent.is_a?(JudgeTask) + # Allows SSC, SCM, VLJ's if legacy + if appeal.is_a?(LegacyAppeal) + return parent.assigned_to == user || assigned_by == user || user&.can_act_on_behalf_of_legacy_judges? + end + # The judge who is assigned the parent review task, the assigning judge, and SpecialCaseMovementTeam members can # cancel or reassign this task parent.assigned_to == user || assigned_by == user || user&.can_act_on_behalf_of_judges? From 5500dda162eb5e15931abfc30064ecf0080d3880 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Wed, 28 Jun 2023 18:37:53 -0400 Subject: [PATCH 050/203] changing the actions for the attorney task (#18894) --- app/models/tasks/attorney_task.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tasks/attorney_task.rb b/app/models/tasks/attorney_task.rb index 5c044864d7e..95be21469d9 100644 --- a/app/models/tasks/attorney_task.rb +++ b/app/models/tasks/attorney_task.rb @@ -29,7 +29,7 @@ def available_actions(user) movement_actions = if appeal.is_a?(LegacyAppeal) && FeatureToggle.enable!(:vlj_legacy_appeal) [ Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h, - Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h + Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.to_h ] else [ From dc6af29bc5bb54557ef97bcbcb659a2f10c783fa Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Thu, 29 Jun 2023 09:50:18 -0400 Subject: [PATCH 051/203] Calvin/appeals 24660 errorfix (#18897) * added ability for ssc users to see dropdown on leg * comment * Added validation to SSC for attorney task --- app/models/tasks/attorney_task.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/tasks/attorney_task.rb b/app/models/tasks/attorney_task.rb index 95be21469d9..283a41e946e 100644 --- a/app/models/tasks/attorney_task.rb +++ b/app/models/tasks/attorney_task.rb @@ -122,7 +122,8 @@ def assigned_to_role_is_valid end def assigned_by_role_is_valid - if assigned_by && (!assigned_by.judge? && !assigned_by.can_act_on_behalf_of_judges?) + if assigned_by && (!assigned_by.judge? && !assigned_by.can_act_on_behalf_of_judges? && + !assigned_by.can_act_on_behalf_of_legacy_judges?) errors.add(:assigned_by, "has to be a judge or special case movement team member") end end From d87397964e2f457bb73bf978befa49330f3084df Mon Sep 17 00:00:00 2001 From: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com> Date: Thu, 29 Jun 2023 12:52:05 -0400 Subject: [PATCH 052/203] Add generate_legacy_appeals rake task to this feature branch. (#18896) You can conditionally specify whether to create legacy appeals with special issues or not Co-authored-by: Matthew Thornton Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- lib/generators/vacols/case.rb | 8 ++- lib/tasks/seed_legacy_appeals.rake | 110 +++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 lib/tasks/seed_legacy_appeals.rake diff --git a/lib/generators/vacols/case.rb b/lib/generators/vacols/case.rb index 2f99990e6b6..d080771d09e 100644 --- a/lib/generators/vacols/case.rb +++ b/lib/generators/vacols/case.rb @@ -111,9 +111,11 @@ def create(attrs = {}) representative_attrs[:repkey] = custom_case_attrs[:bfkey] Generators::Vacols::Representative.create(representative_attrs) - correspondent_attrs = attrs[:correspondent_attrs].nil? ? {} : attrs[:correspondent_attrs] - correspondent_attrs[:stafkey] = custom_case_attrs[:bfcorkey] - Generators::Vacols::Correspondent.create(correspondent_attrs) + unless attrs[:corres_exists] + correspondent_attrs = attrs[:correspondent_attrs].nil? ? {} : attrs[:correspondent_attrs] + correspondent_attrs[:stafkey] = custom_case_attrs[:bfcorkey] + Generators::Vacols::Correspondent.create(correspondent_attrs) + end note_attrs = attrs[:note_attrs].nil? ? {} : attrs[:note_attrs] note_attrs[:tsktknm] = custom_case_attrs[:bfkey] diff --git a/lib/tasks/seed_legacy_appeals.rake b/lib/tasks/seed_legacy_appeals.rake new file mode 100644 index 00000000000..84c5869091f --- /dev/null +++ b/lib/tasks/seed_legacy_appeals.rake @@ -0,0 +1,110 @@ +# frozen_string_literal: true + +namespace :db do + desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" + task :generate_legacy_appeals, [:add_special_issues] => :environment do |_, args| + ADD_SPECIAL_ISSUES = args.add_special_issues == "true" + + class LegacyAppealFactory + class << self + # Stamping out appeals like mufflers! + def stamp_out_legacy_appeals(num_appeals_to_create, file_number) + veteran = Veteran.find_by_file_number(file_number) + + fail ActiveRecord::RecordNotFound unless veteran + + vacols_veteran_record = find_or_create_vacols_veteran(veteran) + + cases = Array.new(num_appeals_to_create).each_with_index.map do |_element, idx| + Generators::Vacols::Case.create( + corres_exists: true, + case_issue_attrs: [ + Generators::Vacols::CaseIssue.case_issue_attrs.merge(ADD_SPECIAL_ISSUES ? special_issue_types(idx) : {}) + ], + folder_attrs: Generators::Vacols::Folder.folder_attrs.merge( + custom_folder_attributes(vacols_veteran_record) + ), + case_attrs: { + bfcorkey: vacols_veteran_record.stafkey, + bfcorlid: vacols_veteran_record.slogid, + bfkey: VACOLS::Folder.maximum(:ticknum).next + } + ) + end.compact + + build_the_cases_in_caseflow(cases) + end + + def custom_folder_attributes(veteran) + { + titrnum: veteran.slogid, + tiocuser: nil + } + end + + # Generators::Vacols::Case will create new correspondents, and I think it'll just be easier to + # update the cases created rather than mess with the generator's internals. + def find_or_create_vacols_veteran(veteran) + # Being naughty and calling a private method (it'd be cool to have this be public...) + vacols_veteran_record = VACOLS::Correspondent.send(:find_veteran_by_ssn, veteran.ssn).first + + return vacols_veteran_record if vacols_veteran_record + + Generators::Vacols::Correspondent.create( + Generators::Vacols::Correspondent.correspondent_attrs.merge( + ssalut: veteran.name_suffix, + snamef: veteran.first_name, + snamemi: veteran.middle_name, + snamel: veteran.last_name, + slogid: LegacyAppeal.convert_file_number_to_vacols(veteran.file_number) + ) + ) + end + + ######################################################## + # Create Postgres LegacyAppeals based on VACOLS Cases + # + # AND + # + # Create Postgres Request Issues based on VACOLS Issues + def build_the_cases_in_caseflow(cases) + vacols_ids = cases.map(&:bfkey) + + issues = VACOLS::CaseIssue.where(isskey: vacols_ids).group_by(&:isskey) + + cases.map do |case_record| + AppealRepository.build_appeal(case_record).tap do |appeal| + appeal.issues = (issues[appeal.vacols_id] || []).map { |issue| Issue.load_from_vacols(issue.attributes) } + end.save! + end + end + + # MST is true for even indexes, and indexes that are multiples of 5. False for all other numbers. + # PACT is true for odd idexes, and index that are also multiples of 5. False for all others. + def special_issue_types(idx) + { + issmst: ((idx % 2).zero? || (idx % 5).zero?) ? "Y" : "N", + isspact: (!(idx % 2).zero? || (idx % 5).zero?) ? "Y" : "N" + } + end + end + + if Rails.env.development? || Rails.env.test? + vets = Veteran.first(15) + + veterans_with_like_45_appeals = vets[0..12].pluck(:file_number) + + veterans_with_250_appeals = vets.last(3).pluck(:file_number) + else + veterans_with_like_45_appeals = %w[011899917 011899918 011899919 011899920 011899927 + 011899928 011899929 011899930 011899937 011899938 + 011899939 011899940] + + veterans_with_250_appeals = %w[011899906 011899999] + end + + veterans_with_like_45_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals(45, file_number) } + veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals(250, file_number) } + end + end +end From 2c0d74d1bbfa91152239510695ad888d2457a97b Mon Sep 17 00:00:00 2001 From: Christopher Aceves Date: Wed, 12 Jul 2023 11:58:20 -0700 Subject: [PATCH 053/203] Update seed legacy appeals from MST/PACT --- lib/generators/vacols/case.rb | 5 +-- lib/generators/vacols/case_issue.rb | 9 ++++- lib/tasks/seed_legacy_appeals.rake | 62 ++++++++++++++++++++++------- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/lib/generators/vacols/case.rb b/lib/generators/vacols/case.rb index d080771d09e..e5f35d11f98 100644 --- a/lib/generators/vacols/case.rb +++ b/lib/generators/vacols/case.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true - class Generators::Vacols::Case class << self def generate_pkseq @@ -38,12 +37,12 @@ def case_attrs bfbsasgn: nil, bfattid: "1286", bfdasgn: nil, - bfcclkid: "8927941", + bfcclkid: nil, bfdqrsnt: nil, bfdlocin: "2017-11-30 09:01:21 UTC", bfdloout: "2017-11-30 09:01:21 UTC", bfstasgn: nil, - bfcurloc: "98", + bfcurloc: "CASEFLOW", bfnrcopy: nil, bfmemid: "909", bfdmem: nil, diff --git a/lib/generators/vacols/case_issue.rb b/lib/generators/vacols/case_issue.rb index acef6acc659..3c6b1aa75f0 100644 --- a/lib/generators/vacols/case_issue.rb +++ b/lib/generators/vacols/case_issue.rb @@ -5,7 +5,7 @@ class << self def case_issue_attrs { isskey: "877483", - issseq: 8, + issseq: 1, issprog: "02", isscode: "12", isslev1: "04", @@ -25,7 +25,12 @@ def case_issue_attrs end def create(attrs = [{}]) - attrs = attrs.map { |issue| case_issue_attrs.merge(issue) } + attrs = attrs.each_with_index do |issue, index| + # increment issseq + issue[:issseq] = index + 1 + + case_issue_attrs.merge(issue) + end VACOLS::CaseIssue.create(attrs) end diff --git a/lib/tasks/seed_legacy_appeals.rake b/lib/tasks/seed_legacy_appeals.rake index 84c5869091f..032fe527172 100644 --- a/lib/tasks/seed_legacy_appeals.rake +++ b/lib/tasks/seed_legacy_appeals.rake @@ -1,14 +1,15 @@ # frozen_string_literal: true +# to create legacy appeals with MST/PACT issues, run "bundle exec rake 'db:generate_legacy_appeals[true]'"" +# to create without, run "bundle exec rake db:generate_legacy_appeals" namespace :db do desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" task :generate_legacy_appeals, [:add_special_issues] => :environment do |_, args| ADD_SPECIAL_ISSUES = args.add_special_issues == "true" - class LegacyAppealFactory class << self # Stamping out appeals like mufflers! - def stamp_out_legacy_appeals(num_appeals_to_create, file_number) + def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, docket_number) veteran = Veteran.find_by_file_number(file_number) fail ActiveRecord::RecordNotFound unless veteran @@ -16,18 +17,33 @@ namespace :db do vacols_veteran_record = find_or_create_vacols_veteran(veteran) cases = Array.new(num_appeals_to_create).each_with_index.map do |_element, idx| + key = VACOLS::Folder.maximum(:ticknum).next Generators::Vacols::Case.create( corres_exists: true, case_issue_attrs: [ + Generators::Vacols::CaseIssue.case_issue_attrs.merge(ADD_SPECIAL_ISSUES ? special_issue_types(idx) : {}), + Generators::Vacols::CaseIssue.case_issue_attrs.merge(ADD_SPECIAL_ISSUES ? special_issue_types(idx) : {}), Generators::Vacols::CaseIssue.case_issue_attrs.merge(ADD_SPECIAL_ISSUES ? special_issue_types(idx) : {}) ], folder_attrs: Generators::Vacols::Folder.folder_attrs.merge( - custom_folder_attributes(vacols_veteran_record) + custom_folder_attributes(vacols_veteran_record, docket_number.to_s) ), case_attrs: { bfcorkey: vacols_veteran_record.stafkey, bfcorlid: vacols_veteran_record.slogid, - bfkey: VACOLS::Folder.maximum(:ticknum).next + bfkey: key, + bfcurloc: VACOLS::Staff.find_by(sdomainid: user.css_id).slogid, + bfmpro: "ACT", + bfddec: nil, + }, + staff_attrs: { + sattyid: user.id, + sdomainid: user.css_id + }, + decass_attrs: { + defolder: key, + deatty: user.id, + dereceive: "2020-11-17 00:00:00 UTC" } ) end.compact @@ -35,10 +51,11 @@ namespace :db do build_the_cases_in_caseflow(cases) end - def custom_folder_attributes(veteran) + def custom_folder_attributes(veteran, docket_number) { titrnum: veteran.slogid, - tiocuser: nil + tiocuser: nil, + tinum: docket_number } end @@ -84,27 +101,42 @@ namespace :db do def special_issue_types(idx) { issmst: ((idx % 2).zero? || (idx % 5).zero?) ? "Y" : "N", - isspact: (!(idx % 2).zero? || (idx % 5).zero?) ? "Y" : "N" + isspact: (!(idx % 2).zero? || (idx % 5).zero?) ? "Y" : "N", + issdc: nil } end end if Rails.env.development? || Rails.env.test? - vets = Veteran.first(15) + vets = Veteran.first(5) veterans_with_like_45_appeals = vets[0..12].pluck(:file_number) - veterans_with_250_appeals = vets.last(3).pluck(:file_number) + # veterans_with_250_appeals = vets.last(3).pluck(:file_number) + + else - veterans_with_like_45_appeals = %w[011899917 011899918 011899919 011899920 011899927 - 011899928 011899929 011899930 011899937 011899938 - 011899939 011899940] + veterans_with_like_45_appeals = %w[011899917 011899918] - veterans_with_250_appeals = %w[011899906 011899999] + # veterans_with_250_appeals = %w[011899906 011899999] end - veterans_with_like_45_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals(45, file_number) } - veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals(250, file_number) } + # request CSS ID for task assignment + STDOUT.puts("Enter the CSS ID of the user that you want to assign these appeals to") + STDOUT.puts("Hint: an Attorney User for demo env is BVASCASPER1, and UAT is TCASEY_JUDGE and CGRAHAM_JUDGE") + css_id = STDIN.gets.chomp.upcase + user = User.find_by_css_id(css_id) + + fail ActiveRecord::RecordNotFound unless user + + # increment docket number for each case + docket_number = 9_000_000 + + veterans_with_like_45_appeals.each do |file_number| + docket_number += 1 + LegacyAppealFactory.stamp_out_legacy_appeals(5, file_number, user, docket_number) + end + # veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals(250, file_number, user) } end end end From 95680bef6ff0adabbec28f4153f3b168edc3a950 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Tue, 18 Jul 2023 14:58:47 -0400 Subject: [PATCH 054/203] Calvin/appeals 25907 (#19019) * legacy appeals rake * fixed function name * added question to ask what type of scenario * refactored code to make more readable * fixed create task parameters * Added comments for clarity * fixed review task function * task creation outside of appeal creation * Added create hearing task generator * added comments * added functionality for hearing/assign/review task * fixed attorney task generation * fixed task_type location checker --- lib/tasks/seed_legacy_appeals.rake | 139 ++++++++++++++++++++++++++--- 1 file changed, 127 insertions(+), 12 deletions(-) diff --git a/lib/tasks/seed_legacy_appeals.rake b/lib/tasks/seed_legacy_appeals.rake index 032fe527172..1ea7281b05b 100644 --- a/lib/tasks/seed_legacy_appeals.rake +++ b/lib/tasks/seed_legacy_appeals.rake @@ -1,15 +1,26 @@ # frozen_string_literal: true # to create legacy appeals with MST/PACT issues, run "bundle exec rake 'db:generate_legacy_appeals[true]'"" +# to create legacy appeals with AMA Tasks added, run "bundle exec rake db:generate_legacy_appeals[false,true]" # to create without, run "bundle exec rake db:generate_legacy_appeals" namespace :db do desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" - task :generate_legacy_appeals, [:add_special_issues] => :environment do |_, args| + task :generate_legacy_appeals, [:add_special_issues, :task_creation] => :environment do |_, args| ADD_SPECIAL_ISSUES = args.add_special_issues == "true" + TASK_CREATION = args.task_creation == "true" class LegacyAppealFactory class << self # Stamping out appeals like mufflers! - def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, docket_number) + def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, attorney, docket_number, task_type) + bfcurloc = VACOLS::Staff.find_by(sdomainid: user.css_id).slogid + + # Changes location of vacols based on if you want a hearing task or only a distribution task + if task_type == "HEARINGTASK" + bfcurloc = 57 + elsif task_type == "DISTRIBUTIONTASK" + bfcurloc = 81 + end + veteran = Veteran.find_by_file_number(file_number) fail ActiveRecord::RecordNotFound unless veteran @@ -32,9 +43,9 @@ namespace :db do bfcorkey: vacols_veteran_record.stafkey, bfcorlid: vacols_veteran_record.slogid, bfkey: key, - bfcurloc: VACOLS::Staff.find_by(sdomainid: user.css_id).slogid, + bfcurloc: bfcurloc, bfmpro: "ACT", - bfddec: nil, + bfddec: nil }, staff_attrs: { sattyid: user.id, @@ -48,7 +59,7 @@ namespace :db do ) end.compact - build_the_cases_in_caseflow(cases) + build_the_cases_in_caseflow(cases, task_type, user, attorney) end def custom_folder_attributes(veteran, docket_number) @@ -78,21 +89,106 @@ namespace :db do ) end + ######################################################## + # Creates Hearing Tasks for the LegacyAppeals that have just been generated + # Scenario 1 + def create_hearing_task_for_legacy_appeals(appeal) + root_task = RootTask.find_or_create_by!(appeal: appeal) + + hearing_task = HearingTask.create!( + appeal: appeal, + parent: root_task, + assigned_to: Bva.singleton + ) + ScheduleHearingTask.create!( + appeal: appeal, + parent: hearing_task, + assigned_to: Bva.singleton + ) + $stdout.puts("You have created a Hearing Task") + end + + ######################################################## + # Creates Attorney Tasks for the LegacyAppeals that have just been generated + # Scenario 4 + def create_attorney_task_for_legacy_appeals(appeal, user, attorney) + # Will need a judge user for judge decision review task and an attorney user for the subsequent Attorney Task + root_task = RootTask.find_or_create_by!(appeal: appeal) + + review_task = JudgeDecisionReviewTask.create!( + appeal: appeal, + parent: root_task, + assigned_to: user + ) + AttorneyTask.create!( + appeal: appeal, + parent: review_task, + assigned_to: attorney, + assigned_by: user + ) + $stdout.puts("You have created an Attorney task") + end + + ######################################################## + # Creates Judge Assign Tasks for the LegacyAppeals that have just been generated + # Scenario 3/5 + def create_judge_task_for_legacy_appeals(appeal, user) + # User should be a judge + root_task = RootTask.find_or_create_by!(appeal: appeal) + + JudgeAssignTask.create!( + appeal: appeal, + parent: root_task, + assigned_to: user + ) + $stdout.puts("You have created a Judge task") + end + + ######################################################## + # Creates Review Tasks for the LegacyAppeals that have just been generated + # Scenario 6/7 + def create_review_task_for_legacy_appeals(appeal, user) + # User should be a judge + root_task = RootTask.find_or_create_by!(appeal: appeal) + + JudgeDecisionReviewTask.create!( + appeal: appeal, + parent: root_task, + assigned_to: user + ) + $stdout.puts("You have created a Review task") + end + + def create_task(task_type, appeal, user, attorney) + if task_type == "HEARINGTASK" + create_hearing_task_for_legacy_appeals(appeal) + elsif task_type == "ATTORNEYTASK" && user.judge_in_vacols? && attorney.attorney_in_vacols? + create_attorney_task_for_legacy_appeals(appeal, user, attorney) + elsif task_type == "JUDGETASK" && user.judge_in_vacols? + create_judge_task_for_legacy_appeals(appeal, user) + elsif task_type == "REVIEWTASK" && user.judge_in_vacols? + create_review_task_for_legacy_appeals(appeal, user) + end + end + ######################################################## # Create Postgres LegacyAppeals based on VACOLS Cases # # AND # # Create Postgres Request Issues based on VACOLS Issues - def build_the_cases_in_caseflow(cases) + def build_the_cases_in_caseflow(cases, task_type, user, attorney) vacols_ids = cases.map(&:bfkey) issues = VACOLS::CaseIssue.where(isskey: vacols_ids).group_by(&:isskey) - cases.map do |case_record| AppealRepository.build_appeal(case_record).tap do |appeal| appeal.issues = (issues[appeal.vacols_id] || []).map { |issue| Issue.load_from_vacols(issue.attributes) } end.save! + if TASK_CREATION + appeal = LegacyAppeal.find_or_initialize_by(vacols_id: case_record.bfkey) + create_task(task_type, appeal, user, attorney) + end end end @@ -114,7 +210,6 @@ namespace :db do # veterans_with_250_appeals = vets.last(3).pluck(:file_number) - else veterans_with_like_45_appeals = %w[011899917 011899918] @@ -122,11 +217,30 @@ namespace :db do end # request CSS ID for task assignment - STDOUT.puts("Enter the CSS ID of the user that you want to assign these appeals to") - STDOUT.puts("Hint: an Attorney User for demo env is BVASCASPER1, and UAT is TCASEY_JUDGE and CGRAHAM_JUDGE") - css_id = STDIN.gets.chomp.upcase + $stdout.puts("Enter the CSS ID of the user that you want to assign these appeals to") + $stdout.puts("Hint: an Attorney User for demo env is BVASCASPER1, and UAT is TCASEY_JUDGE and CGRAHAM_JUDGE") + css_id = $stdin.gets.chomp.upcase user = User.find_by_css_id(css_id) + if TASK_CREATION + $stdout.puts("Which type of tasks do you want to add to these Legacy Appeals?") + $stdout.puts("Hint: Options include 'HearingTask', 'JudgeTask', 'AttorneyTask', 'ReviewTask', and 'DistributionTask'") + task_type = $stdin.gets.chomp.upcase + end + + if task_type == "ATTORNEYTASK" && user.judge_in_vacols? + $stdout.puts("Which attorney do you want to assign the Attorney Task to?") + $stdout.puts("Hint: Options include 'BVASCASPER1', 'BVARERDMAN', 'BVALSHIELDS'") + css_id = $stdin.gets.chomp.upcase + attorney = User.find_by_css_id(css_id) + elsif task_type == "ATTORNEYTASK" && user.attorney_in_vacols? + $stdout.puts("Which Judge do you want to assign the Judge Decision Review Task to?") + $stdout.puts("Hint: Options include 'BVAEBECKER', 'BVAKKEELING', 'BVAAABSHIRE'") + attorney = user + css_id = $stdin.gets.chomp.upcase + user = User.find_by_css_id(css_id) + end + fail ActiveRecord::RecordNotFound unless user # increment docket number for each case @@ -134,8 +248,9 @@ namespace :db do veterans_with_like_45_appeals.each do |file_number| docket_number += 1 - LegacyAppealFactory.stamp_out_legacy_appeals(5, file_number, user, docket_number) + LegacyAppealFactory.stamp_out_legacy_appeals(5, file_number, user, attorney, docket_number, task_type) end + $stdout.puts("You have created Legacy Appeals") # veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals(250, file_number, user) } end end From e9babbe2e7bef17462be7f509db5fa849088f72f Mon Sep 17 00:00:00 2001 From: cacevesva <109166981+cacevesva@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:49:07 -0700 Subject: [PATCH 055/203] Rubocop changes for rake task (#19022) --- lib/tasks/seed_legacy_appeals.rake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/tasks/seed_legacy_appeals.rake b/lib/tasks/seed_legacy_appeals.rake index 1ea7281b05b..b03cb54025c 100644 --- a/lib/tasks/seed_legacy_appeals.rake +++ b/lib/tasks/seed_legacy_appeals.rake @@ -3,14 +3,18 @@ # to create legacy appeals with MST/PACT issues, run "bundle exec rake 'db:generate_legacy_appeals[true]'"" # to create legacy appeals with AMA Tasks added, run "bundle exec rake db:generate_legacy_appeals[false,true]" # to create without, run "bundle exec rake db:generate_legacy_appeals" +# rubocop:disable Lint/ConstantDefinitionInBlock + namespace :db do desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" task :generate_legacy_appeals, [:add_special_issues, :task_creation] => :environment do |_, args| ADD_SPECIAL_ISSUES = args.add_special_issues == "true" TASK_CREATION = args.task_creation == "true" + class LegacyAppealFactory class << self # Stamping out appeals like mufflers! + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, attorney, docket_number, task_type) bfcurloc = VACOLS::Staff.find_by(sdomainid: user.css_id).slogid @@ -60,6 +64,7 @@ namespace :db do end.compact build_the_cases_in_caseflow(cases, task_type, user, attorney) + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength end def custom_folder_attributes(veteran, docket_number) @@ -159,6 +164,7 @@ namespace :db do $stdout.puts("You have created a Review task") end + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def create_task(task_type, appeal, user, attorney) if task_type == "HEARINGTASK" create_hearing_task_for_legacy_appeals(appeal) @@ -169,6 +175,7 @@ namespace :db do elsif task_type == "REVIEWTASK" && user.judge_in_vacols? create_review_task_for_legacy_appeals(appeal, user) end + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity end ######################################################## @@ -224,7 +231,8 @@ namespace :db do if TASK_CREATION $stdout.puts("Which type of tasks do you want to add to these Legacy Appeals?") - $stdout.puts("Hint: Options include 'HearingTask', 'JudgeTask', 'AttorneyTask', 'ReviewTask', and 'DistributionTask'") + $stdout.puts("Hint: Options include 'HearingTask', 'JudgeTask', 'AttorneyTask', + 'ReviewTask', and 'DistributionTask'") task_type = $stdin.gets.chomp.upcase end @@ -251,7 +259,9 @@ namespace :db do LegacyAppealFactory.stamp_out_legacy_appeals(5, file_number, user, attorney, docket_number, task_type) end $stdout.puts("You have created Legacy Appeals") - # veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals(250, file_number, user) } + # veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals + # (250, file_number, user) } end end end +# rubocop:enable Lint/ConstantDefinitionInBlock From f6a180d9da8d313c4d732199c31ad98daeb6b479 Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Mon, 24 Jul 2023 15:53:55 -0500 Subject: [PATCH 056/203] Kamalam7/appeals 24911 b (#19046) * Action dropdown for cancel blocking task and advance to judge * reverse function * spec fixes * Feature toggle to showup the dropdown --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../legacy_tasks/attorney_legacy_task.rb | 18 +++++++++++++++--- app/repositories/task_action_repository.rb | 3 +-- app/workflows/tasks_for_appeal.rb | 3 ++- client/COPY.json | 1 + client/app/queue/utils.js | 6 ++++++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index d56e266d978..22968abec3c 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -7,12 +7,18 @@ def available_actions(current_user, role) # so we use the absence of this value to indicate that there is no case assignment and return no actions. return [] unless task_id - if current_user&.judge_in_vacols? || current_user&.can_act_on_behalf_of_judges? + if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && + (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") + [ + Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h + ] + elsif (current_user&.judge_in_vacols? || current_user&.can_act_on_behalf_of_judges?) && + FeatureToggle.enabled?(:vlj_legacy_appeal) [ Constants.TASK_ACTIONS.REASSIGN_TO_JUDGE.to_h, Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h ] - elsif current_user&.attorney? || role == "attorney" + elsif role == "attorney" && current_user == assigned_to [ Constants.TASK_ACTIONS.REVIEW_LEGACY_DECISION.to_h, Constants.TASK_ACTIONS.SUBMIT_OMO_REQUEST_FOR_REVIEW.to_h, @@ -28,6 +34,12 @@ def timeline_title end def label - COPY::ATTORNEY_REWRITE_TASK_LABEL + return false if appeal.case_record.nil? + + if (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") && FeatureToggle.enabled?(:vlj_legacy_appeal) + COPY::ATTORNEY_REWRITE_TASK_LEGACY_LABEL + else + COPY::ATTORNEY_REWRITE_TASK_LABEL + end end end diff --git a/app/repositories/task_action_repository.rb b/app/repositories/task_action_repository.rb index 143b50608e1..00d6ad3805c 100644 --- a/app/repositories/task_action_repository.rb +++ b/app/repositories/task_action_repository.rb @@ -575,8 +575,7 @@ def blocked_special_case_movement_data(task, _user = nil) def blocked_special_case_movement_data_legacy(task, _user = nil) { options: users_to_options(Judge.list_all), - type: BlockedSpecialCaseMovementTask.name, - blocking_tasks: task.visible_blocking_tasks.map(&:serialize_for_cancellation) + type: BlockedSpecialCaseMovementTask.name } end diff --git a/app/workflows/tasks_for_appeal.rb b/app/workflows/tasks_for_appeal.rb index b2b4d641447..e0e4c543b15 100644 --- a/app/workflows/tasks_for_appeal.rb +++ b/app/workflows/tasks_for_appeal.rb @@ -67,7 +67,8 @@ def tasks_actionable_to_vso_employee end def only_root_task? - !appeal.tasks.active.where(type: RootTask.name).empty? + !appeal.tasks.active.where(type: RootTask.name).empty? || + !appeal.tasks.active.where(type: ScheduleHearingTask.name).empty? end def all_tasks_except_for_decision_review_tasks diff --git a/client/COPY.json b/client/COPY.json index e8f3428213d..aeb2fe9f1d5 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -803,6 +803,7 @@ "ATTORNEY_TASK_LABEL": "Draft decision", "ATTORNEY_TASK_NOTES_PREFIX": "Attorney draft decision notes:", "ATTORNEY_REWRITE_TASK_LABEL": "Revise decision draft", + "ATTORNEY_REWRITE_TASK_LEGACY_LABEL": "Distribution Task", "ATTORNEY_REWRITE_TASK_NOTES_PREFIX": "Attorney rewrite decision notes:", "ATTORNEY_QUALITY_REVIEW_TASK_LABEL": "Quality review", "ATTORNEY_DISPATCH_RETURN_TASK_LABEL": "Revise decision (BVA Dispatch)", diff --git a/client/app/queue/utils.js b/client/app/queue/utils.js index 0490cc72bd0..c0733b35b18 100644 --- a/client/app/queue/utils.js +++ b/client/app/queue/utils.js @@ -890,6 +890,12 @@ export const sortCaseTimelineEvents = (...eventArrays) => { // Reverse the array for the order we actually want // return sortedTimelineEvents.reverse(); + if (timelineEvents[0].appealType === 'LegacyAppeal') { + if (timelineEvents[0].assigneeName === '57' || timelineEvents[0].assigneeName === 'CASEFLOW') { + return sortedTimelineEvents.reverse(); + } + } + return sortedTimelineEvents; }; From db315c97345186379efa8e7c6391008a892fd24e Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 24 Jul 2023 17:33:10 -0400 Subject: [PATCH 057/203] Calvin/appeals 25907 fixes (#19054) * Assigning hearings to BVA * updated rake * added sdomainid back --- lib/tasks/seed_legacy_appeals.rake | 65 +++++++++++++++++------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/lib/tasks/seed_legacy_appeals.rake b/lib/tasks/seed_legacy_appeals.rake index b03cb54025c..b9118dbf5d9 100644 --- a/lib/tasks/seed_legacy_appeals.rake +++ b/lib/tasks/seed_legacy_appeals.rake @@ -3,7 +3,6 @@ # to create legacy appeals with MST/PACT issues, run "bundle exec rake 'db:generate_legacy_appeals[true]'"" # to create legacy appeals with AMA Tasks added, run "bundle exec rake db:generate_legacy_appeals[false,true]" # to create without, run "bundle exec rake db:generate_legacy_appeals" -# rubocop:disable Lint/ConstantDefinitionInBlock namespace :db do desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" @@ -14,15 +13,26 @@ namespace :db do class LegacyAppealFactory class << self # Stamping out appeals like mufflers! - # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, attorney, docket_number, task_type) - bfcurloc = VACOLS::Staff.find_by(sdomainid: user.css_id).slogid + unless user == "Bva" + bfcurloc = VACOLS::Staff.find_by(sdomainid: user.css_id).slogid + sattyid = user.id + sdomainid = user.css_id + deatty = user.id + end # Changes location of vacols based on if you want a hearing task or only a distribution task + # Assign to BVA? if task_type == "HEARINGTASK" bfcurloc = 57 + sattyid = 5 + sdomainid = Bva.singleton.type + deatty = 5 elsif task_type == "DISTRIBUTIONTASK" bfcurloc = 81 + sattyid = 5 + sdomainid = Bva.singleton.type + deatty = 5 end veteran = Veteran.find_by_file_number(file_number) @@ -52,19 +62,19 @@ namespace :db do bfddec: nil }, staff_attrs: { - sattyid: user.id, - sdomainid: user.css_id + sattyid: sattyid, + sdomainid: sdomainid }, decass_attrs: { defolder: key, - deatty: user.id, + deatty: deatty, dereceive: "2020-11-17 00:00:00 UTC" } ) end.compact build_the_cases_in_caseflow(cases, task_type, user, attorney) - # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength + # rubocop:enable, Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength end def custom_folder_attributes(veteran, docket_number) @@ -164,7 +174,6 @@ namespace :db do $stdout.puts("You have created a Review task") end - # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def create_task(task_type, appeal, user, attorney) if task_type == "HEARINGTASK" create_hearing_task_for_legacy_appeals(appeal) @@ -175,7 +184,7 @@ namespace :db do elsif task_type == "REVIEWTASK" && user.judge_in_vacols? create_review_task_for_legacy_appeals(appeal, user) end - # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity + # rubocop:enable end ######################################################## @@ -223,28 +232,29 @@ namespace :db do # veterans_with_250_appeals = %w[011899906 011899999] end - # request CSS ID for task assignment - $stdout.puts("Enter the CSS ID of the user that you want to assign these appeals to") - $stdout.puts("Hint: an Attorney User for demo env is BVASCASPER1, and UAT is TCASEY_JUDGE and CGRAHAM_JUDGE") - css_id = $stdin.gets.chomp.upcase - user = User.find_by_css_id(css_id) - if TASK_CREATION $stdout.puts("Which type of tasks do you want to add to these Legacy Appeals?") $stdout.puts("Hint: Options include 'HearingTask', 'JudgeTask', 'AttorneyTask', 'ReviewTask', and 'DistributionTask'") task_type = $stdin.gets.chomp.upcase - end - - if task_type == "ATTORNEYTASK" && user.judge_in_vacols? - $stdout.puts("Which attorney do you want to assign the Attorney Task to?") - $stdout.puts("Hint: Options include 'BVASCASPER1', 'BVARERDMAN', 'BVALSHIELDS'") - css_id = $stdin.gets.chomp.upcase - attorney = User.find_by_css_id(css_id) - elsif task_type == "ATTORNEYTASK" && user.attorney_in_vacols? - $stdout.puts("Which Judge do you want to assign the Judge Decision Review Task to?") - $stdout.puts("Hint: Options include 'BVAEBECKER', 'BVAKKEELING', 'BVAAABSHIRE'") - attorney = user + if task_type == ("JUDGETASK" || "ATTORNEYTASK" || "REVIEWTASK") + $stdout.puts("Enter the CSS ID of the judge user that you want to assign these appeals to") + $stdout.puts("Hint: a Judge use is BVAAWAKEFIELD") + css_id = $stdin.gets.chomp.upcase + user = User.find_by_css_id(css_id) + if task_type == "ATTORNEYTASK" && user.judge_in_vacols? + $stdout.puts("Which attorney do you want to assign the Attorney Task to?") + $stdout.puts("Hint: Options include 'BVASCASPER1', 'BVARERDMAN', 'BVALSHIELDS'") + css_id = $stdin.gets.chomp.upcase + attorney = User.find_by_css_id(css_id) + end + else + user = "Bva" + end + else + # request CSS ID for task assignment + $stdout.puts("Enter the CSS ID of the user that you want to assign these appeals to") + $stdout.puts("Hint: an Attorney User for demo env is BVASCASPER1, and UAT is TCASEY_JUDGE and CGRAHAM_JUDGE") css_id = $stdin.gets.chomp.upcase user = User.find_by_css_id(css_id) end @@ -256,7 +266,7 @@ namespace :db do veterans_with_like_45_appeals.each do |file_number| docket_number += 1 - LegacyAppealFactory.stamp_out_legacy_appeals(5, file_number, user, attorney, docket_number, task_type) + LegacyAppealFactory.stamp_out_legacy_appeals(1, file_number, user, attorney, docket_number, task_type) end $stdout.puts("You have created Legacy Appeals") # veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals @@ -264,4 +274,3 @@ namespace :db do end end end -# rubocop:enable Lint/ConstantDefinitionInBlock From b5cc8fc7795649156c7b6f0bbaeacd1edf565b8a Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Tue, 25 Jul 2023 17:12:07 -0400 Subject: [PATCH 058/203] fixed conditional for attorney and review tasks (#19064) --- lib/tasks/seed_legacy_appeals.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/seed_legacy_appeals.rake b/lib/tasks/seed_legacy_appeals.rake index b9118dbf5d9..2c2a1edf51b 100644 --- a/lib/tasks/seed_legacy_appeals.rake +++ b/lib/tasks/seed_legacy_appeals.rake @@ -237,14 +237,14 @@ namespace :db do $stdout.puts("Hint: Options include 'HearingTask', 'JudgeTask', 'AttorneyTask', 'ReviewTask', and 'DistributionTask'") task_type = $stdin.gets.chomp.upcase - if task_type == ("JUDGETASK" || "ATTORNEYTASK" || "REVIEWTASK") + if task_type == "JUDGETASK" || task_type == "ATTORNEYTASK" || task_type == "REVIEWTASK" $stdout.puts("Enter the CSS ID of the judge user that you want to assign these appeals to") - $stdout.puts("Hint: a Judge use is BVAAWAKEFIELD") + $stdout.puts("Hint: Judge Options include 'BVAAWAKEFIELD', 'BVAEBECKER', 'BVAAABSHIRE'") css_id = $stdin.gets.chomp.upcase user = User.find_by_css_id(css_id) if task_type == "ATTORNEYTASK" && user.judge_in_vacols? $stdout.puts("Which attorney do you want to assign the Attorney Task to?") - $stdout.puts("Hint: Options include 'BVASCASPER1', 'BVARERDMAN', 'BVALSHIELDS'") + $stdout.puts("Hint: Attorney Options include 'BVASCASPER1', 'BVARERDMAN', 'BVALSHIELDS'") css_id = $stdin.gets.chomp.upcase attorney = User.find_by_css_id(css_id) end From 572c150397a41157e21ccfddda1ced361aae2665 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Wed, 26 Jul 2023 14:21:15 -0400 Subject: [PATCH 059/203] =?UTF-8?q?adding=20the=20labels=20and=20dropdown?= =?UTF-8?q?=20actions=20for=20special=20case=20movement=20user=E2=80=A6=20?= =?UTF-8?q?(#19068)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * adding the labels and dropdown actions for special case movement users with no blocking tasks * removing the caseflow option * refactoring conditions for the attorney legacy task model --- app/models/legacy_tasks/attorney_legacy_task.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index 22968abec3c..a639c73f5ea 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -7,11 +7,14 @@ def available_actions(current_user, role) # so we use the absence of this value to indicate that there is no case assignment and return no actions. return [] unless task_id - if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && - (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") - [ - Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h - ] + if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") + [ + Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h + ] + elsif current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && %w[81 33].include?(appeal.case_record.reload.bfcurloc) + [ + Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h + ] elsif (current_user&.judge_in_vacols? || current_user&.can_act_on_behalf_of_judges?) && FeatureToggle.enabled?(:vlj_legacy_appeal) [ @@ -36,7 +39,7 @@ def timeline_title def label return false if appeal.case_record.nil? - if (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") && FeatureToggle.enabled?(:vlj_legacy_appeal) + if (%w[81 57 33].include?(appeal.case_record.reload.bfcurloc) || appeal.case_record.reload.bfcurloc == "CASEFLOW") && FeatureToggle.enabled?(:vlj_legacy_appeal) COPY::ATTORNEY_REWRITE_TASK_LEGACY_LABEL else COPY::ATTORNEY_REWRITE_TASK_LABEL From c07209f38fb6865f8d5e77a16f8ffafc0277c62d Mon Sep 17 00:00:00 2001 From: cacevesva <109166981+cacevesva@users.noreply.github.com> Date: Wed, 26 Jul 2023 12:06:32 -0700 Subject: [PATCH 060/203] Caceves/appeals 25308 rubocop fixes (#19069) * adding the labels and dropdown actions for special case movement users with no blocking tasks * removing the caseflow option * refactoring conditions for the attorney legacy task model * Fix rubocop style offenses --------- Co-authored-by: vinner57 <128258952+vinner57@users.noreply.github.com> --- .../legacy_tasks/attorney_legacy_task.rb | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index a639c73f5ea..bb91c0da0f4 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -7,14 +7,16 @@ def available_actions(current_user, role) # so we use the absence of this value to indicate that there is no case assignment and return no actions. return [] unless task_id - if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") - [ - Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h - ] - elsif current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && %w[81 33].include?(appeal.case_record.reload.bfcurloc) - [ - Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h - ] + if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && + (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") + [ + Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h + ] + elsif current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && + %w[81 33].include?(appeal.case_record.reload.bfcurloc) + [ + Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h + ] elsif (current_user&.judge_in_vacols? || current_user&.can_act_on_behalf_of_judges?) && FeatureToggle.enabled?(:vlj_legacy_appeal) [ @@ -39,7 +41,9 @@ def timeline_title def label return false if appeal.case_record.nil? - if (%w[81 57 33].include?(appeal.case_record.reload.bfcurloc) || appeal.case_record.reload.bfcurloc == "CASEFLOW") && FeatureToggle.enabled?(:vlj_legacy_appeal) + if (%w[81 57 + 33].include?(appeal.case_record.reload.bfcurloc) || appeal.case_record.reload.bfcurloc == "CASEFLOW") && + FeatureToggle.enabled?(:vlj_legacy_appeal) COPY::ATTORNEY_REWRITE_TASK_LEGACY_LABEL else COPY::ATTORNEY_REWRITE_TASK_LABEL From dfd52e2d1d0ea654876bf3ea4977871fae746d13 Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Mon, 31 Jul 2023 12:34:17 -0400 Subject: [PATCH 061/203] Block Special Case Movement for Legacy Appeal - Scenario1 (#19075) * Secenario 1 * Refactor de code and delete BlockedAdvancesToJudgetLegacyView * fix issue when cancel and advances to judge * fixed vacols location update to use the vacols_id * Show reason and details in correct order --------- Co-authored-by: Calvin Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/controllers/tasks_controller.rb | 6 +- .../legacy_tasks/attorney_legacy_task.rb | 1 + app/models/task.rb | 58 ++- app/models/tasks/hearing_task.rb | 21 ++ app/repositories/task_action_repository.rb | 16 +- .../queue/BlockedAdvanceToJudgeLegacyView.jsx | 333 ------------------ .../app/queue/BlockedAdvanceToJudgeView.jsx | 99 ++++-- client/app/queue/QueueApp.jsx | 7 +- 8 files changed, 163 insertions(+), 378 deletions(-) delete mode 100644 client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index d742a8261ba..c6d7c7c3038 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -93,8 +93,12 @@ def create tasks << valid_task_classes[task_type.to_sym].create_many_from_params(param_group, current_user) end modified_tasks = [parent_tasks_from_params, tasks].flatten.uniq + if modified_tasks[0].appeal_type != "LegacyAppeal" + render json: { tasks: json_tasks(modified_tasks) } + else + render json: {} + end - render json: { tasks: json_tasks(modified_tasks) } rescue ActiveRecord::RecordInvalid => error invalid_record_error(error.record) rescue Caseflow::Error::MailRoutingError => error diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index bb91c0da0f4..3e362f53487 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class AttorneyLegacyTask < LegacyTask + def available_actions(current_user, role) # AttorneyLegacyTasks are drawn from the VACOLS.BRIEFF table but should not be actionable unless there is a case # assignment in the VACOLS.DECASS table. task_id is created using the created_at field from the VACOLS.DECASS table diff --git a/app/models/task.rb b/app/models/task.rb index d83debbca71..9cab76924ad 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -218,9 +218,40 @@ def create_from_params(params, user) verify_user_can_create!(user, parent_task) params = modify_params_for_create(params) - child = create_child_task(parent_task, user, params) - parent_task.update!(status: params[:status]) if params[:status] - child + if parent_task.appeal_type == "LegacyAppeal" && parent_task.type == "HearingTask" + cancel_blocking_task_legacy(params, parent_task) + else + child = create_child_task(parent_task, user, params) + parent_task.update!(status: params[:status]) if params[:status] + child + end + end + + def cancel_blocking_task_legacy(params, parent_task) + tasks = [] + tasks.push(parent_task) + parent_task.children.each { |current_task| tasks.push(current_task) } + + transaction do + tasks.each do |task| + task.update!( + status: Constants.TASK_STATUSES.cancelled, + cancelled_by_id: RequestStore[:current_user]&.id, + closed_at: Time.zone.now + ) + end + end + + legacy_appeal = LegacyAppeal.find(tasks[0].appeal_id) + judge = User.find(params["assigned_to_id"]) + + JudgeAssignTask.create!(appeal: legacy_appeal, + parent: legacy_appeal.root_task, + assigned_to: judge, + # cancellation_reason: params[:instructions][0], + instructions: params[:instructions], + assigned_by: params["assigned_by"]) + AppealRepository.update_location!(legacy_appeal, judge.vacols_uniq_id) end def parent_of_same_type_has_same_assignee(parent_task, params) @@ -714,16 +745,6 @@ def descendants [self, children.map(&:descendants)].flatten end - def ancestor_task_of_type(task_type) - return nil unless parent - - parent.is_a?(task_type) ? parent : parent.ancestor_task_of_type(task_type) - end - - def previous_task - nil - end - def cancel_task_and_child_subtasks # Cancel all descendants at the same time to avoid after_update hooks marking some tasks as completed. # it would be better if we could allow the callbacks to happen sanely @@ -732,7 +753,6 @@ def cancel_task_and_child_subtasks # by avoiding callbacks, we aren't saving PaperTrail versions # Manually save the state before and after. tasks = Task.open.where(id: descendant_ids) - transaction do tasks.each { |task| task.paper_trail.save_with_version } tasks.update_all( @@ -744,6 +764,16 @@ def cancel_task_and_child_subtasks end end + def ancestor_task_of_type(task_type) + return nil unless parent + + parent.is_a?(task_type) ? parent : parent.ancestor_task_of_type(task_type) + end + + def previous_task + nil + end + # :reek:FeatureEnvy def version_summary versions.map do |version| diff --git a/app/models/tasks/hearing_task.rb b/app/models/tasks/hearing_task.rb index 0a9ea70133a..8045b70c96b 100644 --- a/app/models/tasks/hearing_task.rb +++ b/app/models/tasks/hearing_task.rb @@ -21,6 +21,27 @@ def default_instructions [COPY::HEARING_TASK_DEFAULT_INSTRUCTIONS] end + def available_actions(user) + return [] unless user + + if !appeal.is_a?(Appeal) + if !any_active_distribution_task_legacy + return [Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT.to_h] + end + end + end + + def any_active_distribution_task_legacy + tasks = Task.where(appeal_type: "LegacyAppeal", appeal_id: appeal.id) + tasks.active.of_type(:DistributionTask).any? + end + + def visible_blocking_tasks + visible_descendants = descendants.reject(&:hide_from_case_timeline).select(&:open?) + + visible_descendants - [self] + end + def cancel_and_recreate hearing_task = HearingTask.create!( appeal: appeal, diff --git a/app/repositories/task_action_repository.rb b/app/repositories/task_action_repository.rb index 00d6ad3805c..d73e79c24f2 100644 --- a/app/repositories/task_action_repository.rb +++ b/app/repositories/task_action_repository.rb @@ -573,10 +573,18 @@ def blocked_special_case_movement_data(task, _user = nil) end def blocked_special_case_movement_data_legacy(task, _user = nil) - { - options: users_to_options(Judge.list_all), - type: BlockedSpecialCaseMovementTask.name - } + if task.appeal.is_a?(LegacyAppeal) + { + options: users_to_options(Judge.list_all), + type: BlockedSpecialCaseMovementTask.name + } + else + { + options: users_to_options(Judge.list_all), + type: BlockedSpecialCaseMovementTask.name, + blocking_tasks: task.visible_blocking_tasks.map(&:serialize_for_cancellation) + } + end end def toggle_timed_hold(task, user) diff --git a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx b/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx deleted file mode 100644 index dcbb977d9eb..00000000000 --- a/client/app/queue/BlockedAdvanceToJudgeLegacyView.jsx +++ /dev/null @@ -1,333 +0,0 @@ -import * as React from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; -import { withRouter } from 'react-router-dom'; -import { sprintf } from 'sprintf-js'; -import { css } from 'glamor'; - -import COPY from '../../COPY'; - -import { onReceiveAmaTasks } from './QueueActions'; -import { requestSave, resetSuccessMessages, highlightInvalidFormItems } from './uiReducer/uiActions'; -import { taskActionData } from './utils'; -import { taskById, appealWithDetailSelector } from './selectors'; - -import QueueFlowPage from './components/QueueFlowPage'; -import SearchableDropdown from '../components/SearchableDropdown'; -import TextareaField from '../components/TextareaField'; -import RadioField from '../components/RadioField'; -import Modal from '../components/Modal'; -import Alert from '../components/Alert'; - -const ADVANCEMENT_REASONS = [ - 'Death dismissal', - 'Withdrawal', - 'Medical', - 'Other' -]; - -const caseInfoStyling = css({ - '& span': { marginRight: '30px' } -}); - -const bottomBorderStyling = css({ - borderBottom: '.1rem solid lightgray', - paddingBottom: '15px', - marginBottom: '15px' -}); - -const bottomMarginStyling = css({ - marginBottom: '1.6rem' -}); - -class BlockedAdvanceToJudgeLegacyView extends React.Component { - constructor(props) { - super(props); - - this.state = { - cancellationInstructions: '', - error: null, - instructions: '', - selectedAssignee: null, - selectedReason: null, - showModal: false, - disableButton: true, - modalDisableButton: true - }; - } - - componentDidMount = () => this.props.resetSuccessMessages(); - - validAssignee = () => this.state.selectedAssignee !== null; - validInstructions = () => this.state.instructions.length > 0; - validCancellationInstructions = () => this.state.cancellationInstructions.trim().length > 0; - validReason = () => this.state.selectedReason !== null; - - validatePage = () => this.validCancellationInstructions() && this.validReason(); - validateModal = () => this.validInstructions() && this.validAssignee(); - - goToNextStep = () => this.setState({ showModal: true }); - - actionData = () => taskActionData(this.props); - - getAssigneeLabel = () => { - let assignee = 'person'; - - this.actionData().options.forEach((opt) => { - if (opt.value === this.state.selectedAssignee) { - assignee = opt.label; - } - }); - - return assignee; - }; - - setOnChangeValue = (stateValue, value) => { - this.setState({ [stateValue]: value }, function () { - if ((this.state.selectedReason !== null && this.state.cancellationInstructions.trim().length > 0)) { - this.setState({ disableButton: false }); - } - if ((this.state.cancellationInstructions.trim().length === 0 && this.state.selectedReason !== null)) { - this.setState({ disableButton: true }); - } - }); - } - - setModalOnChangeValue = (stateValue, value) => { - this.setState({ [stateValue]: value }, function () { - if (this.state.selectedAssignee !== null && this.state.instructions.trim().length > 0) { - this.setState({ modalDisableButton: false }); - } else { - this.setState({ modalDisableButton: true }); - } - }); - }; - - submit = () => { - if (!this.validateModal()) { - this.props.highlightInvalidFormItems(true); - - return; - } - - const { appeal, task } = this.props; - - const payload = { - data: { - tasks: [ - { - type: this.actionData().type, - external_id: appeal.externalId, - parent_id: task.taskId, - assigned_to_id: this.state.selectedAssignee, - assigned_to_type: 'User', - // cancellation_reason: `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions.trim()}`, - instructions: [this.state.instructions, - `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions.trim()}`] - } - ] - } - }; - - const assignedByListItem = () => { - const assignor = task.assignedBy.firstName ? - this.getAbbrevName(task.assignedBy) : - null; - - return assignor; - }; - - const successMessage = { - title: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ, - assignedByListItem(), - this.getAssigneeLabel()), - detail: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ_MESSAGE_DETAIL) - }; - - return this.props. - requestSave('/tasks', payload, successMessage). - then((resp) => { - this.props.history.replace(`/queue/appeals/${appeal.externalId}`); - this.props.onReceiveAmaTasks(resp.body.tasks.data); - }). - catch((err) => { - this.setState({ - error: { - title: sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_ERROR_TITLE, this.getAssigneeLabel()), - details: JSON.parse(err?.message)?.errors[0]?.detail - } - }); - }); - }; - - blockingTaskListItem = (blockingTask) => -
  • {blockingTask.type} - assigned to: {this.blockingTaskAssigneeLink(blockingTask)}
  • ; - - blockingTaskAssigneeLink = (blockingTask) => { - const { appeal } = this.props; - - if (blockingTask.assigned_to_email) { - const body = `Case Link: ${window.location.origin}/queue/appeals/${appeal.externalId}`, - emailAddress = blockingTask.assigned_to_email, - subject = `${blockingTask.type}: ${appeal.veteranFullName}`; - - return {blockingTask.assigned_to_name}; - } - - return blockingTask.assigned_to_name; - } - - modalAlert = () => { - if (!this.state.error) { - return; - } - - return {this.state.error.details}; - } - - warningModal = () => { - if (!this.state.showModal) { - return; - } - - const { highlightFormItems } = this.props; - - const options = this.actionData().options; - const selectedJudgeName = this.getAssigneeLabel() || 'judge'; - - return
    - this.setState({ showModal: false }) - }, { - classNames: ['usa-button-hover', 'usa-button-warning'], - name: COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_SUBMIT, - disabled: this.state.modalDisableButton, - onClick: this.submit - }]} - closeHandler={() => this.setState({ showModal: false })} - > - {this.modalAlert()} -
    - Please Note: {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}
    - Cancellation of task(s) are final. -
    -

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_JUDGE_HEADER}

    - this.setModalOnChangeValue('selectedAssignee', option ? option.value : null)} - options={options} - /> -

    {sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_INSTRUCTIONS_HEADER, selectedJudgeName)}

    - this.setModalOnChangeValue('instructions', value)} - value={this.state.instructions} - /> -
    -
    ; - } - - render = () => { - const { highlightFormItems, appeal } = this.props; - - const blockingTasks = this.actionData().blocking_tasks; - - return - {this.warningModal()} - -

    {sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TITLE, appeal.veteranFullName)}

    -
    - Veteran ID: {appeal.veteranFileNumber} - Task: Reassign -
    -
    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}
    -

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER}

    -
      {blockingTasks.map((blockingTask) => this.blockingTaskListItem(blockingTask))}
    -

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER}

    - { - return { displayText: reason, value: reason }; - })} - id="advancementReason" - value={this.state.selectedReason} - onChange={(value) => this.setOnChangeValue('selectedReason', value)} - vertical={false} - /> - this.setOnChangeValue('cancellationInstructions', value)} - value={this.state.cancellationInstructions} - /> -
    -
    ; - }; -} - -BlockedAdvanceToJudgeLegacyView.propTypes = { - appeal: PropTypes.shape({ - externalId: PropTypes.string, - id: PropTypes.string, - veteranFullName: PropTypes.string, - veteranFileNumber: PropTypes.string, - }), - highlightInvalidFormItems: PropTypes.func, - highlightFormItems: PropTypes.bool, - history: PropTypes.object, - onReceiveAmaTasks: PropTypes.func, - requestSave: PropTypes.func, - resetSuccessMessages: PropTypes.func, - task: PropTypes.shape({ - instructions: PropTypes.string, - taskId: PropTypes.string, - assignedBy: PropTypes.string - }) -}; - -const mapStateToProps = (state, ownProps) => { - return { - highlightFormItems: state.ui.highlightFormItems, - task: taskById(state, { taskId: ownProps.taskId }), - appeal: appealWithDetailSelector(state, ownProps) - }; -}; - -const mapDispatchToProps = (dispatch) => - bindActionCreators( - { - requestSave, - onReceiveAmaTasks, - resetSuccessMessages, - highlightInvalidFormItems - }, - dispatch - ); - -export default withRouter( - connect( - mapStateToProps, - mapDispatchToProps - )(BlockedAdvanceToJudgeLegacyView) -); diff --git a/client/app/queue/BlockedAdvanceToJudgeView.jsx b/client/app/queue/BlockedAdvanceToJudgeView.jsx index e2cb037e2f9..19453157749 100644 --- a/client/app/queue/BlockedAdvanceToJudgeView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeView.jsx @@ -11,7 +11,7 @@ import COPY from '../../COPY'; import { onReceiveAmaTasks } from './QueueActions'; import { requestSave, resetSuccessMessages, highlightInvalidFormItems } from './uiReducer/uiActions'; import { taskActionData } from './utils'; -import { taskById, appealWithDetailSelector } from './selectors'; +import { taskById, appealWithDetailSelector, allHearingTasksForAppeal } from './selectors'; import QueueFlowPage from './components/QueueFlowPage'; import SearchableDropdown from '../components/SearchableDropdown'; @@ -51,7 +51,9 @@ class BlockedAdvanceToJudgeView extends React.Component { instructions: '', selectedAssignee: null, selectedReason: null, - showModal: false + showModal: false, + disableButton: true, + modalDisableButton: true }; } @@ -81,6 +83,27 @@ class BlockedAdvanceToJudgeView extends React.Component { return assignee; }; + setOnChangeValue = (stateValue, value) => { + this.setState({ [stateValue]: value }, function () { + if ((this.state.selectedReason !== null && this.state.cancellationInstructions.trim().length > 0)) { + this.setState({ disableButton: false }); + } + if ((this.state.cancellationInstructions.trim().length === 0 && this.state.selectedReason !== null)) { + this.setState({ disableButton: true }); + } + }); + } + + setModalOnChangeValue = (stateValue, value) => { + this.setState({ [stateValue]: value }, function () { + if (this.state.selectedAssignee !== null && this.state.instructions.trim().length > 0) { + this.setState({ modalDisableButton: false }); + } else { + this.setState({ modalDisableButton: true }); + } + }); + }; + submit = () => { if (!this.validateModal()) { this.props.highlightInvalidFormItems(true); @@ -88,7 +111,9 @@ class BlockedAdvanceToJudgeView extends React.Component { return; } - const { appeal, task } = this.props; + const { appeal, task, allHearingTasks } = this.props; + + const hearingTaskId = allHearingTasks[0].id; const payload = { data: { @@ -96,28 +121,50 @@ class BlockedAdvanceToJudgeView extends React.Component { { type: this.actionData().type, external_id: appeal.externalId, - parent_id: task.taskId, + parent_id: task.appealType === 'LegacyAppeal' ? hearingTaskId : task.taskId, assigned_to_id: this.state.selectedAssignee, assigned_to_type: 'User', instructions: [ - `${this.state.selectedReason}: ${this.state.cancellationInstructions}`, - this.state.instructions + this.state.instructions, + `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions}` + ] } ] } }; - const successMessage = { - title: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE, this.getAssigneeLabel()), - detail: this.actionData().message_detail + const assignedByListItem = () => { + const assignor = task.assignedBy.firstName ? + `${task.assignedBy.firstName.substring(0, 1)}. ${task.assignedBy.lastName}` : + null; + + return assignor; }; + let successMessage = ''; + + if (appeal.isLegacyAppeal) { + successMessage = { + title: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ, + assignedByListItem(), + this.getAssigneeLabel()), + detail: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ_MESSAGE_DETAIL) + }; + } else { + successMessage = { + title: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE, this.getAssigneeLabel()), + detail: this.actionData().message_detail + }; + } + return this.props. requestSave('/tasks', payload, successMessage). then((resp) => { this.props.history.replace(`/queue/appeals/${appeal.externalId}`); - this.props.onReceiveAmaTasks(resp.body.tasks.data); + if (resp.body !== null) { + this.props.onReceiveAmaTasks(resp.body.tasks.data); + } }). catch((err) => { this.setState({ @@ -169,15 +216,15 @@ class BlockedAdvanceToJudgeView extends React.Component { title={COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_TITLE} buttons={[{ classNames: ['usa-button', 'cf-btn-link'], - name: 'Close', + name: 'Cancel', onClick: () => this.setState({ showModal: false }) }, { - classNames: ['usa-button-secondary', 'usa-button-hover', 'usa-button-warning'], + classNames: ['usa-button-hover', 'usa-button-warning'], name: COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_SUBMIT, + disabled: this.state.modalDisableButton, onClick: this.submit }]} closeHandler={() => this.setState({ showModal: false })} - icon="warning" > {this.modalAlert()}
    @@ -191,7 +238,7 @@ class BlockedAdvanceToJudgeView extends React.Component { hideLabel errorMessage={this.props.highlightFormItems && !this.validAssignee() ? COPY.FORM_ERROR_FIELD_REQUIRED : null} value={this.state.selectedAssignee} - onChange={(option) => this.setState({ selectedAssignee: option ? option.value : null })} + onChange={(option) => this.setModalOnChangeValue('selectedAssignee', option ? option.value : null)} options={options} />

    {sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_INSTRUCTIONS_HEADER, selectedJudgeName)}

    @@ -199,7 +246,7 @@ class BlockedAdvanceToJudgeView extends React.Component { required errorMessage={highlightFormItems && !this.validInstructions() ? 'Judge instructions field is required' : null} id="judgeInstructions" - onChange={(value) => this.setState({ instructions: value })} + onChange={(value) => this.setModalOnChangeValue('instructions', value)} value={this.state.instructions} /> @@ -208,8 +255,11 @@ class BlockedAdvanceToJudgeView extends React.Component { render = () => { const { highlightFormItems, appeal } = this.props; + let blockingTasks; - const blockingTasks = this.actionData().blocking_tasks; + if (!appeal.isLegacyAppeal) { + blockingTasks = this.actionData().blocking_tasks; + } return {this.warningModal()} @@ -218,6 +268,7 @@ class BlockedAdvanceToJudgeView extends React.Component { validateForm={this.validatePage} appealId={appeal.externalId} hideCancelButton + disableNext={this.state.disableButton} >

    {sprintf(COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TITLE, appeal.veteranFullName)}

    @@ -226,7 +277,7 @@ class BlockedAdvanceToJudgeView extends React.Component {
    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER}

    -
      {blockingTasks.map((blockingTask) => this.blockingTaskListItem(blockingTask))}
    + {(!appeal.isLegacyAppeal) &&
      {blockingTasks.map((blockingTask) => this.blockingTaskListItem(blockingTask))}
    }

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER}

    this.setState({ selectedReason: value })} + onChange={(value) => this.setOnChangeValue('selectedReason', value)} vertical={false} /> this.setState({ cancellationInstructions: value })} + onChange={(value) => this.setOnChangeValue('cancellationInstructions', value)} value={this.state.cancellationInstructions} /> @@ -259,23 +310,31 @@ BlockedAdvanceToJudgeView.propTypes = { id: PropTypes.string, veteranFullName: PropTypes.string, veteranFileNumber: PropTypes.string, + isLegacyAppeal: PropTypes.bool }), highlightInvalidFormItems: PropTypes.func, highlightFormItems: PropTypes.bool, history: PropTypes.object, onReceiveAmaTasks: PropTypes.func, requestSave: PropTypes.func, + rootTask: PropTypes.object, resetSuccessMessages: PropTypes.func, + allHearingTasks: PropTypes.array, task: PropTypes.shape({ instructions: PropTypes.string, - taskId: PropTypes.string + taskId: PropTypes.string, + assignedBy: PropTypes.string, + appealType: PropTypes.string }) }; const mapStateToProps = (state, ownProps) => { + const appeal = appealWithDetailSelector(state, ownProps); + return { highlightFormItems: state.ui.highlightFormItems, task: taskById(state, { taskId: ownProps.taskId }), + allHearingTasks: allHearingTasksForAppeal(state, { appealId: appeal?.externalId }), appeal: appealWithDetailSelector(state, ownProps) }; }; diff --git a/client/app/queue/QueueApp.jsx b/client/app/queue/QueueApp.jsx index 5bbc1b2f48e..299a3c2840e 100644 --- a/client/app/queue/QueueApp.jsx +++ b/client/app/queue/QueueApp.jsx @@ -41,7 +41,6 @@ import TeamAssignTaskListView from './TeamAssignTaskListView'; import EvaluateDecisionView from './caseEvaluation/EvaluateDecisionView'; import AddColocatedTaskView from './colocatedTasks/AddColocatedTaskView'; import BlockedAdvanceToJudgeView from './BlockedAdvanceToJudgeView'; -import BlockedAdvanceToJudgeLegacyView from './BlockedAdvanceToJudgeLegacyView'; import AddCavcRemandView from './cavc/AddCavcRemandView'; import AddCavcDatesModal from './cavc/AddCavcDatesModal'; import CompleteTaskModal from './components/CompleteTaskModal'; @@ -274,10 +273,6 @@ class QueueApp extends React.PureComponent { ); - routedBlockedCaseMovementLegacy = (props) => ( - - ); - routedAddCavcRemand = (props) => ( ); @@ -849,7 +844,7 @@ class QueueApp extends React.PureComponent { path={`/queue/appeals/:appealId/tasks/:taskId/${ TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.value }`} - render={this.routedBlockedCaseMovementLegacy} + render={this.routedBlockedCaseMovement} /> Date: Wed, 2 Aug 2023 15:05:06 -0400 Subject: [PATCH 062/203] reverting to cancel and return task for legacy attorney task (#19113) --- app/models/tasks/attorney_task.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tasks/attorney_task.rb b/app/models/tasks/attorney_task.rb index 283a41e946e..4f2f9c06637 100644 --- a/app/models/tasks/attorney_task.rb +++ b/app/models/tasks/attorney_task.rb @@ -29,7 +29,7 @@ def available_actions(user) movement_actions = if appeal.is_a?(LegacyAppeal) && FeatureToggle.enable!(:vlj_legacy_appeal) [ Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h, - Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.to_h + Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h ] else [ From fcd5cf051c6fae7513ed3d743a733aa8e7853ad9 Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Wed, 9 Aug 2023 12:05:27 -0500 Subject: [PATCH 063/203] Case movement modal no blocking task (#19102) * Case movement modal no blocking task * Advance to judge from attorney legacy task * task controller changes and spec fixes --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/controllers/tasks_controller.rb | 15 ++-- .../legacy_tasks/attorney_legacy_task.rb | 5 +- app/models/task.rb | 76 ++++++++++++++--- client/app/queue/AssignToView.jsx | 84 +++++++++++++------ client/app/queue/selectors.js | 11 ++- .../queue/scm_judge_assignment_spec.rb | 4 +- 6 files changed, 144 insertions(+), 51 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index c6d7c7c3038..720d1a9c02e 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -93,12 +93,7 @@ def create tasks << valid_task_classes[task_type.to_sym].create_many_from_params(param_group, current_user) end modified_tasks = [parent_tasks_from_params, tasks].flatten.uniq - if modified_tasks[0].appeal_type != "LegacyAppeal" - render json: { tasks: json_tasks(modified_tasks) } - else - render json: {} - end - + render json: { tasks: json_tasks(modified_tasks) } rescue ActiveRecord::RecordInvalid => error invalid_record_error(error.record) rescue Caseflow::Error::MailRoutingError => error @@ -369,6 +364,14 @@ def create_params .merge(appeal: appeal) task = task.merge(assigned_to_type: User.name) if !task[:assigned_to_type] + + if appeal.is_a?(LegacyAppeal) + if task[:type] == "BlockedSpecialCaseMovementTask" || task[:type] == "SpecialCaseMovementTask" + task = task.merge(external_id: params["tasks"][0]["external_id"], + legacy_task_type: params["tasks"][0]["legacy_task_type"], + appeal_type: params["tasks"][0]["appeal_type"]) + end + end task end end diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index 3e362f53487..6cb330fe04f 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true class AttorneyLegacyTask < LegacyTask - def available_actions(current_user, role) # AttorneyLegacyTasks are drawn from the VACOLS.BRIEFF table but should not be actionable unless there is a case # assignment in the VACOLS.DECASS table. task_id is created using the created_at field from the VACOLS.DECASS table @@ -39,6 +38,10 @@ def timeline_title COPY::CASE_TIMELINE_ATTORNEY_TASK end + def actions_allowable?(_user) + true + end + def label return false if appeal.case_record.nil? diff --git a/app/models/task.rb b/app/models/task.rb index 9cab76924ad..bd765fae145 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -185,6 +185,20 @@ def verify_user_can_create!(user, parent) end&.any? do |action| action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option.dig(:value) == name } end + if !parent&.actions_allowable?(user) || !can_create + user_description = user ? "User #{user.id}" : "nil User" + parent_description = parent ? " from #{parent.class.name} #{parent.id}" : "" + message = "#{user_description} cannot assign #{name}#{parent_description}." + fail Caseflow::Error::ActionForbiddenError, message: message + end + end + + def verify_user_can_create_legacy!(user, parent) + can_create = parent&.available_actions(user, "SCM")&.map do |action| + parent.build_action_hash(action, user) + end&.any? do |action| + action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option.dig(:value) == name } + end if !parent&.actions_allowable?(user) || !can_create user_description = user ? "User #{user.id}" : "nil User" @@ -212,21 +226,44 @@ def any_recently_updated(*tasks_arrays) end def create_from_params(params, user) - parent_task = Task.find(params[:parent_id]) - fail Caseflow::Error::ChildTaskAssignedToSameUser if parent_of_same_type_has_same_assignee(parent_task, params) - - verify_user_can_create!(user, parent_task) + parent_task = create_parent_task(params, user) params = modify_params_for_create(params) - if parent_task.appeal_type == "LegacyAppeal" && parent_task.type == "HearingTask" - cancel_blocking_task_legacy(params, parent_task) - else + + if parent_task.appeal_type == "LegacyAppeal" + speacial_case_for_legacy(parent_task, params) + else # regular appeal child = create_child_task(parent_task, user, params) parent_task.update!(status: params[:status]) if params[:status] child end end + def create_parent_task(params, user) + parent_task = {} + if (params[:appeal_type] == "LegacyAppeal") && (params[:legacy_task_type] == "AttorneyLegacyTask") + if params[:type] == "SpecialCaseMovementTask" || params[:type] == "BlockedSpecialCaseMovementTask" + parent_task = LegacyWorkQueue.tasks_by_appeal_id(params[:external_id])[0] + verify_user_can_create_legacy!(user, parent_task) + parent_task = Task.find(params[:parent_id]) + end + else + parent_task = Task.find(params[:parent_id]) + fail Caseflow::Error::ChildTaskAssignedToSameUser if parent_of_same_type_has_same_assignee(parent_task, params) + + verify_user_can_create!(user, parent_task) + end + parent_task + end + + def speacial_case_for_legacy(parent_task, params) + if (params[:type] == "SpecialCaseMovementTask") && (parent_task.type == "RootTask") + create_judge_assigned_task_for_legacy(params, parent_task) + elsif (params[:type] == "BlockedSpecialCaseMovementTask") && (parent_task.type == "HearingTask") + cancel_blocking_task_legacy(params, parent_task) + end + end + def cancel_blocking_task_legacy(params, parent_task) tasks = [] tasks.push(parent_task) @@ -245,13 +282,26 @@ def cancel_blocking_task_legacy(params, parent_task) legacy_appeal = LegacyAppeal.find(tasks[0].appeal_id) judge = User.find(params["assigned_to_id"]) - JudgeAssignTask.create!(appeal: legacy_appeal, - parent: legacy_appeal.root_task, - assigned_to: judge, - # cancellation_reason: params[:instructions][0], - instructions: params[:instructions], - assigned_by: params["assigned_by"]) + current_child = JudgeAssignTask.create!(appeal: legacy_appeal, + parent: legacy_appeal.root_task, + assigned_to: judge, + instructions: params[:instructions], + assigned_by: params["assigned_by"]) + AppealRepository.update_location!(legacy_appeal, judge.vacols_uniq_id) + current_child + end + + def create_judge_assigned_task_for_legacy(params, parent_task) + legacy_appeal = LegacyAppeal.find(parent_task.appeal_id) + judge = User.find(params["assigned_to_id"]) + + current_child = JudgeAssignTask.create!(appeal: legacy_appeal, + parent: legacy_appeal.root_task, + assigned_to: judge, + instructions: params[:instructions], + assigned_by: params["assigned_by"]) AppealRepository.update_location!(legacy_appeal, judge.vacols_uniq_id) + current_child end def parent_of_same_type_has_same_assignee(parent_task, params) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index fe5510ac76a..bb8fe230439 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -7,7 +7,7 @@ import { sprintf } from 'sprintf-js'; import COPY from '../../COPY'; import VHA_VAMCS from '../../constants/VHA_VAMCS'; -import { taskById, appealWithDetailSelector } from './selectors'; +import { taskById, appealWithDetailSelector, getRootTaskLegacyAppealSCM } from './selectors'; import { onReceiveAmaTasks, legacyReassignToJudge, setOvertime, legacyReassignToAttorney } from './QueueActions'; @@ -75,7 +75,7 @@ class AssignToView extends React.Component { }; setModalOnChangeValue = (stateValue, value) => { - this.setState({ [stateValue]: value }, function() { + this.setState({ [stateValue]: value }, function () { if (this.state.instructions.trim().length > 0) { this.setState({ modalDisableButton: false }); } else { @@ -85,7 +85,7 @@ class AssignToView extends React.Component { } submit = () => { - const { appeal, task, isReassignAction, isTeamAssign } = this.props; + const { appeal, task, isReassignAction, isTeamAssign, rootTask } = this.props; const action = getAction(this.props); const isPulacCerullo = action && action.label === 'Pulac-Cerullo'; @@ -93,20 +93,42 @@ class AssignToView extends React.Component { const actionData = taskActionData(this.props); const taskType = actionData.type || 'Task'; - const payload = { - data: { - tasks: [ - { - type: taskType, - external_id: appeal.externalId, - parent_id: actionData.parent_id || task.taskId, - assigned_to_id: this.isVHAAssignToRegional() ? this.getVisn().value : this.state.selectedValue, - assigned_to_type: isTeamAssign ? 'Organization' : 'User', - instructions: this.state.instructions, - } - ] - } - }; + let payload = {}; + + if (task.appealType === 'LegacyAppeal' && taskType === 'SpecialCaseMovementTask' && + task.type === 'AttorneyLegacyTask') { + payload = { + data: { + tasks: [ + { + type: taskType, + external_id: appeal.externalId, + legacy_task_type: task.type, + appeal_type: task.appealType, + parent_id: rootTask, + assigned_to_id: this.isVHAAssignToRegional() ? this.getVisn().value : this.state.selectedValue, + assigned_to_type: isTeamAssign ? 'Organization' : 'User', + instructions: this.state.instructions, + } + ] + } + }; + } else { + payload = { + data: { + tasks: [ + { + type: taskType, + external_id: appeal.externalId, + parent_id: actionData.parent_id || task.taskId, + assigned_to_id: this.isVHAAssignToRegional() ? this.getVisn().value : this.state.selectedValue, + assigned_to_type: isTeamAssign ? 'Organization' : 'User', + instructions: this.state.instructions, + } + ] + } + }; + } const caseNameListItem = () => { const caseName = appeal.veteranFullName || null; @@ -126,7 +148,7 @@ class AssignToView extends React.Component { detail: sprintf(COPY.PULAC_CERULLO_SUCCESS_DETAIL, appeal.veteranFullName) }; - if (taskType == 'AttorneyRewriteTask' && task.isLegacy == true) { + if (taskType === 'AttorneyRewriteTask' && task.isLegacy === true) { return this.reassignTask(false, true); } @@ -165,7 +187,7 @@ class AssignToView extends React.Component { const splitAssignee = assignee.split(' '); if (splitAssignee.length >= 3) { - assignee = `${splitAssignee[0] } ${ splitAssignee[2]}`; + assignee = `${splitAssignee[0]} ${splitAssignee[2]}`; } return assignee; @@ -288,10 +310,14 @@ class AssignToView extends React.Component { } assignToVHARegionalOfficeRadioOptions = [ - { displayText: COPY.VHA_CAMO_ASSIGN_TO_REGIONAL_OFFICE_DROPDOWN_LABEL_VAMC, - value: 'vamc' }, - { displayText: COPY.VHA_CAMO_ASSIGN_TO_REGIONAL_OFFICE_DROPDOWN_LABEL_VISN, - value: 'visn' } + { + displayText: COPY.VHA_CAMO_ASSIGN_TO_REGIONAL_OFFICE_DROPDOWN_LABEL_VAMC, + value: 'vamc' + }, + { + displayText: COPY.VHA_CAMO_ASSIGN_TO_REGIONAL_OFFICE_DROPDOWN_LABEL_VISN, + value: 'visn' + } ] assignToVHARegionalOfficeRadioChanged = (option) => { @@ -385,11 +411,11 @@ class AssignToView extends React.Component { /> )} {this.isVHAAssignToRegional() && - this.state.assignToVHARegionalOfficeSelection === 'vamc' && - this.state.selectedValue !== null && ( + this.state.assignToVHARegionalOfficeSelection === 'vamc' && + this.state.selectedValue !== null && (
    VISN -
    { this.getVisn().label }
    +
    {this.getVisn().label}
    )}
    @@ -422,6 +448,7 @@ AssignToView.propTypes = { appeal: PropTypes.shape({ externalId: PropTypes.string, id: PropTypes.string, + appealId: PropTypes.string, veteranFullName: PropTypes.string }), assigneeAlreadySelected: PropTypes.bool, @@ -433,6 +460,7 @@ AssignToView.propTypes = { legacyReassignToAttorney: PropTypes.func, requestPatch: PropTypes.func, requestSave: PropTypes.func, + rootTask: PropTypes.func, task: PropTypes.shape({ instructions: PropTypes.string, taskId: PropTypes.string, @@ -449,11 +477,13 @@ AssignToView.propTypes = { const mapStateToProps = (state, ownProps) => { const { highlightFormItems } = state.ui; + const appeal = appealWithDetailSelector(state, ownProps); return { highlightFormItems, task: taskById(state, { taskId: ownProps.taskId }), - appeal: appealWithDetailSelector(state, ownProps) + appeal: appealWithDetailSelector(state, ownProps), + rootTask: getRootTaskLegacyAppealSCM(state, { appealId: appeal.id })[0].id }; }; diff --git a/client/app/queue/selectors.js b/client/app/queue/selectors.js index 1c154bff39a..db070dfec5f 100644 --- a/client/app/queue/selectors.js +++ b/client/app/queue/selectors.js @@ -89,6 +89,13 @@ export const getAllTasksForAppeal = createSelector( } ); +export const getRootTaskLegacyAppealSCM = createSelector( + [getAmaTasks], + (amaTasks) => { + return filter(amaTasks, (task) => task); + } +); + export const appealsByCaseflowVeteranId = createSelector( [appealsWithDetailsSelector, getCaseflowVeteranId], (appeals, caseflowVeteranId) => @@ -303,8 +310,8 @@ export const getLegacyTaskTree = createSelector( moment(judgeDecisionReviewTask.assignedOn)); return task.uniqueId !== judgeDecisionReviewTask.uniqueId && - timelineRange.contains(taskCreatedAt) && - timelineRange.contains(taskClosedAt); + timelineRange.contains(taskCreatedAt) && + timelineRange.contains(taskClosedAt); }) ); diff --git a/spec/feature/queue/scm_judge_assignment_spec.rb b/spec/feature/queue/scm_judge_assignment_spec.rb index b34110f01eb..f4ca117929e 100644 --- a/spec/feature/queue/scm_judge_assignment_spec.rb +++ b/spec/feature/queue/scm_judge_assignment_spec.rb @@ -143,7 +143,7 @@ click_dropdown(prompt: "Select a user", text: judge_two.full_name) instructions = "#{judge_one.full_name} is on leave. Please take over this case" fill_in("taskInstructions", with: instructions) - click_on("Submit") + click_on("Assign") expect(page).to have_content("Task reassigned to #{judge_two.full_name}") @@ -234,7 +234,7 @@ click_dropdown(propmt: "Select an action...", text: "Re-assign to a judge") click_dropdown(prompt: "Select a user", text: judge_two.full_name) fill_in("taskInstructions", with: "#{judge_one.full_name} is on leave. Please take over this case") - click_on("Submit") + click_on("Assign") expect(page).to have_content("Task reassigned to #{judge_two.full_name}") From 7084b9775fb009e8fe0adbc8c7f580f30064034a Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Wed, 9 Aug 2023 13:38:29 -0400 Subject: [PATCH 064/203] Updating the Scenario 1 Success banner (#19148) * Updating the Scenario 1 Success banner * reverting first and last change --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/BlockedAdvanceToJudgeView.jsx | 7 ++----- client/app/queue/SubmitDecisionView.jsx | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/client/app/queue/BlockedAdvanceToJudgeView.jsx b/client/app/queue/BlockedAdvanceToJudgeView.jsx index 19453157749..3de0a53cc66 100644 --- a/client/app/queue/BlockedAdvanceToJudgeView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeView.jsx @@ -135,9 +135,7 @@ class BlockedAdvanceToJudgeView extends React.Component { }; const assignedByListItem = () => { - const assignor = task.assignedBy.firstName ? - `${task.assignedBy.firstName.substring(0, 1)}. ${task.assignedBy.lastName}` : - null; + const assignor = appeal.veteranFullName || null; return assignor; }; @@ -147,8 +145,7 @@ class BlockedAdvanceToJudgeView extends React.Component { if (appeal.isLegacyAppeal) { successMessage = { title: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ, - assignedByListItem(), - this.getAssigneeLabel()), + assignedByListItem(), this.getAssigneeLabel()), detail: sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ_MESSAGE_DETAIL) }; } else { diff --git a/client/app/queue/SubmitDecisionView.jsx b/client/app/queue/SubmitDecisionView.jsx index 716b123bb9a..d531ffa84e5 100644 --- a/client/app/queue/SubmitDecisionView.jsx +++ b/client/app/queue/SubmitDecisionView.jsx @@ -104,7 +104,7 @@ class SubmitDecisionView extends React.PureComponent { } = this.props; const issuesToPass = decisionIssues; - const payload = buildCaseReviewPayload(checkoutFlow, decision, true, issuesToPass, { isLegacyAppeal: isLegacyAppeal }); + const payload = buildCaseReviewPayload(checkoutFlow, decision, true, issuesToPass, { isLegacyAppeal }); const fields = { type: checkoutFlow === DECISION_TYPES.DRAFT_DECISION ? 'decision' : 'outside medical opinion (OMO) request', @@ -114,7 +114,6 @@ class SubmitDecisionView extends React.PureComponent { const successMsg = `Thank you for drafting ${fields.veteran}'s ${fields.type}. It's been sent to ${fields.judge} for review.`; - try { const res = await this.props.requestSave(`/case_reviews/${taskId}/complete`, payload, { title: successMsg }); From 071e42c276f5da4cd3f2959a07f9fca8c2236688 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:11:35 -0400 Subject: [PATCH 065/203] Calvin/appeals 25975 (#19150) * created new file for task generation + fix issues * cleaned code + remove judge on attorney task * generator fixes * removed staff_attr --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../legacy_tasks/attorney_legacy_task.rb | 2 +- lib/tasks/seed_legacy_appeal_tasks.rake | 243 ++++++++++++++++++ lib/tasks/seed_legacy_appeals.rake | 167 ++---------- 3 files changed, 260 insertions(+), 152 deletions(-) create mode 100644 lib/tasks/seed_legacy_appeal_tasks.rake diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index 6cb330fe04f..70e5cf82e12 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -50,7 +50,7 @@ def label FeatureToggle.enabled?(:vlj_legacy_appeal) COPY::ATTORNEY_REWRITE_TASK_LEGACY_LABEL else - COPY::ATTORNEY_REWRITE_TASK_LABEL + COPY::ATTORNEY_TASK_LABEL end end end diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake new file mode 100644 index 00000000000..22b847c8a1e --- /dev/null +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -0,0 +1,243 @@ +# frozen_string_literal: true + +# to create legacy appeals with AMA Tasks added, run "bundle exec rake db:generate_legacy_appeals_with_tasks" +# then select an option between 'HearingTask', 'JudgeTask', 'AttorneyTask', 'ReviewTask', and 'Brieff_Curloc_81_Task' + +namespace :db do + desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" + task generate_legacy_appeals_with_tasks: :environment do + class LegacyAppealFactory + class << self + def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, docket_number, task_type) + # Changes location of vacols based on if you want a hearing task or only a legacy task in location 81 + bfcurloc = if task_type == "HEARINGTASK" + 57 + elsif task_type == "BRIEFF_CURLOC_81_TASK" + 81 + else + VACOLS::Staff.find_by(sdomainid: user.css_id).slogid + end + + veteran = Veteran.find_by_file_number(file_number) + + fail ActiveRecord::RecordNotFound unless veteran + + vacols_veteran_record = find_or_create_vacols_veteran(veteran) + + cases = Array.new(num_appeals_to_create).each_with_index.map do + key = VACOLS::Folder.maximum(:ticknum).next + Generators::Vacols::Case.create( + corres_exists: true, + folder_attrs: Generators::Vacols::Folder.folder_attrs.merge( + custom_folder_attributes(vacols_veteran_record, docket_number.to_s) + ), + case_attrs: { + bfcorkey: vacols_veteran_record.stafkey, + bfcorlid: vacols_veteran_record.slogid, + bfkey: key, + bfcurloc: bfcurloc, + bfmpro: "ACT", + bfddec: nil + }, + decass_attrs: custom_decass_attributes(key, user, task_type) + ) + end.compact + + build_the_cases_in_caseflow(cases, task_type, user) + # rubocop:enable, Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength + end + + def custom_folder_attributes(veteran, docket_number) + { + titrnum: veteran.slogid, + tiocuser: nil, + tinum: docket_number + } + end + + def custom_decass_attributes(key, user, task_type) + if task_type == "ATTORNEYTASK" && user&.attorney_in_vacols? + { + defolder: key, + deatty: user.id, + dereceive: "2020-11-17 00:00:00 UTC" + } + else + {} + end + end + + # Generators::Vacols::Case will create new correspondents, and I think it'll just be easier to + # update the cases created rather than mess with the generator's internals. + def find_or_create_vacols_veteran(veteran) + # Being naughty and calling a private method (it'd be cool to have this be public...) + vacols_veteran_record = VACOLS::Correspondent.send(:find_veteran_by_ssn, veteran.ssn).first + + return vacols_veteran_record if vacols_veteran_record + + Generators::Vacols::Correspondent.create( + Generators::Vacols::Correspondent.correspondent_attrs.merge( + ssalut: veteran.name_suffix, + snamef: veteran.first_name, + snamemi: veteran.middle_name, + snamel: veteran.last_name, + slogid: LegacyAppeal.convert_file_number_to_vacols(veteran.file_number) + ) + ) + end + + ######################################################## + # Creates Hearing Tasks for the LegacyAppeals that have just been generated + # Scenario 1 + def create_hearing_task_for_legacy_appeals(appeal) + root_task = RootTask.find_or_create_by!(appeal: appeal) + + hearing_task = HearingTask.create!( + appeal: appeal, + parent: root_task, + assigned_to: Bva.singleton + ) + ScheduleHearingTask.create!( + appeal: appeal, + parent: hearing_task, + assigned_to: Bva.singleton + ) + $stdout.puts("You have created a Hearing Task") + end + + ######################################################## + # Creates Attorney Tasks for the LegacyAppeals that have just been generated + # Scenario 4 + def create_attorney_task_for_legacy_appeals(appeal, user) + # Will need a judge user for judge decision review task and an attorney user for the subsequent Attorney Task + root_task = RootTask.find_or_create_by!(appeal: appeal) + + review_task = JudgeDecisionReviewTask.create!( + appeal: appeal, + parent: root_task, + assigned_to: User.find_by_css_id("BVAAABSHIRE") + ) + AttorneyTask.create!( + appeal: appeal, + parent: review_task, + assigned_to: user, + assigned_by: User.find_by_css_id("BVAAABSHIRE") + ) + $stdout.puts("You have created an Attorney task") + end + + ######################################################## + # Creates Judge Assign Tasks for the LegacyAppeals that have just been generated + # Scenario 3/5 + def create_judge_task_for_legacy_appeals(appeal, user) + # User should be a judge + root_task = RootTask.find_or_create_by!(appeal: appeal) + + JudgeAssignTask.create!( + appeal: appeal, + parent: root_task, + assigned_to: user + ) + $stdout.puts("You have created a Judge task") + end + + ######################################################## + # Creates Review Tasks for the LegacyAppeals that have just been generated + # Scenario 6/7 + def create_review_task_for_legacy_appeals(appeal, user) + # User should be a judge + root_task = RootTask.find_or_create_by!(appeal: appeal) + + JudgeDecisionReviewTask.create!( + appeal: appeal, + parent: root_task, + assigned_to: user + ) + $stdout.puts("You have created a Review task") + end + + def initialize_root_task_for_legacy_appeals(appeal) + RootTask.find_or_create_by!(appeal: appeal) + $stdout.puts("You have set the Location to 81") + end + + def create_task(task_type, appeal, user) + if task_type == "HEARINGTASK" + create_hearing_task_for_legacy_appeals(appeal) + elsif task_type == "ATTORNEYTASK" && user.attorney_in_vacols? + create_attorney_task_for_legacy_appeals(appeal, user) + elsif task_type == "JUDGETASK" && user.judge_in_vacols? + create_judge_task_for_legacy_appeals(appeal, user) + elsif task_type == "REVIEWTASK" && user.judge_in_vacols? + create_review_task_for_legacy_appeals(appeal, user) + elsif task_type == "BRIEFF_CURLOC_81_TASK" + initialize_root_task_for_legacy_appeals(appeal) + end + # rubocop:enable + end + + ######################################################## + # Create Postgres LegacyAppeals based on VACOLS Cases + # + # AND + # + # Create Postgres Request Issues based on VACOLS Issues + def build_the_cases_in_caseflow(cases, task_type, user) + vacols_ids = cases.map(&:bfkey) + + issues = VACOLS::CaseIssue.where(isskey: vacols_ids).group_by(&:isskey) + cases.map do |case_record| + AppealRepository.build_appeal(case_record).tap do |appeal| + appeal.issues = (issues[appeal.vacols_id] || []).map { |issue| Issue.load_from_vacols(issue.attributes) } + end.save! + appeal = LegacyAppeal.find_or_initialize_by(vacols_id: case_record.bfkey) + create_task(task_type, appeal, user) + end + end + end + + if Rails.env.development? || Rails.env.test? + vets = Veteran.first(5) + + veterans_with_like_45_appeals = vets[0..12].pluck(:file_number) + + else + veterans_with_like_45_appeals = %w[011899917 011899918] + + end + + $stdout.puts("Which type of tasks do you want to add to these Legacy Appeals?") + $stdout.puts("Hint: Options include 'HearingTask', 'JudgeTask', 'AttorneyTask', + 'ReviewTask', and 'Brieff_Curloc_81_Task'") + task_type = $stdin.gets.chomp.upcase + if task_type == "JUDGETASK" || task_type == "REVIEWTASK" + $stdout.puts("Enter the CSS ID of a judge user that you want to assign these appeals to") + $stdout.puts("Hint: Judge Options include 'BVAAABSHIRE', 'BVARERDMAN'") + css_id = $stdin.gets.chomp.upcase + user = User.find_by_css_id(css_id) + fail ArgumentError, "User must be a Judge in Vacols for a #{task_type}", caller unless user.judge_in_vacols? + elsif task_type == "ATTORNEYTASK" + $stdout.puts("Which attorney do you want to assign the Attorney Task to?") + $stdout.puts("Hint: Attorney Options include 'BVASCASPER1', 'BVARERDMAN', 'BVALSHIELDS'") + css_id = $stdin.gets.chomp.upcase + user = User.find_by_css_id(css_id) + fail ArgumentError, "User must be an Attorney in Vacols for a #{task_type}", caller unless user.attorney_in_vacols? + else + user = User.find_by_css_id("FAKE USER") + end + + fail ActiveRecord::RecordNotFound unless user + + # increment docket number for each case + docket_number = 9_000_000 + + veterans_with_like_45_appeals.each do |file_number| + docket_number += 1 + LegacyAppealFactory.stamp_out_legacy_appeals(1, file_number, user, docket_number, task_type) + end + $stdout.puts("You have created Legacy Appeals") + # veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals + # (250, file_number, user) } + end + end +end diff --git a/lib/tasks/seed_legacy_appeals.rake b/lib/tasks/seed_legacy_appeals.rake index 2c2a1edf51b..b28e7cecc22 100644 --- a/lib/tasks/seed_legacy_appeals.rake +++ b/lib/tasks/seed_legacy_appeals.rake @@ -1,40 +1,15 @@ # frozen_string_literal: true # to create legacy appeals with MST/PACT issues, run "bundle exec rake 'db:generate_legacy_appeals[true]'"" -# to create legacy appeals with AMA Tasks added, run "bundle exec rake db:generate_legacy_appeals[false,true]" # to create without, run "bundle exec rake db:generate_legacy_appeals" - namespace :db do desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" - task :generate_legacy_appeals, [:add_special_issues, :task_creation] => :environment do |_, args| + task :generate_legacy_appeals, [:add_special_issues] => :environment do |_, args| ADD_SPECIAL_ISSUES = args.add_special_issues == "true" - TASK_CREATION = args.task_creation == "true" - class LegacyAppealFactory class << self # Stamping out appeals like mufflers! - def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, attorney, docket_number, task_type) - unless user == "Bva" - bfcurloc = VACOLS::Staff.find_by(sdomainid: user.css_id).slogid - sattyid = user.id - sdomainid = user.css_id - deatty = user.id - end - - # Changes location of vacols based on if you want a hearing task or only a distribution task - # Assign to BVA? - if task_type == "HEARINGTASK" - bfcurloc = 57 - sattyid = 5 - sdomainid = Bva.singleton.type - deatty = 5 - elsif task_type == "DISTRIBUTIONTASK" - bfcurloc = 81 - sattyid = 5 - sdomainid = Bva.singleton.type - deatty = 5 - end - + def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, docket_number) veteran = Veteran.find_by_file_number(file_number) fail ActiveRecord::RecordNotFound unless veteran @@ -57,24 +32,23 @@ namespace :db do bfcorkey: vacols_veteran_record.stafkey, bfcorlid: vacols_veteran_record.slogid, bfkey: key, - bfcurloc: bfcurloc, + bfcurloc: VACOLS::Staff.find_by(sdomainid: user.css_id).slogid, bfmpro: "ACT", bfddec: nil }, staff_attrs: { - sattyid: sattyid, - sdomainid: sdomainid + sattyid: user.id, + sdomainid: user.css_id }, decass_attrs: { defolder: key, - deatty: deatty, + deatty: user.id, dereceive: "2020-11-17 00:00:00 UTC" } ) end.compact - build_the_cases_in_caseflow(cases, task_type, user, attorney) - # rubocop:enable, Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength + build_the_cases_in_caseflow(cases) end def custom_folder_attributes(veteran, docket_number) @@ -104,107 +78,21 @@ namespace :db do ) end - ######################################################## - # Creates Hearing Tasks for the LegacyAppeals that have just been generated - # Scenario 1 - def create_hearing_task_for_legacy_appeals(appeal) - root_task = RootTask.find_or_create_by!(appeal: appeal) - - hearing_task = HearingTask.create!( - appeal: appeal, - parent: root_task, - assigned_to: Bva.singleton - ) - ScheduleHearingTask.create!( - appeal: appeal, - parent: hearing_task, - assigned_to: Bva.singleton - ) - $stdout.puts("You have created a Hearing Task") - end - - ######################################################## - # Creates Attorney Tasks for the LegacyAppeals that have just been generated - # Scenario 4 - def create_attorney_task_for_legacy_appeals(appeal, user, attorney) - # Will need a judge user for judge decision review task and an attorney user for the subsequent Attorney Task - root_task = RootTask.find_or_create_by!(appeal: appeal) - - review_task = JudgeDecisionReviewTask.create!( - appeal: appeal, - parent: root_task, - assigned_to: user - ) - AttorneyTask.create!( - appeal: appeal, - parent: review_task, - assigned_to: attorney, - assigned_by: user - ) - $stdout.puts("You have created an Attorney task") - end - - ######################################################## - # Creates Judge Assign Tasks for the LegacyAppeals that have just been generated - # Scenario 3/5 - def create_judge_task_for_legacy_appeals(appeal, user) - # User should be a judge - root_task = RootTask.find_or_create_by!(appeal: appeal) - - JudgeAssignTask.create!( - appeal: appeal, - parent: root_task, - assigned_to: user - ) - $stdout.puts("You have created a Judge task") - end - - ######################################################## - # Creates Review Tasks for the LegacyAppeals that have just been generated - # Scenario 6/7 - def create_review_task_for_legacy_appeals(appeal, user) - # User should be a judge - root_task = RootTask.find_or_create_by!(appeal: appeal) - - JudgeDecisionReviewTask.create!( - appeal: appeal, - parent: root_task, - assigned_to: user - ) - $stdout.puts("You have created a Review task") - end - - def create_task(task_type, appeal, user, attorney) - if task_type == "HEARINGTASK" - create_hearing_task_for_legacy_appeals(appeal) - elsif task_type == "ATTORNEYTASK" && user.judge_in_vacols? && attorney.attorney_in_vacols? - create_attorney_task_for_legacy_appeals(appeal, user, attorney) - elsif task_type == "JUDGETASK" && user.judge_in_vacols? - create_judge_task_for_legacy_appeals(appeal, user) - elsif task_type == "REVIEWTASK" && user.judge_in_vacols? - create_review_task_for_legacy_appeals(appeal, user) - end - # rubocop:enable - end - ######################################################## # Create Postgres LegacyAppeals based on VACOLS Cases # # AND # # Create Postgres Request Issues based on VACOLS Issues - def build_the_cases_in_caseflow(cases, task_type, user, attorney) + def build_the_cases_in_caseflow(cases) vacols_ids = cases.map(&:bfkey) issues = VACOLS::CaseIssue.where(isskey: vacols_ids).group_by(&:isskey) + cases.map do |case_record| AppealRepository.build_appeal(case_record).tap do |appeal| appeal.issues = (issues[appeal.vacols_id] || []).map { |issue| Issue.load_from_vacols(issue.attributes) } end.save! - if TASK_CREATION - appeal = LegacyAppeal.find_or_initialize_by(vacols_id: case_record.bfkey) - create_task(task_type, appeal, user, attorney) - end end end @@ -232,32 +120,11 @@ namespace :db do # veterans_with_250_appeals = %w[011899906 011899999] end - if TASK_CREATION - $stdout.puts("Which type of tasks do you want to add to these Legacy Appeals?") - $stdout.puts("Hint: Options include 'HearingTask', 'JudgeTask', 'AttorneyTask', - 'ReviewTask', and 'DistributionTask'") - task_type = $stdin.gets.chomp.upcase - if task_type == "JUDGETASK" || task_type == "ATTORNEYTASK" || task_type == "REVIEWTASK" - $stdout.puts("Enter the CSS ID of the judge user that you want to assign these appeals to") - $stdout.puts("Hint: Judge Options include 'BVAAWAKEFIELD', 'BVAEBECKER', 'BVAAABSHIRE'") - css_id = $stdin.gets.chomp.upcase - user = User.find_by_css_id(css_id) - if task_type == "ATTORNEYTASK" && user.judge_in_vacols? - $stdout.puts("Which attorney do you want to assign the Attorney Task to?") - $stdout.puts("Hint: Attorney Options include 'BVASCASPER1', 'BVARERDMAN', 'BVALSHIELDS'") - css_id = $stdin.gets.chomp.upcase - attorney = User.find_by_css_id(css_id) - end - else - user = "Bva" - end - else - # request CSS ID for task assignment - $stdout.puts("Enter the CSS ID of the user that you want to assign these appeals to") - $stdout.puts("Hint: an Attorney User for demo env is BVASCASPER1, and UAT is TCASEY_JUDGE and CGRAHAM_JUDGE") - css_id = $stdin.gets.chomp.upcase - user = User.find_by_css_id(css_id) - end + # request CSS ID for task assignment + STDOUT.puts("Enter the CSS ID of the user that you want to assign these appeals to") + STDOUT.puts("Hint: an Attorney User for demo env is BVASCASPER1, and UAT is TCASEY_JUDGE and CGRAHAM_JUDGE") + css_id = STDIN.gets.chomp.upcase + user = User.find_by_css_id(css_id) fail ActiveRecord::RecordNotFound unless user @@ -266,11 +133,9 @@ namespace :db do veterans_with_like_45_appeals.each do |file_number| docket_number += 1 - LegacyAppealFactory.stamp_out_legacy_appeals(1, file_number, user, attorney, docket_number, task_type) + LegacyAppealFactory.stamp_out_legacy_appeals(5, file_number, user, docket_number) end - $stdout.puts("You have created Legacy Appeals") - # veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals - # (250, file_number, user) } + # veterans_with_250_appeals.each { |file_number| LegacyAppealFactory.stamp_out_legacy_appeals(250, file_number, user) } end end end From ca74907ff7cef89127efef053b815b94c467a0ec Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Mon, 14 Aug 2023 10:13:44 -0400 Subject: [PATCH 066/203] Update scenario1 (#19149) * Update scenario1 * Update task.rb fix name of function special_case_for_legacy --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/controllers/tasks_controller.rb | 10 +-- app/models/task.rb | 53 ++++++++++---- app/models/tasks/hearing_task.rb | 20 ------ client/app/queue/AssignToView.jsx | 2 - .../app/queue/BlockedAdvanceToJudgeView.jsx | 70 +++++++++++++------ 5 files changed, 97 insertions(+), 58 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 720d1a9c02e..90c820cacd3 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -92,8 +92,10 @@ def create param_groups.each do |task_type, param_group| tasks << valid_task_classes[task_type.to_sym].create_many_from_params(param_group, current_user) end + modified_tasks = [parent_tasks_from_params, tasks].flatten.uniq render json: { tasks: json_tasks(modified_tasks) } + rescue ActiveRecord::RecordInvalid => error invalid_record_error(error.record) rescue Caseflow::Error::MailRoutingError => error @@ -106,6 +108,7 @@ def create # assigned_to_id: 23 # } def update + Task.transaction do tasks = task.update_from_params(update_params, current_user) tasks.each { |t| return invalid_record_error(t) unless t.valid? } @@ -366,10 +369,9 @@ def create_params task = task.merge(assigned_to_type: User.name) if !task[:assigned_to_type] if appeal.is_a?(LegacyAppeal) - if task[:type] == "BlockedSpecialCaseMovementTask" || task[:type] == "SpecialCaseMovementTask" - task = task.merge(external_id: params["tasks"][0]["external_id"], - legacy_task_type: params["tasks"][0]["legacy_task_type"], - appeal_type: params["tasks"][0]["appeal_type"]) + if (task[:type] == "BlockedSpecialCaseMovementTask" || task[:type] == "SpecialCaseMovementTask") + task = task.merge(external_id: params["tasks"][0]["external_id"], legacy_task_type: params["tasks"][0]["legacy_task_type"], + appeal_type: params["tasks"][0]["appeal_type"]) end end task diff --git a/app/models/task.rb b/app/models/task.rb index bd765fae145..bcd7a434b79 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -180,6 +180,7 @@ def cannot_have_children end def verify_user_can_create!(user, parent) + can_create = parent&.available_actions(user)&.map do |action| parent.build_action_hash(action, user) end&.any? do |action| @@ -231,12 +232,39 @@ def create_from_params(params, user) params = modify_params_for_create(params) if parent_task.appeal_type == "LegacyAppeal" - speacial_case_for_legacy(parent_task, params) - else # regular appeal + special_case_for_legacy(parent_task, params) + else #regular appeal child = create_child_task(parent_task, user, params) parent_task.update!(status: params[:status]) if params[:status] child end + + end + + + def create_parent_task(params, user) + parent_task = { } + if (params[:appeal_type] == 'LegacyAppeal' and params[:legacy_task_type] == 'AttorneyLegacyTask') + if (params[:type] == "SpecialCaseMovementTask" || params[:type] == "BlockedSpecialCaseMovementTask") + parent_task = LegacyWorkQueue.tasks_by_appeal_id(params[:external_id])[0] + verify_user_can_create_legacy!(user, parent_task) + parent_task = Task.find(params[:parent_id]) + end + else + parent_task = Task.find(params[:parent_id]) + fail Caseflow::Error::ChildTaskAssignedToSameUser if parent_of_same_type_has_same_assignee(parent_task, params) + verify_user_can_create!(user, parent_task) + end + return parent_task + end + + + def special_case_for_legacy(parent_task, params) + if (params[:type] == "SpecialCaseMovementTask" and parent_task.type == "RootTask") + create_judge_assigned_task_for_legacy(params, parent_task) + elsif (params[:type] == "BlockedSpecialCaseMovementTask" and parent_task.type == "HearingTask") + cancel_blocking_task_legacy(params, parent_task) + end end def create_parent_task(params, user) @@ -283,12 +311,13 @@ def cancel_blocking_task_legacy(params, parent_task) judge = User.find(params["assigned_to_id"]) current_child = JudgeAssignTask.create!(appeal: legacy_appeal, - parent: legacy_appeal.root_task, - assigned_to: judge, - instructions: params[:instructions], - assigned_by: params["assigned_by"]) + parent: legacy_appeal.root_task, + assigned_to: judge, + instructions: params[:instructions], + assigned_by: params["assigned_by"]) AppealRepository.update_location!(legacy_appeal, judge.vacols_uniq_id) - current_child + return current_child + end def create_judge_assigned_task_for_legacy(params, parent_task) @@ -296,12 +325,12 @@ def create_judge_assigned_task_for_legacy(params, parent_task) judge = User.find(params["assigned_to_id"]) current_child = JudgeAssignTask.create!(appeal: legacy_appeal, - parent: legacy_appeal.root_task, - assigned_to: judge, - instructions: params[:instructions], - assigned_by: params["assigned_by"]) + parent: legacy_appeal.root_task, + assigned_to: judge, + instructions: params[:instructions], + assigned_by: params["assigned_by"]) AppealRepository.update_location!(legacy_appeal, judge.vacols_uniq_id) - current_child + return current_child end def parent_of_same_type_has_same_assignee(parent_task, params) diff --git a/app/models/tasks/hearing_task.rb b/app/models/tasks/hearing_task.rb index 8045b70c96b..b5dff61b783 100644 --- a/app/models/tasks/hearing_task.rb +++ b/app/models/tasks/hearing_task.rb @@ -21,26 +21,6 @@ def default_instructions [COPY::HEARING_TASK_DEFAULT_INSTRUCTIONS] end - def available_actions(user) - return [] unless user - - if !appeal.is_a?(Appeal) - if !any_active_distribution_task_legacy - return [Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT.to_h] - end - end - end - - def any_active_distribution_task_legacy - tasks = Task.where(appeal_type: "LegacyAppeal", appeal_id: appeal.id) - tasks.active.of_type(:DistributionTask).any? - end - - def visible_blocking_tasks - visible_descendants = descendants.reject(&:hide_from_case_timeline).select(&:open?) - - visible_descendants - [self] - end def cancel_and_recreate hearing_task = HearingTask.create!( diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index bb8fe230439..41bf4e1f677 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -86,13 +86,11 @@ class AssignToView extends React.Component { submit = () => { const { appeal, task, isReassignAction, isTeamAssign, rootTask } = this.props; - const action = getAction(this.props); const isPulacCerullo = action && action.label === 'Pulac-Cerullo'; const actionData = taskActionData(this.props); const taskType = actionData.type || 'Task'; - let payload = {}; if (task.appealType === 'LegacyAppeal' && taskType === 'SpecialCaseMovementTask' && diff --git a/client/app/queue/BlockedAdvanceToJudgeView.jsx b/client/app/queue/BlockedAdvanceToJudgeView.jsx index 3de0a53cc66..5b9bfe8e4f0 100644 --- a/client/app/queue/BlockedAdvanceToJudgeView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeView.jsx @@ -112,27 +112,55 @@ class BlockedAdvanceToJudgeView extends React.Component { } const { appeal, task, allHearingTasks } = this.props; + const actionData = taskActionData(this.props); + const taskType = actionData.type || 'Task'; const hearingTaskId = allHearingTasks[0].id; - const payload = { - data: { - tasks: [ - { - type: this.actionData().type, - external_id: appeal.externalId, - parent_id: task.appealType === 'LegacyAppeal' ? hearingTaskId : task.taskId, - assigned_to_id: this.state.selectedAssignee, - assigned_to_type: 'User', - instructions: [ - this.state.instructions, - `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions}` - - ] - } - ] - } - }; + let payload = {}; + + if (task.appealType === 'LegacyAppeal' && taskType === 'BlockedSpecialCaseMovementTask' && + task.type === 'AttorneyLegacyTask') { + payload = { + data: { + tasks: [ + { + type: this.actionData().type, + external_id: appeal.externalId, + legacy_task_type: task.type, + appeal_type: task.appealType, + parent_id: hearingTaskId, + assigned_to_id: this.state.selectedAssignee, + assigned_to_type: 'User', + instructions: [ + this.state.instructions, + `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions}` + + ] + } + ] + } + }; + } else { + payload = { + data: { + tasks: [ + { + type: this.actionData().type, + external_id: appeal.externalId, + parent_id: task.appealType === 'LegacyAppeal' ? hearingTaskId : task.taskId, + assigned_to_id: this.state.selectedAssignee, + assigned_to_type: 'User', + instructions: [ + this.state.instructions, + `${this.state.selectedReason.trim()}: ${this.state.cancellationInstructions}` + + ] + } + ] + } + }; + } const assignedByListItem = () => { const assignor = appeal.veteranFullName || null; @@ -274,7 +302,8 @@ class BlockedAdvanceToJudgeView extends React.Component {
    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER}

    - {(!appeal.isLegacyAppeal) &&
      {blockingTasks.map((blockingTask) => this.blockingTaskListItem(blockingTask))}
    } + {(!appeal.isLegacyAppeal) &&
      {blockingTasks.map((blockingTask) => + this.blockingTaskListItem(blockingTask))}
    }

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER}

    Date: Tue, 15 Aug 2023 10:48:19 -0400 Subject: [PATCH 067/203] Reassign Case page Task(s) not displaying (#19155) * Reassign Case page Task(s) not displaying * Update BlockedAdvanceToJudgeView.jsx fix spelling error * Update selectors.js fix spelling error --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../app/queue/BlockedAdvanceToJudgeView.jsx | 18 +++++------- client/app/queue/selectors.js | 28 +++++++++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/client/app/queue/BlockedAdvanceToJudgeView.jsx b/client/app/queue/BlockedAdvanceToJudgeView.jsx index 5b9bfe8e4f0..91abcd5cd18 100644 --- a/client/app/queue/BlockedAdvanceToJudgeView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeView.jsx @@ -11,7 +11,7 @@ import COPY from '../../COPY'; import { onReceiveAmaTasks } from './QueueActions'; import { requestSave, resetSuccessMessages, highlightInvalidFormItems } from './uiReducer/uiActions'; import { taskActionData } from './utils'; -import { taskById, appealWithDetailSelector, allHearingTasksForAppeal } from './selectors'; +import { taskById, appealWithDetailSelector, allHearingTasksForAppeal, getAllHiringChildren } from './selectors'; import QueueFlowPage from './components/QueueFlowPage'; import SearchableDropdown from '../components/SearchableDropdown'; @@ -279,12 +279,8 @@ class BlockedAdvanceToJudgeView extends React.Component { } render = () => { - const { highlightFormItems, appeal } = this.props; - let blockingTasks; - - if (!appeal.isLegacyAppeal) { - blockingTasks = this.actionData().blocking_tasks; - } + const { highlightFormItems, appeal, currentChildren } = this.props; + const blockingTasks = appeal.isLegacyAppeal ? currentChildren : this.actionData().blocking_tasks; return {this.warningModal()} @@ -302,8 +298,7 @@ class BlockedAdvanceToJudgeView extends React.Component {
    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER}

    - {(!appeal.isLegacyAppeal) &&
      {blockingTasks.map((blockingTask) => - this.blockingTaskListItem(blockingTask))}
    } +
      {blockingTasks.map((blockingTask) => this.blockingTaskListItem(blockingTask))}

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER}

    { highlightFormItems: state.ui.highlightFormItems, task: taskById(state, { taskId: ownProps.taskId }), allHearingTasks: allHearingTasksForAppeal(state, { appealId: appeal?.externalId }), - appeal: appealWithDetailSelector(state, ownProps) + appeal: appealWithDetailSelector(state, ownProps), + currentChildren: getAllHiringChildren(state, ownProps) }; }; diff --git a/client/app/queue/selectors.js b/client/app/queue/selectors.js index db070dfec5f..3ff2616d3a9 100644 --- a/client/app/queue/selectors.js +++ b/client/app/queue/selectors.js @@ -259,6 +259,34 @@ export const getAttorneyTasksForJudgeTask = createSelector( } ); +export const getAllHiringChildren = createSelector( + [getAmaTasks], + (amaTasks) => { + const legacyAttorneyJudgeTaskTypes = [ + 'HearingTask', + 'ScheduleHearingTask' + ]; + const childrenTasks = []; + + for (const key in amaTasks) { + // eslint-disable-next-line no-prototype-builtins + if (amaTasks.hasOwnProperty(key)) { + if (legacyAttorneyJudgeTaskTypes.includes(amaTasks[key].type)) { + amaTasks[key].assigned_to_name = amaTasks[key].assignedTo.isOrganization ? + amaTasks[key].assignedTo.name : + amaTasks[key].ownedBy; + amaTasks[key].assigned_to_email = amaTasks[key].assignedTo.isOrganization ? + amaTasks[key].assignedTo.name : + amaTasks[key].assignedBy.firstName; + + childrenTasks.push(amaTasks[key]); + } + } + } + + return childrenTasks; + }); + // Get all task trees for all Attorney Type Tasks found with the JudgeDecisionReviewTaskId as their parentId export const getTaskTreesForAttorneyTasks = createSelector( [getAllTasksForAppeal, getAttorneyTasksForJudgeTask], From e881d8f0449b9e6f7edfc733db94c8637eae184b Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:29:26 -0400 Subject: [PATCH 068/203] Fix action dropdown When user is a Judge (#19179) * Fix action dropdown When user is a Jugde * Remove parentheses around a method call --------- Co-authored-by: Christopher Aceves Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/legacy_tasks/attorney_legacy_task.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index 70e5cf82e12..db584fd157c 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -18,7 +18,8 @@ def available_actions(current_user, role) Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h ] elsif (current_user&.judge_in_vacols? || current_user&.can_act_on_behalf_of_judges?) && - FeatureToggle.enabled?(:vlj_legacy_appeal) + FeatureToggle.enabled?(:vlj_legacy_appeal) && + !%w[81 33 57 CASEFLOW].include?(appeal.case_record.reload.bfcurloc) [ Constants.TASK_ACTIONS.REASSIGN_TO_JUDGE.to_h, Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h From 972411b6a365b87c6eca76e05037fab26967bd01 Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:32:26 -0400 Subject: [PATCH 069/203] Fix error in Modal Scenario5 (#19211) --- client/COPY.json | 1 + .../components/AssignToAttorneyLegacyWidget.jsx | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client/COPY.json b/client/COPY.json index aeb2fe9f1d5..35d3a371732 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -547,6 +547,7 @@ "BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_SUBMIT": "Cancel Task and Reassign", "BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_ERROR_TITLE": "Could not cancel tasks and reassign to %s", "JUDGE_LEGACY_DECISION_REVIEW_TITLE": "Assign to", + "MORE_INFO": "More information is needed", "MAX_LEGACY_DOCKET_NUMBER_ERROR_MESSAGE": "Docket numbers begin with the two digit year. The Board of Veterans Appeals was created in 1930. Although there are no new legacy appeals after 2019, an old appeal can be reopened through a finding of clear and unmistakable error, which would result in a brand new docket number being assigned. An updated docket number format will need to be in place for legacy appeals by 2030 in order to ensure that docket numbers are sorted correctly.", "BOARD_DOCKET_NUMBER_ERROR": "Please enter a valid docket number provided by the Board (123456-7).", "CANCEL_TASK_MODAL_TITLE": "Cancel task", diff --git a/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx b/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx index 29b4a0c9478..05ffe05bc6c 100644 --- a/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyLegacyWidget.jsx @@ -236,19 +236,19 @@ export class AssignToAttorneyLegacyWidget extends React.PureComponent { const Widget = option && this.props.setSelectedAssignee({ assigneeId: option.value })} - value={selectedOption} - styling={css({ width: '30rem' })} /> + value={selectedOption} /> {selectedAssignee === OTHER &&
    -

    {COPY.ASSIGN_WIDGET_DROPDOWN_SECONDARY_LABEL}

    + option && this.props.setSelectedAssigneeSecondary({ assigneeId: option.value })} - value={selectedOptionOther} - styling={css({ width: '30rem' })} /> + value={selectedOptionOther} /> } {isModal &&
    @@ -266,8 +265,9 @@ export class AssignToAttorneyLegacyWidget extends React.PureComponent { name={COPY.ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL} errorMessage={highlightFormItems && instructions.length === 0 ? COPY.INSTRUCTIONS_ERROR_FIELD_REQUIRED : null} id="taskInstructions" + placeholder = {COPY.MORE_INFO} onChange={(value) => this.setState({ instructions: value })} - value={this.state.instructions} /> + value = {this.state.instructions ? null : this.state.instructions} />
    } {!isModal &&
    )} + {(SCMSuccessLegacyAppeal && props.featureToggles.vlj_legacy_appeal) && ( +
    + +
    + )} {!modalIsOpen && error && (
    diff --git a/client/app/queue/selectors.js b/client/app/queue/selectors.js index 3ff2616d3a9..5e50e90b20d 100644 --- a/client/app/queue/selectors.js +++ b/client/app/queue/selectors.js @@ -187,12 +187,14 @@ export const distributionTasksForAppeal = createSelector( export const caseTimelineTasksForAppeal = createSelector( [getAllTasksForAppeal], - (tasks) => orderBy(filter(completeTasksSelector(tasks), (task) => !task.hideFromCaseTimeline), ['completedAt'], ['desc']) + (tasks) => orderBy(filter(completeTasksSelector(tasks), (task) => + !task.hideFromCaseTimeline), ['completedAt'], ['desc']) ); export const taskSnapshotTasksForAppeal = createSelector( [getAllTasksForAppeal], - (tasks) => orderBy(filter(incompleteTasksSelector(tasks), (task) => !task.hideFromTaskSnapshot), ['createdAt'], ['desc']) + (tasks) => orderBy(filter(incompleteTasksSelector(tasks), (task) => + !task.hideFromTaskSnapshot), ['createdAt'], ['desc']) ); const taskIsLegacyAttorneyJudgeTask = (task) => { From 7e9ef7db2de3ec884e442699dc8a50e96fa834f3 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:59:03 -0400 Subject: [PATCH 092/203] button fix for the return to attorney assign task modal scenario 7 (#19297) * button fix for the return to attorney assign task modal scenario 7 * fixing rspecs * fixing rspecs --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/AssignToView.jsx | 3 ++- .../hearings/schedule_veteran/build_hearsched_spec.rb | 6 +++--- spec/feature/queue/ama_queue_spec.rb | 4 ++-- spec/feature/queue/cavc_task_queue_spec.rb | 2 +- spec/feature/queue/mail_task_spec.rb | 2 +- spec/feature/queue/motion_to_vacate_spec.rb | 2 +- spec/feature/queue/privacy_team_spec.rb | 2 +- spec/feature/queue/quality_review_flow_spec.rb | 4 ++-- spec/feature/queue/task_queue_spec.rb | 2 +- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index b366221cf15..2dd65c51958 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -341,6 +341,7 @@ class AssignToView extends React.Component { const action = getAction(this.props); const actionData = taskActionData(this.props); + actionData.drop_down_label = COPY.JUDGE_LEGACY_DECISION_REVIEW_TITLE const isPulacCerullo = action && action.label === 'Pulac-Cerullo'; if (!task || task.availableActions.length === 0) { @@ -354,6 +355,7 @@ class AssignToView extends React.Component { submit: this.submit, submitButtonClassNames: ['usa-button'], submitDisabled: !this.validateForm(), + button: 'Assign', validateForm: isPulacCerullo ? () => { return true; @@ -362,7 +364,6 @@ class AssignToView extends React.Component { }; if (task.type === 'JudgeLegacyDecisionReviewTask') { - modalProps.button = 'Assign'; modalProps.submitButtonClassNames = ['usa-button', 'usa-button-hover', 'usa-button-warning']; modalProps.submitDisabled = this.state.modalDisableButton; } diff --git a/spec/feature/hearings/schedule_veteran/build_hearsched_spec.rb b/spec/feature/hearings/schedule_veteran/build_hearsched_spec.rb index dafa1965633..330314bfe04 100644 --- a/spec/feature/hearings/schedule_veteran/build_hearsched_spec.rb +++ b/spec/feature/hearings/schedule_veteran/build_hearsched_spec.rb @@ -560,7 +560,7 @@ def format_hearing_day(hearing_day, detail_label = nil, total_slots = 0) click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.to_h[:label]) end - click_on "Submit" + click_on "Assign" # Your queue visit "/queue" @@ -573,7 +573,7 @@ def format_hearing_day(hearing_day, detail_label = nil, total_slots = 0) click_dropdown({ text: other_user.full_name }, find(".cf-modal-body")) fill_in COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "Reassign" - click_on "Submit" + click_on "Assign" # Case should exist in other users' queue User.authenticate!(user: other_user) @@ -605,7 +605,7 @@ def format_hearing_day(hearing_day, detail_label = nil, total_slots = 0) expect(page).to have_content("You have assigned an administrative action") click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.to_h[:label]) - click_on "Submit" + click_on "Assign" # Your queue visit "/queue" diff --git a/spec/feature/queue/ama_queue_spec.rb b/spec/feature/queue/ama_queue_spec.rb index 5f43e67d998..c73c0447837 100644 --- a/spec/feature/queue/ama_queue_spec.rb +++ b/spec/feature/queue/ama_queue_spec.rb @@ -548,7 +548,7 @@ def judge_assign_to_attorney expect(dropdown_selected_value(find(".cf-modal-body"))).to eq attorney_user.full_name fill_in "taskInstructions", with: "Please fix this" - click_on "Submit" + click_on "Assign" expect(page).to have_content("Task assigned to #{attorney_user.full_name}") end @@ -672,7 +672,7 @@ def judge_assign_to_attorney expect(dropdown_selected_value(find(".cf-modal-body"))).to eq attorney_user.full_name fill_in "taskInstructions", with: "Please fix this" - click_on "Submit" + click_on "Assign" expect(page).to have_content("Task assigned to #{attorney_user.full_name}") end diff --git a/spec/feature/queue/cavc_task_queue_spec.rb b/spec/feature/queue/cavc_task_queue_spec.rb index f22cca61cfe..40342714eab 100644 --- a/spec/feature/queue/cavc_task_queue_spec.rb +++ b/spec/feature/queue/cavc_task_queue_spec.rb @@ -596,7 +596,7 @@ click_dropdown(text: Constants.TASK_ACTIONS.SEND_TO_TRANSLATION_BLOCKING_DISTRIBUTION.label) fill_in "taskInstructions", with: "Please translate the documents in spanish" - click_on "Submit" + click_on "Assign" expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % Translation.singleton.name end end diff --git a/spec/feature/queue/mail_task_spec.rb b/spec/feature/queue/mail_task_spec.rb index 2ab7dcddf3e..a480cd11eb8 100644 --- a/spec/feature/queue/mail_task_spec.rb +++ b/spec/feature/queue/mail_task_spec.rb @@ -41,7 +41,7 @@ text = Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.label click_dropdown(prompt: prompt, text: text) fill_in("taskInstructions", with: "instructions") - click_button("Submit") + click_button("Assign") expect(page).to have_content(format(COPY::ASSIGN_TASK_SUCCESS_MESSAGE, user.full_name)) expect(page.current_path).to eq("/queue") diff --git a/spec/feature/queue/motion_to_vacate_spec.rb b/spec/feature/queue/motion_to_vacate_spec.rb index 6729215647a..f554f9daf06 100644 --- a/spec/feature/queue/motion_to_vacate_spec.rb +++ b/spec/feature/queue/motion_to_vacate_spec.rb @@ -99,7 +99,7 @@ find("div", class: "cf-select__option", text: "Assign to person").click find(".cf-modal .cf-select__control").click find("div", class: "cf-select__option", text: "Motions attorney").click - click_button(text: "Submit") + click_button(text: "Assign") expect(page).to have_content("Task assigned to Motions attorney") motions_attorney_task = VacateMotionMailTask.find_by(assigned_to: motions_attorney) expect(motions_attorney_task).to_not be_nil diff --git a/spec/feature/queue/privacy_team_spec.rb b/spec/feature/queue/privacy_team_spec.rb index 28f10759218..cb9cd880d43 100644 --- a/spec/feature/queue/privacy_team_spec.rb +++ b/spec/feature/queue/privacy_team_spec.rb @@ -70,7 +70,7 @@ # Assignee dropdown selector should be hidden. expect(find_all(".cf-modal-body .cf-select__control").count).to eq(0) fill_in("taskInstructions", with: instructions_text) - find("button", text: "Submit").click + find("button", text: "Assign").click expect(page).to have_content("Task assigned to #{PrivacyTeam.singleton.name}") diff --git a/spec/feature/queue/quality_review_flow_spec.rb b/spec/feature/queue/quality_review_flow_spec.rb index 610bb161017..3e10d2a5497 100644 --- a/spec/feature/queue/quality_review_flow_spec.rb +++ b/spec/feature/queue/quality_review_flow_spec.rb @@ -83,7 +83,7 @@ find("div", class: "cf-select__option", text: Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.to_h[:label]).click fill_in "taskInstructions", with: "Review the quality" - click_on "Submit" + click_on "Assign" expect(page).to have_content("Task assigned to #{qr_user_name}") @@ -101,7 +101,7 @@ expect(dropdown_selected_value(find(".cf-modal-body"))).to eq judge_user.full_name fill_in "taskInstructions", with: qr_instructions - click_on "Submit" + click_on "Assign" expect(page).to have_content("On hold (1)") end diff --git a/spec/feature/queue/task_queue_spec.rb b/spec/feature/queue/task_queue_spec.rb index 9fe3a6321c6..54dd161adc2 100644 --- a/spec/feature/queue/task_queue_spec.rb +++ b/spec/feature/queue/task_queue_spec.rb @@ -1008,7 +1008,7 @@ def validate_pulac_cerullo_tasks_created(task_class, label) expect(dropdown_selected_value(find(".cf-modal-body"))).to eq attorney_user.full_name fill_in "taskInstructions", with: "Please fix this" - click_on COPY::MODAL_SUBMIT_BUTTON + click_on COPY::MODAL_ASSIGN_BUTTON expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE % attorney_user.full_name) From b5e36880f12e07058115fd801ac567a8ba314e60 Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:08:52 -0400 Subject: [PATCH 093/203] Fix error in Attorney Widget (#19336) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../components/AssignToAttorneyWidget.jsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index c923916d1da..858bc908375 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -42,7 +42,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { constructor(props) { super(props); - if (props.selectedTasks[0].appealType === 'LegacyAppeal') { + if (props.selectedTasks.length > 0 && props.selectedTasks[0].appealType === 'LegacyAppeal') { const instructions = (props.selectedTasks[0].instructions.length === 0 ? null : props.selectedTasks[0].instructions.filter((instructionData) => instructionData)); const isInstructionArray = (instructions === null ? null : instructions); @@ -50,7 +50,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { this.state = { - instructions: ((this.props.isModal && + instructions: ((this.props.isModal && props.selectedTasks.length > 0 && props.selectedTasks[0].appealType === 'LegacyAppeal' ? instructionType : null) || null) }; @@ -258,16 +258,16 @@ export class AssignToAttorneyWidget extends React.PureComponent { const Widget = 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? COPY.JUDGE_LEGACY_DECISION_REVIEW_TITLE : COPY.ASSIGN_WIDGET_DROPDOWN_NAME_PRIMARY} // hideLabel= {true} - hideLabel= {!selectedTasks[0].appealType === 'LegacyAppeal'} + hideLabel= {(selectedTasks.length > 0 && !selectedTasks[0].appealType === 'LegacyAppeal')} searchable errorMessage={isModal && highlightFormItems && !selectedOption ? 'Choose one' : null} options={options} placeholder={COPY.ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER} - onChange={selectedTasks[0].appealType === 'LegacyAppeal' ? + onChange={(selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? (option) => option && this.props.setSelectedAssignee({ assigneeId: option.value }) && this.setModalOnChangeValue('assignedTo', option ? option.value : null) : (option) => option && this.props.setSelectedAssignee({ assigneeId: option.value })} @@ -287,7 +287,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { errorMessage={isModal && highlightFormItems && !selectedOptionOther ? 'Choose one' : null} options={optionsOther} placeholder={placeholderOther} - onChange={selectedTasks[0].appealType === 'LegacyAppeal' ? + onChange={(selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? (option) => option && this.props.setSelectedAssigneeSecondary({ assigneeId: option.value }) : (option) => option && this.props.setSelectedAssigneeSecondary({ assigneeId: option.value }) && this.setModalOnChangeValue('assignedTo', option ? option.value : null)} @@ -301,11 +301,11 @@ export class AssignToAttorneyWidget extends React.PureComponent { errorMessage={highlightFormItems && instructions.length === 0 ? COPY.INSTRUCTIONS_ERROR_FIELD_REQUIRED : null} id="taskInstructions" placeholder = {COPY.MORE_INFO} - onChange={selectedTasks[0].appealType === 'LegacyAppeal' ? + onChange={(selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? (value) => this.setState({ instructions: value }) : (value) => this.setModalOnChangeValue('instructions', value) } - value = {selectedTasks[0].appealType === 'LegacyAppeal' ? null : this.state.instructions} + value = {(selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? null : this.state.instructions} /> } @@ -320,7 +320,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { styling={css({ margin: '1.5rem 0' })} /> } ; - if (selectedTasks[0].appealType === 'LegacyAppeal') { + if (selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') { return isModal ? Date: Fri, 1 Sep 2023 11:11:20 -0400 Subject: [PATCH 094/203] Vinner57/reverting assign by bug changes (#19339) * reverting assign by bug changes * reverting changes --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/controllers/legacy_tasks_controller.rb | 2 +- app/repositories/queue_repository.rb | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/controllers/legacy_tasks_controller.rb b/app/controllers/legacy_tasks_controller.rb index 6633bad57df..a57b9a48b2d 100644 --- a/app/controllers/legacy_tasks_controller.rb +++ b/app/controllers/legacy_tasks_controller.rb @@ -98,7 +98,7 @@ def assign_to_attorney def assign_to_judge # If the user being assigned to is a judge, do not create a DECASS record, just # update the location to the assigned judge. - QueueRepository.update_location_to_judge(appeal.vacols_id, assigned_to, current_user) + QueueRepository.update_location_to_judge(appeal.vacols_id, assigned_to) # Remove overtime status of an appeal when reassigning to a judge appeal.overtime = false if appeal.overtime? diff --git a/app/repositories/queue_repository.rb b/app/repositories/queue_repository.rb index 0d81dafdd38..fc461988380 100644 --- a/app/repositories/queue_repository.rb +++ b/app/repositories/queue_repository.rb @@ -195,13 +195,11 @@ def filter_duplicate_tasks(records, css_id = nil) end end - def update_location_to_judge(vacols_id, judge, assigned_by) + def update_location_to_judge(vacols_id, judge) vacols_case = VACOLS::Case.find(vacols_id) fail VACOLS::Case::InvalidLocationError, "Invalid location \"#{judge.vacols_uniq_id}\"" unless judge.vacols_uniq_id - - decass_record = incomplete_decass_record(vacols_id) - update_decass_record(decass_record, modifying_user: assigned_by.vacols_uniq_id) + vacols_case.update_vacols_location!(judge.vacols_uniq_id) end From c3b4b95b17fe7054ec26f6953a52d22d8589e400 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:17:10 -0400 Subject: [PATCH 095/203] changes to hide_legacy_tasks method for simplicity (#19341) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/workflows/tasks_for_appeal.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/workflows/tasks_for_appeal.rb b/app/workflows/tasks_for_appeal.rb index e0e4c543b15..84f5f8e02f0 100644 --- a/app/workflows/tasks_for_appeal.rb +++ b/app/workflows/tasks_for_appeal.rb @@ -66,11 +66,6 @@ def tasks_actionable_to_vso_employee end end - def only_root_task? - !appeal.tasks.active.where(type: RootTask.name).empty? || - !appeal.tasks.active.where(type: ScheduleHearingTask.name).empty? - end - def all_tasks_except_for_decision_review_tasks appeal.tasks.not_decisions_review.includes(*task_includes) end @@ -95,9 +90,7 @@ def legacy_appeal_tasks end def hide_legacy_tasks? - active_tasks = all_tasks_except_for_decision_review_tasks.active - legacy_tasks = legacy_appeal_tasks - (active_tasks && legacy_tasks && !only_root_task?) ? true : false + (!appeal.tasks.where(type: JudgeAssignTask.name).empty? || !appeal.tasks.where(type: AttorneyTask.name).empty? || !appeal.tasks.where(type: JudgeDecisionReviewTask.name).empty?) ? true : false end def task_includes From 53ff4e1916660f819f89cca244db771490309434 Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Fri, 1 Sep 2023 13:55:45 -0500 Subject: [PATCH 096/203] Scenario-7 success banner fix (#19349) --- client/COPY.json | 1 + client/app/queue/AssignToView.jsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/COPY.json b/client/COPY.json index fbe85900349..12d720221b1 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -663,6 +663,7 @@ "PULAC_CERULLO_REMINDER_MODAL_OPT_FALSE": "No, continue sending to Dispatch", "PULAC_CERULLO_REMINDER_MODAL_OPT_TRUE": "Yes, notify Pulac Cerullo team of jurisdictional conflict", "ASSIGN_TASK_SUCCESS_MESSAGE": "Task assigned to %s", + "ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE": "You have successfully reassigned this task to %s", "REASSIGN_TASK_SUCCESS_MESSAGE_SCM": "You have successfully assigned %s’s case to %s", "REASSIGN_TASK_SUCCESS_MESSAGE": "You have successfully reassigned this task to %s", "HEARING_ASSIGN_TASK_SUCCESS_MESSAGE_DETAIL": "You can continue to assign tasks to yourself and others using this queue.", diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index 2dd65c51958..bd6c3e946a8 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -137,7 +137,7 @@ class AssignToView extends React.Component { const assignTaskSuccessMessage = { title: taskActionData(this.props).message_title ? sprintf(taskActionData(this.props).message_title, caseNameListItem(), - this.getAssignee()) : sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()), + this.getAssignee()) : sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE, this.getAssignee()), detail: taskActionData(this.props).message_detail || null }; From 4e137656d7f71631c7ff11a28e2b23ac0d0e2f21 Mon Sep 17 00:00:00 2001 From: Craig Reese <109101548+craigrva@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:17:49 -0500 Subject: [PATCH 097/203] Craig/appeals 29643 (#19355) * fix ready for dispatch, duplicate decass * create new decass record when reassigning to attorney * remove commented code * assign to attorey legacy modal band aid --- app/controllers/tasks_controller.rb | 10 +++++ app/models/concerns/case_review_concern.rb | 4 ++ .../judge_case_assignment_to_attorney.rb | 3 +- app/repositories/queue_repository.rb | 44 ++++++------------- .../components/AssignToAttorneyWidget.jsx | 10 ++--- client/app/queue/utils.js | 2 +- 6 files changed, 35 insertions(+), 38 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 90c820cacd3..c39d5bd5a2a 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -93,6 +93,16 @@ def create tasks << valid_task_classes[task_type.to_sym].create_many_from_params(param_group, current_user) end + # This should be the JudgeDecisionReviewTask + parent_task = Task.find_by(id: params[:tasks].first[:parent_id]) if params[:tasks].first[:type] == "AttorneyRewriteTask" + if parent_task&.appeal&.is_a?(LegacyAppeal) + QueueRepository.reassign_case_to_attorney!( + judge: parent_task.assigned_to, + attorney: User.find(params[:tasks].first[:assigned_to_id]), + vacols_id: parent_task.appeal.external_id + ) + end + modified_tasks = [parent_tasks_from_params, tasks].flatten.uniq render json: { tasks: json_tasks(modified_tasks) } diff --git a/app/models/concerns/case_review_concern.rb b/app/models/concerns/case_review_concern.rb index bb31bfb2208..6e35ae38d4c 100644 --- a/app/models/concerns/case_review_concern.rb +++ b/app/models/concerns/case_review_concern.rb @@ -59,6 +59,10 @@ def vacols_id end def created_in_vacols_date + if task&.appeal&.is_a?(LegacyAppeal) + return VACOLS::Decass.where(defolder: task.appeal.vacols_id).max_by(&:deadtim).deadtim + end + task_id&.split("-", 2)&.second&.to_date end diff --git a/app/models/judge_case_assignment_to_attorney.rb b/app/models/judge_case_assignment_to_attorney.rb index 17c5ee0e465..8d0d98115d7 100644 --- a/app/models/judge_case_assignment_to_attorney.rb +++ b/app/models/judge_case_assignment_to_attorney.rb @@ -29,8 +29,7 @@ def reassign_to_attorney! self.class.repository.reassign_case_to_attorney!( judge: assigned_by, attorney: assigned_to, - vacols_id: vacols_id, - created_in_vacols_date: created_in_vacols_date + vacols_id: vacols_id ) end end diff --git a/app/repositories/queue_repository.rb b/app/repositories/queue_repository.rb index fc461988380..8e9eea6d1ed 100644 --- a/app/repositories/queue_repository.rb +++ b/app/repositories/queue_repository.rb @@ -57,21 +57,16 @@ def appeals_by_vacols_ids(vacols_ids) end def reassign_case_to_judge!(vacols_id:, assigned_by:, created_in_vacols_date:, judge_vacols_user_id:, decass_attrs:) - begin - decass_record = find_decass_record(vacols_id, created_in_vacols_date) - # In attorney checkout, we are automatically selecting the judge who - # assigned the attorney the case. But we also have a drop down for the - # attorney to select a different judge if they are checking it out to someone else - if decass_record.deadusr != judge_vacols_user_id.vacols_uniq_id - BusinessMetrics.record(service: :queue, name: "reassign_case_to_different_judge") - end - update_decass_record(decass_record, decass_attrs) - # update location with the judge's slogid - decass_record.update_vacols_location!(judge_vacols_user_id.vacols_uniq_id) - rescue Caseflow::Error::QueueRepositoryError => e - attrs = assign_to_attorney_attrs(vacols_id, assigned_by, judge_vacols_user_id) - decass_record = create_decass_record(attrs.merge(adding_user: judge_vacols_user_id.vacols_uniq_id)) - end + decass_record = find_decass_record(vacols_id, created_in_vacols_date) + # In attorney checkout, we are automatically selecting the judge who + # assigned the attorney the case. But we also have a drop down for the + # attorney to select a different judge if they are checking it out to someone else + if decass_record.deadusr != judge_vacols_user_id.vacols_uniq_id + BusinessMetrics.record(service: :queue, name: "reassign_case_to_different_judge") + end + update_decass_record(decass_record, decass_attrs) + # update location with the judge's slogid + decass_record.update_vacols_location!(judge_vacols_user_id.vacols_uniq_id) true end @@ -158,21 +153,10 @@ def incomplete_decass_record(vacols_id) ).first end - def reassign_case_to_attorney!(judge:, attorney:, vacols_id:, created_in_vacols_date:) + def reassign_case_to_attorney!(judge:, attorney:, vacols_id:) transaction do - #update_location_to_attorney(vacols_id, attorney) - begin - decass_record = find_decass_record(vacols_id, created_in_vacols_date) - update_decass_record(decass_record, - attorney_id: attorney.vacols_attorney_id, - group_name: attorney.vacols_group_id[0..2], - assigned_to_attorney_date: VacolsHelper.local_time_with_utc_timezone, - deadline_date: VacolsHelper.local_date_with_utc_timezone + 30.days, - modifying_user: judge.vacols_uniq_id) - rescue Caseflow::Error::QueueRepositoryError => e - attrs = assign_to_attorney_attrs(vacols_id, attorney, judge) - create_decass_record(attrs.merge(adding_user: judge.vacols_uniq_id)) - end + attrs = assign_to_attorney_attrs(vacols_id, attorney, judge) + create_decass_record(attrs.merge(adding_user: judge.vacols_uniq_id)) end end @@ -199,7 +183,7 @@ def update_location_to_judge(vacols_id, judge) vacols_case = VACOLS::Case.find(vacols_id) fail VACOLS::Case::InvalidLocationError, "Invalid location \"#{judge.vacols_uniq_id}\"" unless judge.vacols_uniq_id - + vacols_case.update_vacols_location!(judge.vacols_uniq_id) end diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 858bc908375..d0a4d9d0afa 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -43,20 +43,20 @@ export class AssignToAttorneyWidget extends React.PureComponent { super(props); if (props.selectedTasks.length > 0 && props.selectedTasks[0].appealType === 'LegacyAppeal') { - const instructions = (props.selectedTasks[0].instructions.length === 0 ? null : + const instructions = (props.selectedTasks[0].instructions.length === 0 ? [] : props.selectedTasks[0].instructions.filter((instructionData) => instructionData)); - const isInstructionArray = (instructions === null ? null : instructions); - const instructionType = Array.isArray(props.selectedTasks[0].instructions) ? isInstructionArray : null; + const isInstructionArray = (instructions === [] ? [] : instructions); + const instructionType = Array.isArray(props.selectedTasks[0].instructions) ? isInstructionArray : []; this.state = { instructions: ((this.props.isModal && props.selectedTasks.length > 0 && - props.selectedTasks[0].appealType === 'LegacyAppeal' ? instructionType : null) || null) + props.selectedTasks[0].appealType === 'LegacyAppeal' ? instructionType : []) || []) }; } else { this.state = { - instructions: (this.props.isModal ? this.props.selectedTasks[0].instructions : null) || '', + instructions: (this.props.isModal ? this.props.selectedTasks[0].instructions : []) || '', assignedTo: null, modalDisableButton: true }; diff --git a/client/app/queue/utils.js b/client/app/queue/utils.js index c0733b35b18..88667b8a009 100644 --- a/client/app/queue/utils.js +++ b/client/app/queue/utils.js @@ -890,7 +890,7 @@ export const sortCaseTimelineEvents = (...eventArrays) => { // Reverse the array for the order we actually want // return sortedTimelineEvents.reverse(); - if (timelineEvents[0].appealType === 'LegacyAppeal') { + if (timelineEvents[0]?.appealType === 'LegacyAppeal') { if (timelineEvents[0].assigneeName === '57' || timelineEvents[0].assigneeName === 'CASEFLOW') { return sortedTimelineEvents.reverse(); } From ac2195f3080ec655de920b6eb7d7bdcf242f8e42 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:20:30 -0400 Subject: [PATCH 098/203] fixing the browser console error (#19367) --- client/app/queue/CaseTimeline.jsx | 2 +- client/app/queue/TaskSnapshot.jsx | 2 +- client/app/queue/components/TaskRows.jsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/app/queue/CaseTimeline.jsx b/client/app/queue/CaseTimeline.jsx index ffe4c25df7e..7fac1ca7b23 100644 --- a/client/app/queue/CaseTimeline.jsx +++ b/client/app/queue/CaseTimeline.jsx @@ -31,5 +31,5 @@ export const CaseTimeline = ({ appeal }) => { CaseTimeline.propTypes = { appeal: PropTypes.object, statusSplit: PropTypes.bool, - VLJ_featureToggles: PropTypes.string, + VLJ_featureToggles: PropTypes.bool, }; diff --git a/client/app/queue/TaskSnapshot.jsx b/client/app/queue/TaskSnapshot.jsx index f04453cccf0..4d2ab6814e0 100644 --- a/client/app/queue/TaskSnapshot.jsx +++ b/client/app/queue/TaskSnapshot.jsx @@ -75,7 +75,7 @@ TaskSnapshot.propTypes = { appeal: PropTypes.object, hideDropdown: PropTypes.bool, showPulacCerulloAlert: PropTypes.bool, - VLJ_featureToggles: PropTypes.string, + VLJ_featureToggles: PropTypes.bool, }; const mapStateToProps = (state, ownProps) => { diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index 43615a68010..a0f0c4f1419 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -686,7 +686,7 @@ TaskRows.propTypes = { hideDropdown: PropTypes.bool, taskList: PropTypes.array, timeline: PropTypes.bool, - VLJ_featureToggles: PropTypes.string, + VLJ_featureToggles: PropTypes.bool, }; export default TaskRows; From ef4596bd98407f4166784f73209979fd32e853fd Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:17:22 -0400 Subject: [PATCH 099/203] Calvin/appeals 24749 das error (#19357) * refactored initialAssignTasksToUser * fixed paramsArray * added some changes to reassign tasks to user * remove byebug * fixes location update for reassign to attorney * fixes for location update * remove byebugs * changed find decass method * does ama update on legacy tasks when reassigning * reverting changes as fix is in another PR * revert changes cause fix is in another PR * added location updater * reverting unknown changes in PR * got rid of scheme update --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/controllers/legacy_tasks_controller.rb | 7 +- .../judge_case_assignment_to_attorney.rb | 3 +- app/repositories/queue_repository.rb | 2 +- .../queue/AssignToAttorneyLegacyModalView.jsx | 132 -------------- client/app/queue/AssignToView.jsx | 4 +- client/app/queue/QueueActions.js | 164 +++++++++++------- client/app/queue/QueueApp.jsx | 3 +- config/routes.rb | 1 - 8 files changed, 107 insertions(+), 209 deletions(-) delete mode 100644 client/app/queue/AssignToAttorneyLegacyModalView.jsx diff --git a/app/controllers/legacy_tasks_controller.rb b/app/controllers/legacy_tasks_controller.rb index a57b9a48b2d..3db500f07bb 100644 --- a/app/controllers/legacy_tasks_controller.rb +++ b/app/controllers/legacy_tasks_controller.rb @@ -91,10 +91,6 @@ def create } end - def assign_to_attorney - assign_to_judge - end - def assign_to_judge # If the user being assigned to is a judge, do not create a DECASS record, just # update the location to the assigned judge. @@ -124,11 +120,10 @@ def update # Remove overtime status of an appeal when reassigning to another attorney appeal.overtime = false if appeal.overtime? - render json: { task: json_task(AttorneyLegacyTask.from_vacols( task.last_case_assignment, - LegacyAppeal.find_or_create_by_vacols_id(task.vacols_id), + LegacyAppeal.find_or_create_by_vacols_id(appeal.vacols_id), task.assigned_to )) } diff --git a/app/models/judge_case_assignment_to_attorney.rb b/app/models/judge_case_assignment_to_attorney.rb index 8d0d98115d7..48f41d3184d 100644 --- a/app/models/judge_case_assignment_to_attorney.rb +++ b/app/models/judge_case_assignment_to_attorney.rb @@ -23,6 +23,7 @@ def assign_to_attorney! end def reassign_to_attorney! + vacols_id = LegacyAppeal.find(appeal_id).vacols_id MetricsService.record("VACOLS: reassign_case_to_attorney #{vacols_id}", service: :vacols, name: "reassign_case_to_attorney") do @@ -43,7 +44,7 @@ def vacols_id end def last_case_assignment - VACOLS::CaseAssignment.latest_task_for_appeal(vacols_id) + VACOLS::CaseAssignment.latest_task_for_appeal(LegacyAppeal.find(appeal_id).vacols_id) end private diff --git a/app/repositories/queue_repository.rb b/app/repositories/queue_repository.rb index 8e9eea6d1ed..07c18d6b8a2 100644 --- a/app/repositories/queue_repository.rb +++ b/app/repositories/queue_repository.rb @@ -123,7 +123,6 @@ def assign_case_to_attorney!(assigned_by:, judge:, attorney:, vacols_id:) update_location_to_attorney(vacols_id, attorney) attrs = assign_to_attorney_attrs(vacols_id, attorney, assigned_by) - incomplete_record = incomplete_decass_record(vacols_id) if incomplete_record.present? return update_decass_record(incomplete_record, attrs.merge(work_product: nil)) @@ -155,6 +154,7 @@ def incomplete_decass_record(vacols_id) def reassign_case_to_attorney!(judge:, attorney:, vacols_id:) transaction do + update_location_to_attorney(vacols_id, attorney) attrs = assign_to_attorney_attrs(vacols_id, attorney, judge) create_decass_record(attrs.merge(adding_user: judge.vacols_uniq_id)) end diff --git a/client/app/queue/AssignToAttorneyLegacyModalView.jsx b/client/app/queue/AssignToAttorneyLegacyModalView.jsx deleted file mode 100644 index d855e6a62b4..00000000000 --- a/client/app/queue/AssignToAttorneyLegacyModalView.jsx +++ /dev/null @@ -1,132 +0,0 @@ -import * as React from 'react'; -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; -import PropTypes from 'prop-types'; -import { taskActionData } from './utils'; -import { sprintf } from 'sprintf-js'; - -import { AssignToAttorneyWidgetModal } from './components/AssignToAttorneyWidget'; -import { taskById } from './selectors'; -import COPY from '../../COPY'; - -import { - initialAssignTasksToUser, - reassignTasksToUser, - legacyReassignToJudgeAttorney, - legacyReassignToJudge, - legacyReassignToAttorney -} from './QueueActions'; - -class AssignToAttorneyLegacyModalView extends React.PureComponent { - handleAssignment = ( - { tasks, assigneeId, instructions, assignee } - ) => { - const previousAssigneeId = tasks[0].assignedTo.id.toString(); - const previousAssignee = tasks[0].assigneeName; - - const assignTaskSuccessMessage = { - title: taskActionData(this.props).message_title ? sprintf(taskActionData(this.props).message_title, - previousAssignee, - assignee) : sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()), - detail: taskActionData(this.props).message_detail || null - }; - - if ([COPY.JUDGE_ASSIGN_TASK_LABEL, COPY.JUDGE_QUALITY_REVIEW_TASK_LABEL].includes(tasks[0].label)) { - return this.props.initialAssignTasksToUser({ - tasks, - assigneeId, - previousAssigneeId, - instructions - }).then(() => { - if (tasks[0].appealType === 'LegacyAppeal') { - this.props.legacyReassignToAttorney({ - tasks, - assigneeId - }, assignTaskSuccessMessage); - } - }); - } - - return this.props.reassignTasksToUser({ - tasks, - assigneeId, - previousAssigneeId, - instructions - }).then(() => { - if (tasks[0].appealType === 'LegacyAppeal') { - this.props.legacyReassignToAttorney({ - tasks, - assigneeId - }, assignTaskSuccessMessage); - } - }); - } - - getAssignee = () => { - let assignee = 'person'; - - taskActionData(this.props).options.forEach((opt) => { - if (opt.value === this.state.selectedValue) { - assignee = opt.label; - } - }); - const splitAssignee = assignee.split(' '); - - if (splitAssignee.length >= 3) { - assignee = `${splitAssignee[0] } ${ splitAssignee[2]}`; - } - - return assignee; - }; - - render = () => { - const { task, userId, match } = this.props; - const previousAssigneeId = task ? task.assignedTo.id.toString() : null; - - if (!previousAssigneeId) { - return null; - } - - return (); - } -} - -AssignToAttorneyLegacyModalView.propTypes = { - task: PropTypes.shape({ - assignedTo: PropTypes.shape({ - id: PropTypes.number - }) - }), - userId: PropTypes.string, - match: PropTypes.object, - initialAssignTasksToUser: PropTypes.func, - reassignTasksToUser: PropTypes.func, - legacyReassignToJudgeAttorney: PropTypes.func, - legacyReassignToJudge: PropTypes.func, - legacyReassignToAttorney: PropTypes.func -}; - -const mapStateToProps = (state, ownProps) => { - return { - task: taskById(state, { taskId: ownProps.match.params.taskId }) - }; -}; - -const mapDispatchToProps = (dispatch) => bindActionCreators({ - initialAssignTasksToUser, - reassignTasksToUser, - legacyReassignToJudgeAttorney, - legacyReassignToJudge, - legacyReassignToAttorney -}, dispatch); - -export default (connect( - mapStateToProps, - mapDispatchToProps -)(AssignToAttorneyLegacyModalView)); diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index bd6c3e946a8..53cb12fbb88 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -9,7 +9,7 @@ import VHA_VAMCS from '../../constants/VHA_VAMCS'; import { taskById, appealWithDetailSelector, getRootTaskLegacyAppealSCM } from './selectors'; -import { onReceiveAmaTasks, legacyReassignToJudge, setOvertime, legacyReassignToAttorney } from './QueueActions'; +import { onReceiveAmaTasks, legacyReassignToJudge, setOvertime } from './QueueActions'; import RadioField from '../components/RadioField'; import SearchableDropdown from '../components/SearchableDropdown'; @@ -462,7 +462,6 @@ AssignToView.propTypes = { isTeamAssign: PropTypes.bool, onReceiveAmaTasks: PropTypes.func, legacyReassignToJudge: PropTypes.func, - legacyReassignToAttorney: PropTypes.func, requestPatch: PropTypes.func, requestSave: PropTypes.func, rootTask: PropTypes.func, @@ -499,7 +498,6 @@ const mapDispatchToProps = (dispatch) => requestSave, onReceiveAmaTasks, legacyReassignToJudge, - legacyReassignToAttorney, setOvertime, resetSuccessMessages }, diff --git a/client/app/queue/QueueActions.js b/client/app/queue/QueueActions.js index 11a045fd3fc..dda5a3c24d8 100644 --- a/client/app/queue/QueueActions.js +++ b/client/app/queue/QueueActions.js @@ -483,12 +483,16 @@ export const initialAssignTasksToUser = ({ tasks, assigneeId, previousAssigneeId, instructions }) => (dispatch) => { + const amaTasks = tasks.filter((oldTask) => oldTask.appealType === 'Appeal'); + const legacyTasks = tasks.filter((oldTask) => oldTask.appealType === 'LegacyAppeal'); + const legacyAppealAMATasks = tasks.filter((oldTask) => oldTask.appealType === 'LegacyAppeal' && oldTask.type === 'JudgeAssignTask'); + const amaParams = { url: '/judge_assign_tasks', - taskIds: tasks.map((oldTask) => oldTask.uniqueId), + taskIds: amaTasks.map((oldTask) => oldTask.uniqueId), requestParams: { data: { - tasks: tasks.map((oldTask) => ({ + tasks: amaTasks.map((oldTask) => ({ external_id: oldTask.externalAppealId, parent_id: oldTask.taskId, assigned_to_id: assigneeId, @@ -498,7 +502,41 @@ export const initialAssignTasksToUser = ({ } }; - return Promise.all([amaParams].map((params) => { + const legacyParams = legacyTasks.map((oldTask) => ({ + url: '/legacy_tasks', + taskIds: [oldTask.uniqueId], + requestParams: { + data: { + tasks: { + assigned_to_id: assigneeId, + type: 'JudgeCaseAssignmentToAttorney', + appeal_id: oldTask.appealId, + judge_id: previousAssigneeId + } + } + } + })); + + const legacyAMATasksParams = { + url: '/judge_assign_tasks', + taskIds: legacyAppealAMATasks.map((oldTask) => oldTask.uniqueId), + requestParams: { + data: { + tasks: legacyAppealAMATasks.map((oldTask) => ({ + external_id: oldTask.externalAppealId, + parent_id: oldTask.taskId, + assigned_to_id: assigneeId, + instructions + })) + } + } + }; + + let paramsArray = amaParams.requestParams.data.tasks.length ? legacyParams.concat(amaParams) : legacyParams; + + paramsArray = legacyAMATasksParams.requestParams.data.tasks.length ? paramsArray.concat(legacyAMATasksParams) : paramsArray; + + return Promise.all(paramsArray.map((params) => { const { requestParams, url, taskIds } = params; return ApiUtil.post(url, requestParams). @@ -524,19 +562,70 @@ export const initialAssignTasksToUser = ({ export const reassignTasksToUser = ({ tasks, assigneeId, previousAssigneeId, instructions }) => (dispatch) => Promise.all(tasks.map((oldTask) => { + let params, url; - const url = `/tasks/${oldTask.taskId}`; - const params = { - data: { - task: { - reassign: { + if (oldTask.appealType === 'LegacyAppeal' && oldTask.type === 'AttorneyTask') { + url = `/tasks/${oldTask.taskId}`; + params = { + data: { + task: { + reassign: { + assigned_to_id: assigneeId, + assigned_to_type: 'User', + instructions + } + } + } + }; + + ApiUtil.patch(url, params). + then((resp) => resp.body). + then((resp) => { + dispatchOldTasks(dispatch, oldTask, resp); + + dispatch(setSelectionOfTaskOfUser({ + userId: previousAssigneeId, + taskId: oldTask.uniqueId, + selected: false + })); + + dispatch(incrementTaskCountForAttorney({ + id: assigneeId + })); + + dispatch(decrementTaskCountForAttorney({ + id: previousAssigneeId + })); + + dispatch(setOvertime(oldTask.externalAppealId, false)); + }); + } + + if (oldTask.appealType === 'Appeal') { + url = `/tasks/${oldTask.taskId}`; + params = { + data: { + task: { + reassign: { + assigned_to_id: assigneeId, + assigned_to_type: 'User', + instructions + } + } + } + }; + } else { + url = `/legacy_tasks/${oldTask.taskId}`; + params = { + data: { + tasks: { assigned_to_id: assigneeId, - assigned_to_type: 'User', - instructions + type: 'JudgeCaseAssignmentToAttorney', + appeal_id: oldTask.appealId } } - } - }; + }; + } return ApiUtil.patch(url, params). then((resp) => resp.body). @@ -558,7 +647,6 @@ export const reassignTasksToUser = ({ })); dispatch(setOvertime(oldTask.externalAppealId, false)); - }); })); @@ -593,56 +681,6 @@ export const legacyReassignToJudge = ({ }); })); -export const legacyReassignToJudgeAttorney = ({ - tasks, assigneeId -}, successMessage) => (dispatch) => Promise.all(tasks.map((oldTask) => { - const params = { - data: { - tasks: { - appeal_id: tasks[0].appealId, - assigned_to_id: assigneeId, - } - } - }; - - return ApiUtil.put(`/legacy_tasks/${tasks[0].uniqueId}`, params). - then((resp) => resp.body). - then((resp) => { - const allTasks = prepareAllTasksForStore([resp.task.data]); - - dispatch(onReceiveTasks(_.pick(allTasks, ['tasks', 'amaTasks']))); - - dispatch(showSuccessMessage(successMessage)); - - dispatch(setOvertime(oldTask.externalAppealId, false)); - }); -})); - -export const legacyReassignToAttorney = ({ - tasks, assigneeId -}, successMessage) => (dispatch) => Promise.all(tasks.map((oldTask) => { - const params = { - data: { - tasks: { - assigned_to_id: assigneeId, - appeal_id: oldTask.appealId - } - } - }; - - return ApiUtil.post('/legacy_tasks/assign_to_attorney', params). - then((resp) => resp.body). - then((resp) => { - const allTasks = prepareAllTasksForStore([resp.task.data]); - - dispatch(onReceiveTasks(_.pick(allTasks, ['tasks', 'amaTasks']))); - - dispatch(showSuccessMessage(successMessage)); - - dispatch(setOvertime(oldTask.externalAppealId, false)); - }); -})); - const refreshTasks = (dispatch, userId, userRole, type = null) => { let url = `/tasks?user_id=${userId}&role=${userRole}`; diff --git a/client/app/queue/QueueApp.jsx b/client/app/queue/QueueApp.jsx index 299a3c2840e..b42a5e263ba 100644 --- a/client/app/queue/QueueApp.jsx +++ b/client/app/queue/QueueApp.jsx @@ -54,7 +54,6 @@ import ChangeHearingDispositionModal from './ChangeHearingDispositionModal'; import CreateChangeHearingDispositionTaskModal from './CreateChangeHearingDispositionTaskModal'; import AdvancedOnDocketMotionView from './AdvancedOnDocketMotionView'; import AssignToAttorneyModalView from './AssignToAttorneyModalView'; -import AssignToAttorneyLegacyModalView from './AssignToAttorneyLegacyModalView'; import AssignToView from './AssignToView'; import CreateMailTaskDialog from './CreateMailTaskDialog'; import AddJudgeTeamModal from './AddJudgeTeamModal'; @@ -293,7 +292,7 @@ class QueueApp extends React.PureComponent { ); routedAssignToAttorneyLegacy = (props) => ( - + ); routedAssignToSingleTeam = (props) => ( diff --git a/config/routes.rb b/config/routes.rb index 18b18eaef4c..81670f08808 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -320,7 +320,6 @@ resources :legacy_tasks, only: [:create, :update] post '/legacy_tasks/assign_to_judge', to: 'legacy_tasks#assign_to_judge' - post '/legacy_tasks/assign_to_attorney', to: 'legacy_tasks#assign_to_attorney' resources :tasks, only: [:index, :create, :update] do member do post :reschedule From d5c23857aee237f2a8460e9814a5340ca25b2ac5 Mon Sep 17 00:00:00 2001 From: Shruthi Sibi <109103820+shruthisibi@users.noreply.github.com> Date: Wed, 6 Sep 2023 12:45:04 -0500 Subject: [PATCH 100/203] Rspec fix for Judge_task_spec (#19371) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/models/tasks/judge_task_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/tasks/judge_task_spec.rb b/spec/models/tasks/judge_task_spec.rb index 90fba008307..f7c0101b656 100644 --- a/spec/models/tasks/judge_task_spec.rb +++ b/spec/models/tasks/judge_task_spec.rb @@ -294,7 +294,7 @@ it "merges instruction text" do subject - expect(jqr_task.reload.instructions).to eq([[new_instructions]]) + expect(jqr_task.reload.instructions).to eq([existing_instructions,new_instructions]) end end From 7ecee0e20d7683bef57786d70c1c7a9b1ac5336f Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:46:27 -0400 Subject: [PATCH 101/203] location 81 + scenario 1 Dropdown fix (#19373) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/legacy_tasks/attorney_legacy_task.rb | 5 +++-- lib/tasks/seed_legacy_appeal_tasks.rake | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index db584fd157c..26a6504c21a 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -3,9 +3,8 @@ class AttorneyLegacyTask < LegacyTask def available_actions(current_user, role) # AttorneyLegacyTasks are drawn from the VACOLS.BRIEFF table but should not be actionable unless there is a case - # assignment in the VACOLS.DECASS table. task_id is created using the created_at field from the VACOLS.DECASS table + # assignment in the VACOLS.DECASS table or is being used as a Case Movement action. task_id is created using the created_at field from the VACOLS.DECASS table # so we use the absence of this value to indicate that there is no case assignment and return no actions. - return [] unless task_id if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") @@ -17,6 +16,8 @@ def available_actions(current_user, role) [ Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h ] + elsif task_id.nil? + [] elsif (current_user&.judge_in_vacols? || current_user&.can_act_on_behalf_of_judges?) && FeatureToggle.enabled?(:vlj_legacy_appeal) && !%w[81 33 57 CASEFLOW].include?(appeal.case_record.reload.bfcurloc) diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index 3cdabd0cc8c..edb5786282f 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -20,14 +20,13 @@ namespace :db do end veteran = Veteran.find_by_file_number(file_number) - decass_scenarios = task_type == "HEARINGTASK" || task_type == "SCENARIO1EDGE" || task_type == "BRIEFF_CURLOC_81_TASK" fail ActiveRecord::RecordNotFound unless veteran vacols_veteran_record = find_or_create_vacols_veteran(veteran) # Creates decass for scenario1/2/4 tasks as they require an assigned_by field # which is grabbed from the Decass table (b/c it is an AttorneyLegacyTask) - decass_creation = if decass_scenarios || (task_type == "ATTORNEYTASK" && user&.attorney_in_vacols?) + decass_creation = if task_type == "ATTORNEYTASK" && user&.attorney_in_vacols? true else false end From 358b378ab86026470345ef95cccd17b50cf74671 Mon Sep 17 00:00:00 2001 From: MuhGrayVA <98366428+MuhGrayVA@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:10:52 -0400 Subject: [PATCH 102/203] Calvin/appeals 29692 dropdown (#19376) * location 81 + scenario 1 Dropdown fix * APPEALS-29692-quickfix Removing deprecated and unused code block * APPEALS-29692 Added back in last else catch --------- Co-authored-by: Calvin Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/legacy_tasks/attorney_legacy_task.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index 26a6504c21a..3937fd699e0 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -18,13 +18,6 @@ def available_actions(current_user, role) ] elsif task_id.nil? [] - elsif (current_user&.judge_in_vacols? || current_user&.can_act_on_behalf_of_judges?) && - FeatureToggle.enabled?(:vlj_legacy_appeal) && - !%w[81 33 57 CASEFLOW].include?(appeal.case_record.reload.bfcurloc) - [ - Constants.TASK_ACTIONS.REASSIGN_TO_JUDGE.to_h, - Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h - ] elsif role == "attorney" && current_user == assigned_to [ Constants.TASK_ACTIONS.REVIEW_LEGACY_DECISION.to_h, From e2108c9e6b048757851e136bd6f0831995ec3024 Mon Sep 17 00:00:00 2001 From: MuhGrayVA <98366428+MuhGrayVA@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:21:30 -0400 Subject: [PATCH 103/203] Matt g/appeals scenario1 edge hotfix (#19400) * location 81 + scenario 1 Dropdown fix * APPEALS-29692-quickfix Removing deprecated and unused code block * APPEALS-29692 Added back in last else catch * APPEALS scenario 1 edge case data hotfix Fixing issue where newly made cases were being put to location 81 as tasks were being marked completed prior to new tasks being added thus resulting an 81 location setting --------- Co-authored-by: Calvin Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- lib/tasks/seed_legacy_appeal_tasks.rake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index edb5786282f..62b3849cb40 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -251,27 +251,28 @@ namespace :db do parent: root_task, assigned_to: Bva.singleton ) - ScheduleHearingTask.create!( + sched_hearing = ScheduleHearingTask.create!( appeal: appeal, parent: hearing_task, assigned_to: Bva.singleton - ).update(status: "completed") + ) AssignHearingDispositionTask.create!( appeal: appeal, parent: hearing_task, assigned_to: Bva.singleton ) + sched_hearing.update(status: "completed") when 67..100 hearing_task = HearingTask.create!( appeal: appeal, parent: root_task, assigned_to: Bva.singleton ) - ScheduleHearingTask.create!( + sched_hearing = ScheduleHearingTask.create!( appeal: appeal, parent: hearing_task, assigned_to: Bva.singleton - ).update(status: "completed") + ) assign_hearing_task = AssignHearingDispositionTask.create!( appeal: appeal, parent: hearing_task, @@ -282,6 +283,7 @@ namespace :db do parent: assign_hearing_task, assigned_to: Bva.singleton ) + sched_hearing.update(status: "completed") end rand_val = rand(100) From bfacbbb3b88300689f32a20ae766c486b04da7ea Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:49:41 -0400 Subject: [PATCH 104/203] Updating the scenario 1 modal wording (#19386) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/COPY.json | 1 + client/app/queue/BlockedAdvanceToJudgeView.jsx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/COPY.json b/client/COPY.json index 12d720221b1..a664ea42112 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -537,6 +537,7 @@ "SPECIAL_CASE_MOVEMENT_MODAL_SELECTOR_PLACEHOLDER": "Select a judge", "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TITLE": "Reassign %s's Case", "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE": "This case currently has blocking tasks that will be cancelled to move this case", + "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_LABEL": "Cancellation of task(s) are final.", "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER": "The following task(s) will be cancelled:", "BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER": "Please provide reason(s) and context for the cancellation:", "BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY_MODAL_TITLE": "Confirm Cancellation and Reassign", diff --git a/client/app/queue/BlockedAdvanceToJudgeView.jsx b/client/app/queue/BlockedAdvanceToJudgeView.jsx index 91ad91e883f..f297a8d1ec2 100644 --- a/client/app/queue/BlockedAdvanceToJudgeView.jsx +++ b/client/app/queue/BlockedAdvanceToJudgeView.jsx @@ -258,8 +258,8 @@ class BlockedAdvanceToJudgeView extends React.Component { > {this.modalAlert()}
    - Please Note: {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}
    - Cancellation of task(s) are final. + Please Note: {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}   + {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_LABEL}

    {COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_MODAL_JUDGE_HEADER}

    Date: Thu, 7 Sep 2023 15:50:18 -0400 Subject: [PATCH 105/203] Fixed assign button in assign to attorney modal (#19388) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../components/AssignToAttorneyWidget.jsx | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index d0a4d9d0afa..722b179ccce 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -49,9 +49,10 @@ export class AssignToAttorneyWidget extends React.PureComponent { const instructionType = Array.isArray(props.selectedTasks[0].instructions) ? isInstructionArray : []; this.state = { - instructions: ((this.props.isModal && props.selectedTasks.length > 0 && - props.selectedTasks[0].appealType === 'LegacyAppeal' ? instructionType : []) || []) + props.selectedTasks[0].appealType === 'LegacyAppeal' ? instructionType : []) || []), + assignedToSecondary: null, + modalDisableButton: true }; } else { @@ -106,7 +107,10 @@ export class AssignToAttorneyWidget extends React.PureComponent { setModalOnChangeValue = (stateValue, value) => { this.setState({ [stateValue]: value }, function () { - if (this.state.assignedTo !== null && this.state.instructions.length > 0) { + if (this.state.assignedTo === OTHER && (this.state.assignedToSecondary === null || this.state.instructions.length < 0)){ + this.setState({ modalDisableButton: true }); + } + else if (this.state.assignedTo !== null && this.state.instructions.length > 0) { this.setState({ modalDisableButton: false }); } else { this.setState({ modalDisableButton: true }); @@ -287,10 +291,8 @@ export class AssignToAttorneyWidget extends React.PureComponent { errorMessage={isModal && highlightFormItems && !selectedOptionOther ? 'Choose one' : null} options={optionsOther} placeholder={placeholderOther} - onChange={(selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? - (option) => option && this.props.setSelectedAssigneeSecondary({ assigneeId: option.value }) : - (option) => option && this.props.setSelectedAssigneeSecondary({ assigneeId: option.value }) && - this.setModalOnChangeValue('assignedTo', option ? option.value : null)} + onChange={(option) => option && this.props.setSelectedAssigneeSecondary({ assigneeId: option.value }) && + this.setModalOnChangeValue('assignedToSecondary', option ? option.value : null)} value={selectedOptionOther} /> } @@ -301,11 +303,9 @@ export class AssignToAttorneyWidget extends React.PureComponent { errorMessage={highlightFormItems && instructions.length === 0 ? COPY.INSTRUCTIONS_ERROR_FIELD_REQUIRED : null} id="taskInstructions" placeholder = {COPY.MORE_INFO} - onChange={(selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? - (value) => this.setState({ instructions: value }) : - (value) => this.setModalOnChangeValue('instructions', value) + onChange={(value) => this.setModalOnChangeValue('instructions', value) } - value = {(selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? null : this.state.instructions} + value = {this.state.instructions} /> } @@ -318,16 +318,13 @@ export class AssignToAttorneyWidget extends React.PureComponent { loading={savePending} loadingText={COPY.ASSIGN_WIDGET_LOADING} styling={css({ margin: '1.5rem 0' })} /> } - ; + ; if (selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') { return isModal ? + submitDisabled={this.state.modalDisableButton}> {Widget} : Widget; } From 4d1d91ba4b36d969b444b1170a23ac8512e93830 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:04:22 -0500 Subject: [PATCH 106/203] [APPEALS-29312] added safe navigation (#19335) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/repositories/queue_repository.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/repositories/queue_repository.rb b/app/repositories/queue_repository.rb index 07c18d6b8a2..90fc50f3f9e 100644 --- a/app/repositories/queue_repository.rb +++ b/app/repositories/queue_repository.rb @@ -204,9 +204,9 @@ def find_decass_record(vacols_id, created_in_vacols_date) def update_decass_record(decass_record, decass_attrs) decass_attrs = QueueMapper.new(decass_attrs).rename_and_validate_decass_attrs - VACOLS::Decass.where(defolder: decass_record.defolder, deadtim: decass_record.deadtim) + VACOLS::Decass.where(defolder: decass_record&.defolder, deadtim: decass_record&.deadtim) .update_all(decass_attrs) - decass_record.reload + decass_record&.reload end def create_decass_record(decass_attrs) From b1a0fee62e7146a9d871d14d2c3b37ccc16ce62e Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:58:16 -0400 Subject: [PATCH 107/203] Calvin/appeals 29642-AttorneyRewrite (#19407) * Decision ready for review now works for rewrite * assign to attorney now works for rewrite task * removed legacy update when not reassigning * fixed cancel task and return location update * added safe navigation to assigned to in update * fixed duplicate priorloc for return to attorney * assign to attorney now functions again * made conditional easier to understand * remove byebug --- app/controllers/tasks_controller.rb | 18 +++++++++++------- app/models/attorney_case_review.rb | 2 +- app/repositories/queue_repository.rb | 7 +++++++ client/app/queue/AssignToView.jsx | 15 ++------------- client/app/queue/QueueActions.js | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index c39d5bd5a2a..75b69202f74 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -92,11 +92,10 @@ def create param_groups.each do |task_type, param_group| tasks << valid_task_classes[task_type.to_sym].create_many_from_params(param_group, current_user) end - # This should be the JudgeDecisionReviewTask parent_task = Task.find_by(id: params[:tasks].first[:parent_id]) if params[:tasks].first[:type] == "AttorneyRewriteTask" if parent_task&.appeal&.is_a?(LegacyAppeal) - QueueRepository.reassign_case_to_attorney!( + QueueRepository.reassign_decass_to_attorney!( judge: parent_task.assigned_to, attorney: User.find(params[:tasks].first[:assigned_to_id]), vacols_id: parent_task.appeal.external_id @@ -105,7 +104,6 @@ def create modified_tasks = [parent_tasks_from_params, tasks].flatten.uniq render json: { tasks: json_tasks(modified_tasks) } - rescue ActiveRecord::RecordInvalid => error invalid_record_error(error.record) rescue Caseflow::Error::MailRoutingError => error @@ -118,13 +116,19 @@ def create # assigned_to_id: 23 # } def update - Task.transaction do tasks = task.update_from_params(update_params, current_user) tasks.each { |t| return invalid_record_error(t) unless t.valid? } tasks_hash = json_tasks(tasks.uniq) - if task.appeal.class != LegacyAppeal + if task.appeal.class == LegacyAppeal + assigned_to = if update_params&.[](:reassign)&.[](:assigned_to_id) + User.find(update_params[:reassign][:assigned_to_id]) + elsif task.type == "AttorneyTask" || task.type == "AttorneyRewriteTask" + User.find(Task.find_by(id: task.parent_id).assigned_to_id) + end + QueueRepository.update_location_to_judge(task.appeal.vacols_id, assigned_to) if assigned_to + else modified_task_contested_claim end # currently alerts are only returned by ScheduleHearingTask @@ -379,9 +383,9 @@ def create_params task = task.merge(assigned_to_type: User.name) if !task[:assigned_to_type] if appeal.is_a?(LegacyAppeal) - if (task[:type] == "BlockedSpecialCaseMovementTask" || task[:type] == "SpecialCaseMovementTask") + if task[:type] == "BlockedSpecialCaseMovementTask" || task[:type] == "SpecialCaseMovementTask" task = task.merge(external_id: params["tasks"][0]["external_id"], legacy_task_type: params["tasks"][0]["legacy_task_type"], - appeal_type: params["tasks"][0]["appeal_type"]) + appeal_type: params["tasks"][0]["appeal_type"]) end end task diff --git a/app/models/attorney_case_review.rb b/app/models/attorney_case_review.rb index 7c7d6797220..0efd58da35e 100644 --- a/app/models/attorney_case_review.rb +++ b/app/models/attorney_case_review.rb @@ -102,7 +102,7 @@ def complete(params) ActiveRecord::Base.multi_transaction do record = create(params) if record.valid? - if record.legacy? && record&.task&.type == "AttorneyTask" + if record.legacy? && (record&.task&.type == "AttorneyTask" || record&.task&.type == "AttorneyRewriteTask") record.update_in_vacols_and_caseflow! else record.legacy? ? record.update_in_vacols! : record.update_in_caseflow! diff --git a/app/repositories/queue_repository.rb b/app/repositories/queue_repository.rb index 90fc50f3f9e..41ac5bfaa8a 100644 --- a/app/repositories/queue_repository.rb +++ b/app/repositories/queue_repository.rb @@ -160,6 +160,13 @@ def reassign_case_to_attorney!(judge:, attorney:, vacols_id:) end end + def reassign_decass_to_attorney!(judge:, attorney:, vacols_id:) + transaction do + attrs = assign_to_attorney_attrs(vacols_id, attorney, judge) + create_decass_record(attrs.merge(adding_user: judge.vacols_uniq_id)) + end + end + def any_task_assigned_by_user?(appeal, user) VACOLS::Decass.where(defolder: appeal.vacols_id, demdusr: user.vacols_uniq_id).exists? end diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index 53cb12fbb88..f4cd7fd4473 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -147,7 +147,7 @@ class AssignToView extends React.Component { }; if (taskType === 'AttorneyRewriteTask' && task.isLegacy === true) { - return this.reassignTask(false, true); + return this.reassignTask(); } if (isReassignAction) { @@ -158,12 +158,6 @@ class AssignToView extends React.Component { requestSave('/tasks', payload, isPulacCerullo ? pulacCerulloSuccessMessage : assignTaskSuccessMessage). then((resp) => { this.props.onReceiveAmaTasks(resp.body.tasks.data); - if (task.appealType === 'LegacyAppeal') { - this.props.legacyReassignToJudge({ - tasks: [task], - assigneeId: this.state.selectedValue - }, assignTaskSuccessMessage); - } }). catch(() => { // handle the error from the frontend @@ -223,12 +217,6 @@ class AssignToView extends React.Component { if (task.type === 'JudgeAssignTask') { this.props.setOvertime(task.externalAppealId, false); } - if (task.appealType === 'LegacyAppeal') { - this.props.legacyReassignToJudge({ - tasks: [task], - assigneeId: this.state.selectedValue - }, successMsg); - } }); }; @@ -341,6 +329,7 @@ class AssignToView extends React.Component { const action = getAction(this.props); const actionData = taskActionData(this.props); + actionData.drop_down_label = COPY.JUDGE_LEGACY_DECISION_REVIEW_TITLE const isPulacCerullo = action && action.label === 'Pulac-Cerullo'; diff --git a/client/app/queue/QueueActions.js b/client/app/queue/QueueActions.js index dda5a3c24d8..6b81393f568 100644 --- a/client/app/queue/QueueActions.js +++ b/client/app/queue/QueueActions.js @@ -564,7 +564,7 @@ export const reassignTasksToUser = ({ }) => (dispatch) => Promise.all(tasks.map((oldTask) => { let params, url; - if (oldTask.appealType === 'LegacyAppeal' && oldTask.type === 'AttorneyTask') { + if (oldTask.appealType === 'LegacyAppeal' && (oldTask.type === 'AttorneyTask' || oldTask.type === 'AttorneyRewriteTask')) { url = `/tasks/${oldTask.taskId}`; params = { data: { From cdbad498306455fe73bdff8935e364f5b1893aa1 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:59:05 -0400 Subject: [PATCH 108/203] removing the place holder for assign task modal (#19408) --- client/app/queue/components/AssignToAttorneyWidget.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 722b179ccce..69330cb723f 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -302,7 +302,6 @@ export class AssignToAttorneyWidget extends React.PureComponent { name={COPY.ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL} errorMessage={highlightFormItems && instructions.length === 0 ? COPY.INSTRUCTIONS_ERROR_FIELD_REQUIRED : null} id="taskInstructions" - placeholder = {COPY.MORE_INFO} onChange={(value) => this.setModalOnChangeValue('instructions', value) } value = {this.state.instructions} From 7f291432f158685e9b2a351e7d536aaab36890e7 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:59:52 -0400 Subject: [PATCH 109/203] updated dropdown placeholder for assign task modal (#19409) --- client/COPY.json | 1 + client/app/queue/components/AssignToAttorneyWidget.jsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/COPY.json b/client/COPY.json index a664ea42112..60c9b6aea47 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -460,6 +460,7 @@ "ASSIGN_WIDGET_ASSIGNMENT_ERROR_DETAIL_MODAL": " Reassign tasks to a judge in the action dropdown", "ASSIGN_WIDGET_LOADING": "Loading...", "ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER": "Select a user", + "ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER": "Select", "VHA_ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER": "Select a Program Office", "ASSIGN_WIDGET_DROPDOWN_NAME_PRIMARY": "Assignee", "ASSIGN_WIDGET_DROPDOWN_NAME_SECONDARY": "Other assignee", diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 69330cb723f..292ed2b793e 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -256,7 +256,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { } if (optionsOther?.length) { - placeholderOther = COPY.ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER; + placeholderOther = COPY.ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER; selectedOptionOther = optionsOther.find((option) => option.value === selectedAssigneeSecondary); } From 4539af7f9280b231c27820ab1887d67ac321f7db Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:00:44 -0400 Subject: [PATCH 110/203] now updates case review both when legacy with ama task (#19413) --- app/models/judge_case_review.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/judge_case_review.rb b/app/models/judge_case_review.rb index bc2acd897fc..290f9be5e36 100644 --- a/app/models/judge_case_review.rb +++ b/app/models/judge_case_review.rb @@ -45,6 +45,11 @@ def update_in_caseflow! update_issue_dispositions_in_caseflow! end + def update_in_vacols_and_caseflow! + update_in_vacols! + task.update!(status: Constants.TASK_STATUSES.completed) + end + private def sign_decision_or_create_omo! @@ -84,7 +89,11 @@ def complete(params) ActiveRecord::Base.multi_transaction do record = create(params) if record.valid? - record.legacy? ? record.update_in_vacols! : record.update_in_caseflow! + if record.legacy? && record.task.type == "JudgeDecisionReviewTask" + record.update_in_vacols_and_caseflow! + else + record.legacy? ? record.update_in_vacols! : record.update_in_caseflow! + end record.associate_with_appeal end record From 370aeb31d62657299623c530dc2d4943a4a5562c Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:57:28 -0400 Subject: [PATCH 111/203] Updated success banne for scenario 6 (#19418) --- client/app/queue/AssignToView.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index f4cd7fd4473..3901738c888 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -210,7 +210,9 @@ class AssignToView extends React.Component { return assignor; }; - const successMsg = { title: sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE_SCM, assignedByListItem(), this.getAssignee()) }; + let titleValue = task.type === "JudgeDecisionReviewTask" ? sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()) : sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE_SCM, assignedByListItem(), this.getAssignee()) + + const successMsg = { title: titleValue } return this.props.requestPatch(`/tasks/${task.taskId}`, payload, successMsg).then((resp) => { this.props.onReceiveAmaTasks(resp.body.tasks.data); From 967605bfd14eb6349be8da66c7ed1f0e8d27e6a0 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 11 Sep 2023 17:12:44 -0400 Subject: [PATCH 112/203] filters unique tasks by external appeal ID (#19426) --- client/app/queue/selectors.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/app/queue/selectors.js b/client/app/queue/selectors.js index 5e50e90b20d..542f1ae3633 100644 --- a/client/app/queue/selectors.js +++ b/client/app/queue/selectors.js @@ -137,7 +137,10 @@ export const legacyJudgeTasksAssignedToUser = createSelector( const workTasksByAssigneeCssIdSelector = createSelector( [tasksByAssigneeCssIdSelector], - (tasks) => workTasksSelector(tasks) + (tasks) => + workTasksSelector(tasks). + filter((task, i, arr) => arr.map((id) => (id.externalAppealId)). + indexOf(task.externalAppealId) === i), ); const workTasksByAssigneeOrgSelector = createSelector( From e5b8fcb1c95e98aef2402e360d17b7a92f15da21 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Mon, 11 Sep 2023 22:17:52 -0600 Subject: [PATCH 113/203] removing withdraw option if the issue is not saved or recently created --- client/app/intake/components/IssueList.jsx | 2 +- spec/feature/intake/vha_hlr_sc_enter_no_decision_date_spec.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/app/intake/components/IssueList.jsx b/client/app/intake/components/IssueList.jsx index b5a540091e5..6b037cf1538 100644 --- a/client/app/intake/components/IssueList.jsx +++ b/client/app/intake/components/IssueList.jsx @@ -42,7 +42,7 @@ export default class IssuesList extends React.Component { options.push({ displayText: 'Correct issue', value: 'correct' }); } else if (!issue.examRequested && !issue.withdrawalDate && !issue.withdrawalPending && !isDtaError) { - if (userCanWithdrawIssues) { + if (userCanWithdrawIssues && typeof issue.id !== "undefined") { options.push( { displayText: 'Withdraw issue', value: 'withdraw' } diff --git a/spec/feature/intake/vha_hlr_sc_enter_no_decision_date_spec.rb b/spec/feature/intake/vha_hlr_sc_enter_no_decision_date_spec.rb index abd7d1491e0..a15d2bbb825 100644 --- a/spec/feature/intake/vha_hlr_sc_enter_no_decision_date_spec.rb +++ b/spec/feature/intake/vha_hlr_sc_enter_no_decision_date_spec.rb @@ -72,6 +72,7 @@ # Click the first issue actions button and select Add a decision date within "#issue-#{issue_id}" do + expect("issue-action-0").to_not have_content("Withdraw Issue") first("select").select("Add decision date") end @@ -174,6 +175,8 @@ # Edit the decision date for added issue # this is issue-undefined because the issue has not yet been created and does not have an id within "#issue-undefined" do + # newly made issue should not have withdraw issue as its not yet saved into the database + expect("issue-action-1").to_not have_content("Withdraw Issue") select("Add decision date", from: "issue-action-1") end From 8014c579f5b130ca3ed36082984fd04541a98326 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Mon, 11 Sep 2023 22:53:21 -0600 Subject: [PATCH 114/203] single quote --- client/app/intake/components/IssueList.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/intake/components/IssueList.jsx b/client/app/intake/components/IssueList.jsx index 6b037cf1538..e2351b51e47 100644 --- a/client/app/intake/components/IssueList.jsx +++ b/client/app/intake/components/IssueList.jsx @@ -42,7 +42,7 @@ export default class IssuesList extends React.Component { options.push({ displayText: 'Correct issue', value: 'correct' }); } else if (!issue.examRequested && !issue.withdrawalDate && !issue.withdrawalPending && !isDtaError) { - if (userCanWithdrawIssues && typeof issue.id !== "undefined") { + if (userCanWithdrawIssues && typeof issue.id !== 'undefined') { options.push( { displayText: 'Withdraw issue', value: 'withdraw' } From 26837d8cbf6a40ef65aad4084e1308ba196130a4 Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:15:18 -0500 Subject: [PATCH 115/203] Kamalam7/appeals 29116 v1 (#19429) * Change to Edge Scenario1 * Change for Edge Scenario 1 * APPEALS-29116 Scenario-1 edge case --------- Co-authored-by: piedram Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/task.rb | 62 ++++++++++++------- .../tasks/congressional_interest_mail_task.rb | 5 ++ app/models/tasks/foia_task.rb | 2 +- app/models/tasks/hearing_task.rb | 2 +- .../power_of_attorney_related_mail_task.rb | 5 ++ app/models/tasks/privacy_act_task.rb | 2 +- app/models/tasks/transcription_task.rb | 2 +- app/models/tasks/translation_task.rb | 2 +- spec/models/task_spec.rb | 3 +- 9 files changed, 55 insertions(+), 30 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 28456755014..23d6b1bfedc 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -146,6 +146,10 @@ def label name.titlecase end + def legacy_blocking? + false + end + def closed_statuses [Constants.TASK_STATUSES.completed, Constants.TASK_STATUSES.cancelled] end @@ -260,9 +264,10 @@ def special_case_for_legacy(parent_task, params, user) if (params[:type] == "SpecialCaseMovementTask") && (parent_task.type == "RootTask") create_judge_assigned_task_for_legacy(params, parent_task) elsif (params[:type] == "BlockedSpecialCaseMovementTask") && (parent_task.type == "HearingTask") - cancel_blocking_task_legacy(params, parent_task) + cancel_blocking_task_legacy(params, parent_task.parent) else - judge = User.find(params["assigned_to_id"]) + + judge = User.find(params[:assigned_to_id]) legacy_appeal = LegacyAppeal.find(parent_task.appeal_id) child = create_child_task(parent_task, user, params) parent_task.update!(status: params[:status]) if params[:status] @@ -288,30 +293,10 @@ def create_parent_task(params, user) parent_task end - def speacial_case_for_legacy(parent_task, params) - if (params[:type] == "SpecialCaseMovementTask") && (parent_task.type == "RootTask") - create_judge_assigned_task_for_legacy(params, parent_task) - elsif (params[:type] == "BlockedSpecialCaseMovementTask") && (parent_task.type == "HearingTask") - cancel_blocking_task_legacy(params, parent_task) - end - end - def cancel_blocking_task_legacy(params, parent_task) - tasks = [] - tasks.push(parent_task) - parent_task.children.each { |current_task| tasks.push(current_task) } - - transaction do - tasks.each do |task| - task.update!( - status: Constants.TASK_STATUSES.cancelled, - cancelled_by_id: RequestStore[:current_user]&.id, - closed_at: Time.zone.now - ) - end - end + parent_task.children.each { |current_task| seach_for_blocking(current_task) } - legacy_appeal = LegacyAppeal.find(tasks[0].appeal_id) + legacy_appeal = LegacyAppeal.find(parent_task.appeal_id) judge = User.find(params["assigned_to_id"]) current_child = JudgeAssignTask.create!(appeal: legacy_appeal, @@ -323,6 +308,30 @@ def cancel_blocking_task_legacy(params, parent_task) current_child end + def cancelled_task(task) + task.update!( + status: Constants.TASK_STATUSES.cancelled, + cancelled_by_id: RequestStore[:current_user]&.id, + closed_at: Time.zone.now + ) + end + + def cancel_all_children(current_task) + if current_task.children.count == 0 + if current_task.status != "Cancelled" && current_task.status != "completed" + cancelled_task(current_task) + end + else + current_task.children.each { |current_task| cancel_all_children(current_task) } + end + end + + def seach_for_blocking(current_task) + current_task.legacy_blocking? ? + cancel_all_children(current_task) : + current_task.children.each { |current_task| seach_for_blocking(current_task) } + end + def create_judge_assigned_task_for_legacy(params, parent_task) legacy_appeal = LegacyAppeal.find(parent_task.appeal_id) judge = User.find(params["assigned_to_id"]) @@ -941,6 +950,11 @@ def update_appeal_state_on_task_creation update_appeal_state_when_ihp_created end + ## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution + def legacy_blocking? + self.class.legacy_blocking? + end + private def create_and_auto_assign_child_task(options = {}) diff --git a/app/models/tasks/congressional_interest_mail_task.rb b/app/models/tasks/congressional_interest_mail_task.rb index 63d72048f78..5e7c01c5a07 100644 --- a/app/models/tasks/congressional_interest_mail_task.rb +++ b/app/models/tasks/congressional_interest_mail_task.rb @@ -12,4 +12,9 @@ def self.label def self.default_assignee(_parent) LitigationSupport.singleton end + + ## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution + def self.legacy_blocking? + true + end end diff --git a/app/models/tasks/foia_task.rb b/app/models/tasks/foia_task.rb index 5a9f1cfd37c..b3bcc9b3d80 100644 --- a/app/models/tasks/foia_task.rb +++ b/app/models/tasks/foia_task.rb @@ -9,7 +9,7 @@ def available_actions(user) end ## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution - def legacy_blocking + def self.legacy_blocking? true end end diff --git a/app/models/tasks/hearing_task.rb b/app/models/tasks/hearing_task.rb index 60af87957f9..eb9ca6191e5 100644 --- a/app/models/tasks/hearing_task.rb +++ b/app/models/tasks/hearing_task.rb @@ -22,7 +22,7 @@ def default_instructions end ## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution - def legacy_blocking + def self.legacy_blocking? true end diff --git a/app/models/tasks/power_of_attorney_related_mail_task.rb b/app/models/tasks/power_of_attorney_related_mail_task.rb index 9ebb24f1f2b..2c45c27bae0 100644 --- a/app/models/tasks/power_of_attorney_related_mail_task.rb +++ b/app/models/tasks/power_of_attorney_related_mail_task.rb @@ -5,6 +5,11 @@ def self.blocking? true end + ## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution + def self.legacy_blocking? + true + end + def self.label COPY::POWER_OF_ATTORNEY_MAIL_TASK_LABEL end diff --git a/app/models/tasks/privacy_act_task.rb b/app/models/tasks/privacy_act_task.rb index 6b180802476..06de98f2f35 100644 --- a/app/models/tasks/privacy_act_task.rb +++ b/app/models/tasks/privacy_act_task.rb @@ -7,7 +7,7 @@ class PrivacyActTask < Task include CavcAdminActionConcern ## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution - def legacy_blocking + def self.legacy_blocking? true end diff --git a/app/models/tasks/transcription_task.rb b/app/models/tasks/transcription_task.rb index db8f2a996fa..0739fcf0006 100644 --- a/app/models/tasks/transcription_task.rb +++ b/app/models/tasks/transcription_task.rb @@ -40,7 +40,7 @@ def available_actions(user) end ## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution - def legacy_blocking + def self.legacy_blocking? true end diff --git a/app/models/tasks/translation_task.rb b/app/models/tasks/translation_task.rb index 1e311566bb1..eeb5aad91aa 100644 --- a/app/models/tasks/translation_task.rb +++ b/app/models/tasks/translation_task.rb @@ -9,7 +9,7 @@ class TranslationTask < Task include CavcAdminActionConcern ## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution - def legacy_blocking + def self.legacy_blocking? true end diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb index 9a9afd4d64c..7618d222090 100644 --- a/spec/models/task_spec.rb +++ b/spec/models/task_spec.rb @@ -1329,7 +1329,7 @@ let!(:attorney) { create(:user) } let!(:appeal) { create(:appeal) } let!(:task) { create(:task, type: Task.name, appeal: appeal) } - let(:params) { { assigned_to: judge, appeal: task.appeal, parent_id: task.id, type: Task.name } } + let(:params) { { assigned_to: judge, assigned_to_id: judge.id, appeal: task.appeal, parent_id: task.id, type: Task.name } } before do create(:staff, :judge_role, sdomainid: judge.css_id) @@ -1364,6 +1364,7 @@ def test_func(_task, _user) let(:appeal) { create(:legacy_appeal, vacols_case: create(:case)) } it "the parent task is 'on hold'" do + # binding.pry expect(task.status).to eq("assigned") new_task = subject expect(new_task.parent_id).to eq(task.id) From b188e7075cc0b46c1ca0a53300bc72583c75972f Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:16:11 -0500 Subject: [PATCH 116/203] [APPEALS-29765] Typo error (#19420) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/COPY.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/COPY.json b/client/COPY.json index 60c9b6aea47..7fbe9ddaa0b 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -670,7 +670,7 @@ "REASSIGN_TASK_SUCCESS_MESSAGE": "You have successfully reassigned this task to %s", "HEARING_ASSIGN_TASK_SUCCESS_MESSAGE_DETAIL": "You can continue to assign tasks to yourself and others using this queue.", "ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ": "You have successfully reassigned %s’s case to %s", - "ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ_MESSAGE_DETAIL": " All blocking task(s) have been cancelled.", + "ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ_MESSAGE_DETAIL": " All blocking tasks have been cancelled.", "DISTRIBUTE_TASK_SUCCESS_MESSAGE_NON_BLOCKING": "You have successfully assigned %s’s case to %s", "LEGACY_APPEALS_VLJ_REASON_INSTRUCTIONS" : "Reason:", "LEGACY_APPEALS_VLJ_ORIGINAL_JUDGE_INSTRUCTIONS" : "Original Judge:", From 844a2f6ec67c830e013f8f15040a06a8aa7bfac4 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:17:11 -0500 Subject: [PATCH 117/203] [APPEALS-29779] change to select.. (#19423) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/COPY.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/COPY.json b/client/COPY.json index 7fbe9ddaa0b..27c9b0a3c11 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -650,7 +650,7 @@ "ADVANCE_ON_DOCKET_MOTION_SUCCESS_MESSAGE": "AOD status has been %s due to %s", "TASK_ACTION_DROPDOWN_BOX_LABEL": "Select an action…", "TASK_ACTION_DROPDOWN_BOX_LABEL_SHORT": "Select...", - "ASSIGN_TO_USER_DROPDOWN": "Select a user", + "ASSIGN_TO_USER_DROPDOWN": "Select...", "ASSIGN_TO_TEAM_DROPDOWN": "Select a team", "ASSIGN_TASK_TITLE": "Assign task", "ASSIGN_TASK_TO_TITLE": "Assign task to %s", From deafe69ea9a8bfa58431d691e31696602002f9f3 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Tue, 12 Sep 2023 20:19:55 -0400 Subject: [PATCH 118/203] updating dropdown placeholder (#19432) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/AssignToView.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index 3901738c888..17d11057187 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -284,7 +284,7 @@ class AssignToView extends React.Component { return COPY.ASSIGN_TO_TEAM_DROPDOWN; } - return COPY.ASSIGN_TO_USER_DROPDOWN; + return COPY.ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER; }; From edaa36748fb4161072aaa7bfb6c1833e3274b865 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Tue, 12 Sep 2023 20:25:12 -0400 Subject: [PATCH 119/203] adds decass for review tasks (#19443) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- lib/tasks/seed_legacy_appeal_tasks.rake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index 62b3849cb40..5669dd9d4b3 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -26,7 +26,7 @@ namespace :db do # Creates decass for scenario1/2/4 tasks as they require an assigned_by field # which is grabbed from the Decass table (b/c it is an AttorneyLegacyTask) - decass_creation = if task_type == "ATTORNEYTASK" && user&.attorney_in_vacols? + decass_creation = if (task_type == "ATTORNEYTASK" && user&.attorney_in_vacols?) || task_type == "REVIEWTASK" true else false end @@ -125,7 +125,7 @@ namespace :db do if decass_creation { defolder: key, - deatty: user.id, + deatty: user.attorney_in_vacols? ? user.id : User.find_by_css_id("BVALSHIELDS").id, deteam: "SBO", deassign: VacolsHelper.local_date_with_utc_timezone - 7.days, dereceive: VacolsHelper.local_date_with_utc_timezone, @@ -221,7 +221,8 @@ namespace :db do JudgeDecisionReviewTask.create!( appeal: appeal, parent: root_task, - assigned_to: user + assigned_to: user, + assigned_by: User.find_by_css_id("BVALSHIELDS") ) $stdout.puts("You have created a Review task") end From 5366ec51879fa44c251b1290d0ee1eed239933de Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 13 Sep 2023 10:49:00 -0400 Subject: [PATCH 120/203] Calvin/appeals 29642 legacy return (#19415) * Decision ready for review now works for rewrite * assign to attorney now works for rewrite task * removed legacy update when not reassigning * fixed cancel task and return location update * added safe navigation to assigned to in update * fixed duplicate priorloc for return to attorney * assign to attorney now functions again * made conditional easier to understand * remove byebug * adds functionality for return to attorney on LA * adding assign to attorney on attorney legacy tasks --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../legacy_tasks/attorney_legacy_task.rb | 4 ++++ client/app/queue/AssignToView.jsx | 23 +++++++++++++++---- client/app/queue/QueueActions.js | 10 ++------ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index 3937fd699e0..8866844ef0c 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -24,6 +24,10 @@ def available_actions(current_user, role) Constants.TASK_ACTIONS.SUBMIT_OMO_REQUEST_FOR_REVIEW.to_h, Constants.TASK_ACTIONS.ADD_ADMIN_ACTION.to_h ] + elsif current_user&.can_act_on_behalf_of_legacy_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) + [ + Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h + ] else [] end diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index 17d11057187..ff35a32d303 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -9,7 +9,7 @@ import VHA_VAMCS from '../../constants/VHA_VAMCS'; import { taskById, appealWithDetailSelector, getRootTaskLegacyAppealSCM } from './selectors'; -import { onReceiveAmaTasks, legacyReassignToJudge, setOvertime } from './QueueActions'; +import { onReceiveAmaTasks, legacyReassignToJudge, setOvertime, initialAssignTasksToUser } from './QueueActions'; import RadioField from '../components/RadioField'; import SearchableDropdown from '../components/SearchableDropdown'; @@ -146,12 +146,16 @@ class AssignToView extends React.Component { detail: sprintf(COPY.PULAC_CERULLO_SUCCESS_DETAIL, appeal.veteranFullName) }; + //Return to attorney on legacy appeals with legacy tasks if (taskType === 'AttorneyRewriteTask' && task.isLegacy === true) { - return this.reassignTask(); + return this.props.initialAssignTasksToUser({ + tasks: [task], + assigneeId: this.state.selectedValue + }, assignTaskSuccessMessage); } if (isReassignAction) { - return this.reassignTask(); + return this.reassignTask(taskType === 'JudgeLegacyAssignTask'); } return this.props. @@ -185,7 +189,7 @@ class AssignToView extends React.Component { return assignee; }; - reassignTask = () => { + reassignTask = (isLegacyReassignToJudge = false) => { const task = this.props.task; const payload = { data: { @@ -214,6 +218,13 @@ class AssignToView extends React.Component { const successMsg = { title: titleValue } + if (isLegacyReassignToJudge) { + return this.props.legacyReassignToJudge({ + tasks: [task], + assigneeId: this.state.selectedValue + }, successMsg); + } + return this.props.requestPatch(`/tasks/${task.taskId}`, payload, successMsg).then((resp) => { this.props.onReceiveAmaTasks(resp.body.tasks.data); if (task.type === 'JudgeAssignTask') { @@ -332,7 +343,7 @@ class AssignToView extends React.Component { const action = getAction(this.props); const actionData = taskActionData(this.props); - actionData.drop_down_label = COPY.JUDGE_LEGACY_DECISION_REVIEW_TITLE + actionData.drop_down_label = COPY.JUDGE_LEGACY_DECISION_REVIEW_TITLE; const isPulacCerullo = action && action.label === 'Pulac-Cerullo'; if (!task || task.availableActions.length === 0) { @@ -453,6 +464,7 @@ AssignToView.propTypes = { isTeamAssign: PropTypes.bool, onReceiveAmaTasks: PropTypes.func, legacyReassignToJudge: PropTypes.func, + initialAssignTasksToUser: PropTypes.func, requestPatch: PropTypes.func, requestSave: PropTypes.func, rootTask: PropTypes.func, @@ -489,6 +501,7 @@ const mapDispatchToProps = (dispatch) => requestSave, onReceiveAmaTasks, legacyReassignToJudge, + initialAssignTasksToUser, setOvertime, resetSuccessMessages }, diff --git a/client/app/queue/QueueActions.js b/client/app/queue/QueueActions.js index 6b81393f568..20c9448cf14 100644 --- a/client/app/queue/QueueActions.js +++ b/client/app/queue/QueueActions.js @@ -651,19 +651,13 @@ export const reassignTasksToUser = ({ })); export const legacyReassignToJudge = ({ - tasks, assigneeId, instructions + tasks, assigneeId }, successMessage) => (dispatch) => Promise.all(tasks.map((oldTask) => { const params = { data: { tasks: { assigned_to_id: assigneeId, - appeal_id: oldTask.appealId, - instructions, - reassign: { - assigned_to_id: assigneeId, - assigned_to_type: 'User', - instructions - } + appeal_id: oldTask.appealId } } }; From 5d2185b257704af88571e4cd947bb15799a4c515 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 13 Sep 2023 12:55:18 -0400 Subject: [PATCH 121/203] finalized UAT options for rake task (#19450) --- lib/tasks/seed_legacy_appeal_tasks.rake | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index 5669dd9d4b3..9112587f520 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -122,10 +122,15 @@ namespace :db do end def custom_decass_attributes(key, user, decass_creation) + attorney = if Rails.env.development? || Rails.env.test? + User.find_by_css_id("BVALSHIELDS") # local / test option + else + User.find_by_css_id("CF_ATTN_283") # UAT option + end if decass_creation { defolder: key, - deatty: user.attorney_in_vacols? ? user.id : User.find_by_css_id("BVALSHIELDS").id, + deatty: user.attorney_in_vacols? ? user.id : attorney.id, deteam: "SBO", deassign: VacolsHelper.local_date_with_utc_timezone - 7.days, dereceive: VacolsHelper.local_date_with_utc_timezone, @@ -182,16 +187,22 @@ namespace :db do # Will need a judge user for judge decision review task and an attorney user for the subsequent Attorney Task root_task = RootTask.find_or_create_by!(appeal: appeal) + judge = if Rails.env.development? || Rails.env.test? + User.find_by_css_id("BVAAABSHIRE") # local / test option + else + User.find_by_css_id("CF_VLJ_283") # UAT option + end + review_task = JudgeDecisionReviewTask.create!( appeal: appeal, parent: root_task, - assigned_to: User.find_by_css_id("BVAAABSHIRE") + assigned_to: judge ) AttorneyTask.create!( appeal: appeal, parent: review_task, assigned_to: user, - assigned_by: User.find_by_css_id("BVAAABSHIRE") + assigned_by: judge ) $stdout.puts("You have created an Attorney task") end @@ -221,8 +232,7 @@ namespace :db do JudgeDecisionReviewTask.create!( appeal: appeal, parent: root_task, - assigned_to: user, - assigned_by: User.find_by_css_id("BVALSHIELDS") + assigned_to: user ) $stdout.puts("You have created a Review task") end @@ -397,7 +407,7 @@ namespace :db do if Rails.env.development? || Rails.env.test? $stdout.puts("Hint: Attorney Options include 'BVALSHIELDS'") # local / test option else - $stdout.puts("Hint: Judge Options include 'CF_ATTN_283', 'CF_ATTNTWO_283'") # UAT option + $stdout.puts("Hint: Attorney Options include 'CF_ATTN_283', 'CF_ATTNTWO_283'") # UAT option end css_id = $stdin.gets.chomp.upcase @@ -408,7 +418,7 @@ namespace :db do user = if Rails.env.development? || Rails.env.test? User.find_by_css_id("FAKE USER") # local / test option else - User.find_by_css_id("CF_VLJTHREE_283") # UAT option + User.find_by_css_id("CF_VLJ_283") # UAT option end end From 97f910c67085be87cc2ac5361ef9a4935c375b18 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Thu, 14 Sep 2023 10:45:49 -0500 Subject: [PATCH 122/203] [APPEALS-29766] Removed Assign to (#19460) --- client/app/queue/AssignToView.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index ff35a32d303..a9b70aac577 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -343,7 +343,6 @@ class AssignToView extends React.Component { const action = getAction(this.props); const actionData = taskActionData(this.props); - actionData.drop_down_label = COPY.JUDGE_LEGACY_DECISION_REVIEW_TITLE; const isPulacCerullo = action && action.label === 'Pulac-Cerullo'; if (!task || task.availableActions.length === 0) { From a959c86b3c53a2dd4f66120e8513f5d87b1247c6 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:46:27 -0400 Subject: [PATCH 123/203] Fix for assign modal button (#19455) --- client/app/queue/components/AssignToAttorneyWidget.jsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 292ed2b793e..41acad14f34 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -271,12 +271,9 @@ export class AssignToAttorneyWidget extends React.PureComponent { errorMessage={isModal && highlightFormItems && !selectedOption ? 'Choose one' : null} options={options} placeholder={COPY.ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER} - onChange={(selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') ? - (option) => option && this.props.setSelectedAssignee({ assigneeId: option.value }) && - this.setModalOnChangeValue('assignedTo', option ? option.value : null) : - (option) => option && this.props.setSelectedAssignee({ assigneeId: option.value })} + onChange={(option) => option && this.props.setSelectedAssignee({ assigneeId: option.value }) && + this.setModalOnChangeValue('assignedTo', option ? option.value : null)} value={selectedOption} - /> {selectedAssignee === OTHER && From 4e0e578f78aa49b88122df7172c3409adfc9767f Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:49:41 -0400 Subject: [PATCH 124/203] Fix error in Scenario 7 text area (#19462) * Fix error in Scenario 7 text area * Fix type error * Fix error when refresh to assign a attorney --- client/app/queue/AssignToView.jsx | 18 ++++++++++++------ .../components/AssignToAttorneyWidget.jsx | 14 ++++++++------ client/app/queue/selectors.js | 5 +++-- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index a9b70aac577..af8cb7049d9 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -41,10 +41,13 @@ class AssignToView extends React.Component { // Autofill the instruction field if assigning to a person on the team. Since they will // probably want the instructions from the assigner. const instructions = this.props.task.instructions; + const taskType = this.props.task.type; const instructionLength = instructions ? instructions.length : 0; let existingInstructions = ''; - if (instructions && instructionLength > 0 && !this.props.isTeamAssign && !this.props.isReassignAction) { + if (taskType === 'JudgeDecisionReviewTask') { + existingInstructions = ''; + } else if (instructions && instructionLength > 0 && !this.props.isTeamAssign && !this.props.isReassignAction) { existingInstructions = instructions[instructionLength - 1]; } @@ -146,7 +149,7 @@ class AssignToView extends React.Component { detail: sprintf(COPY.PULAC_CERULLO_SUCCESS_DETAIL, appeal.veteranFullName) }; - //Return to attorney on legacy appeals with legacy tasks + // Return to attorney on legacy appeals with legacy tasks if (taskType === 'AttorneyRewriteTask' && task.isLegacy === true) { return this.props.initialAssignTasksToUser({ tasks: [task], @@ -155,7 +158,7 @@ class AssignToView extends React.Component { } if (isReassignAction) { - return this.reassignTask(taskType === 'JudgeLegacyAssignTask'); + return this.reassignTask(task.type === 'JudgeLegacyAssignTask' && taskType === 'JudgeLegacyAssignTask'); } return this.props. @@ -214,9 +217,11 @@ class AssignToView extends React.Component { return assignor; }; - let titleValue = task.type === "JudgeDecisionReviewTask" ? sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()) : sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE_SCM, assignedByListItem(), this.getAssignee()) + let titleValue = task.type === 'JudgeDecisionReviewTask' ? + sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()) : + sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE_SCM, assignedByListItem(), this.getAssignee()); - const successMsg = { title: titleValue } + const successMsg = { title: titleValue }; if (isLegacyReassignToJudge) { return this.props.legacyReassignToJudge({ @@ -369,7 +374,7 @@ class AssignToView extends React.Component { modalProps.submitDisabled = this.state.modalDisableButton; } - if (this.props.location.pathname.includes('distribute_to_judge_legacy')) { + if (window.location.pathname.includes('distribute_to_judge_legacy')) { modalProps.button = 'Assign'; modalProps.submitButtonClassNames = ['usa-button', 'usa-button-hover', 'usa-button-warning']; modalProps.submitDisabled = this.state.modalDisableButton; @@ -476,6 +481,7 @@ AssignToView.propTypes = { appealType: PropTypes.string, assignedBy: PropTypes.string, assigneeName: PropTypes.string, + isLegacy: PropTypes.bool }), setOvertime: PropTypes.func, resetSuccessMessages: PropTypes.func diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 41acad14f34..28eabb6cd5d 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -45,12 +45,14 @@ export class AssignToAttorneyWidget extends React.PureComponent { if (props.selectedTasks.length > 0 && props.selectedTasks[0].appealType === 'LegacyAppeal') { const instructions = (props.selectedTasks[0].instructions.length === 0 ? [] : props.selectedTasks[0].instructions.filter((instructionData) => instructionData)); - const isInstructionArray = (instructions === [] ? [] : instructions); + const isInstructionArray = (instructions.length === 0 ? [] : instructions); const instructionType = Array.isArray(props.selectedTasks[0].instructions) ? isInstructionArray : []; this.state = { instructions: ((this.props.isModal && props.selectedTasks.length > 0 && - props.selectedTasks[0].appealType === 'LegacyAppeal' ? instructionType : []) || []), + props.selectedTasks[0].appealType === 'LegacyAppeal' && + (props.selectedTasks[0].type === 'JudgeAssignTask' || props.selectedTasks[0].type === 'AttorneyTask') ? + [] : instructionType) || []), assignedToSecondary: null, modalDisableButton: true }; @@ -107,10 +109,10 @@ export class AssignToAttorneyWidget extends React.PureComponent { setModalOnChangeValue = (stateValue, value) => { this.setState({ [stateValue]: value }, function () { - if (this.state.assignedTo === OTHER && (this.state.assignedToSecondary === null || this.state.instructions.length < 0)){ + if (this.state.assignedTo === OTHER && + (this.state.assignedToSecondary === null || this.state.instructions.length < 0)) { this.setState({ modalDisableButton: true }); - } - else if (this.state.assignedTo !== null && this.state.instructions.length > 0) { + } else if (this.state.assignedTo !== null && this.state.instructions.length > 0) { this.setState({ modalDisableButton: false }); } else { this.setState({ modalDisableButton: true }); @@ -314,7 +316,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { loading={savePending} loadingText={COPY.ASSIGN_WIDGET_LOADING} styling={css({ margin: '1.5rem 0' })} /> } - ; + ; if (selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal') { return isModal ? filter(tasks, (task) => task.type === 'JudgeLegacyDecisionReviewTask' || task.type === 'JudgeLegacyAssignTask') + (tasks) => filter(tasks, (task) => + task.type === 'JudgeLegacyDecisionReviewTask' || task.type === 'JudgeLegacyAssignTask') ); const workTasksByAssigneeCssIdSelector = createSelector( [tasksByAssigneeCssIdSelector], (tasks) => - workTasksSelector(tasks). + workTasksSelector(tasks).sort((task1, task2) => task1.isLegacy - task2.isLegacy). filter((task, i, arr) => arr.map((id) => (id.externalAppealId)). indexOf(task.externalAppealId) === i), ); From 144cb77041bec4e712e714ef99dc9c1d266e19c7 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Thu, 14 Sep 2023 10:50:43 -0500 Subject: [PATCH 125/203] updated Success Banner (#19463) --- client/COPY.json | 1 + client/app/queue/components/AssignToAttorneyWidget.jsx | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/COPY.json b/client/COPY.json index c8fe8942e93..acc28b8f1d5 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -457,6 +457,7 @@ "ASSIGN_WIDGET_NO_TASK_TITLE": "No tasks selected", "ASSIGN_WIDGET_NO_TASK_DETAIL": "Please select a task.", "ASSIGN_WIDGET_SUCCESS": "%(verb)s %(numCases)s %(casePlural)s to %(assignee)s", + "ASSIGN_LEGACY_WIDGET_SUCCESS": "%(verb)s %(assigned)s's %(casePlural)s to %(assignee)s", "ASSIGN_WIDGET_ASSIGNMENT_ERROR_TITLE": "Error assigning tasks", "ASSIGN_WIDGET_ASSIGNMENT_ERROR_DETAIL": "Timeout Error while assigning tasks; please reload the page before proceeding.", "ASSIGN_WIDGET_ASSIGNMENT_ERROR_DETAIL_MODAL_LINK": "Please assign tasks to an attorney from your assign page.", diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 28eabb6cd5d..759c2aca999 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -186,10 +186,10 @@ export class AssignToAttorneyWidget extends React.PureComponent { this.props.resetAssignees(); return this.props.showSuccessMessage({ - title: sprintf(COPY.ASSIGN_WIDGET_SUCCESS, { - verb: isReassign ? 'Reassigned' : 'Assigned', - numCases: selectedTasks.length, - casePlural: pluralize('tasks', selectedTasks.length), + title: sprintf(COPY.ASSIGN_LEGACY_WIDGET_SUCCESS, { + verb: isReassign ? 'You have successfully reassigned' : 'You have successfully assigned', + assigned: selectedTasks[0].appeal.assignedJudge.full_name, + casePlural: pluralize('cases', selectedTasks.length), // eslint-disable-next-line camelcase assignee: assignee.full_name }) From 642e6e64151ad82dafdb1ec92ffd1ce9e62491dc Mon Sep 17 00:00:00 2001 From: cacevesva <109166981+cacevesva@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:00:57 -0700 Subject: [PATCH 126/203] Fix with safe navigation (#19470) --- app/models/judge_case_review.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/judge_case_review.rb b/app/models/judge_case_review.rb index 290f9be5e36..96a8a9c2d79 100644 --- a/app/models/judge_case_review.rb +++ b/app/models/judge_case_review.rb @@ -89,7 +89,8 @@ def complete(params) ActiveRecord::Base.multi_transaction do record = create(params) if record.valid? - if record.legacy? && record.task.type == "JudgeDecisionReviewTask" + + if record.legacy? && record.task&.type == "JudgeDecisionReviewTask" record.update_in_vacols_and_caseflow! else record.legacy? ? record.update_in_vacols! : record.update_in_caseflow! From e9c6da9db6057bb17ce27594c0234d19470fd6d4 Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Fri, 15 Sep 2023 11:53:20 -0400 Subject: [PATCH 127/203] remove date, no necesary any more (#19476) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/controllers/legacy_tasks_controller_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/controllers/legacy_tasks_controller_spec.rb b/spec/controllers/legacy_tasks_controller_spec.rb index ec22fb4ba8a..487eb6a401c 100644 --- a/spec/controllers/legacy_tasks_controller_spec.rb +++ b/spec/controllers/legacy_tasks_controller_spec.rb @@ -303,8 +303,7 @@ allow(QueueRepository).to receive(:reassign_case_to_attorney!).with( judge: user, attorney: attorney, - vacols_id: @appeal.vacols_id, - created_in_vacols_date: "2018-04-18".to_date + vacols_id: @appeal.vacols_id ).and_return(true) expect(@appeal.overtime?).to be true @@ -334,8 +333,7 @@ allow(QueueRepository).to receive(:reassign_case_to_attorney!).with( judge: user, attorney: attorney, - vacols_id: @appeal.vacols_id, - created_in_vacols_date: "2018-04-18".to_date + vacols_id: @appeal.vacols_id ).and_return(true) today = Time.utc(2018, 4, 18) yesterday = Time.utc(2018, 4, 17) From d86d73bcbb54bc676163dc75d499b1cd12978b91 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Fri, 15 Sep 2023 11:54:22 -0500 Subject: [PATCH 128/203] [APPEALS-30731] Updated Appealant's name (#19485) --- client/app/queue/components/AssignToAttorneyWidget.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 759c2aca999..4beeaa956b4 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -188,7 +188,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { return this.props.showSuccessMessage({ title: sprintf(COPY.ASSIGN_LEGACY_WIDGET_SUCCESS, { verb: isReassign ? 'You have successfully reassigned' : 'You have successfully assigned', - assigned: selectedTasks[0].appeal.assignedJudge.full_name, + assigned: selectedTasks[0].appeal.appellantFullName, casePlural: pluralize('cases', selectedTasks.length), // eslint-disable-next-line camelcase assignee: assignee.full_name From bcebf52ad307b35922d3da837bd6514300cb8208 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Fri, 15 Sep 2023 12:55:32 -0400 Subject: [PATCH 129/203] fixing rspecs (#19481) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/judge_case_assignment_to_attorney.rb | 2 +- spec/models/judge_case_assignment_to_attorney_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/judge_case_assignment_to_attorney.rb b/app/models/judge_case_assignment_to_attorney.rb index 48f41d3184d..d638505f7b1 100644 --- a/app/models/judge_case_assignment_to_attorney.rb +++ b/app/models/judge_case_assignment_to_attorney.rb @@ -6,7 +6,7 @@ class JudgeCaseAssignmentToAttorney attr_accessor :appeal_id, :assigned_to, :task_id, :assigned_by, :judge validates :assigned_by, :assigned_to, presence: true - # validates :task_id, format: { with: /\A[0-9A-Z]+-[0-9]{4}-[0-9]{2}-[0-9]{2}\Z/i }, allow_blank: true + validates :task_id, format: { with: /\A[0-9A-Z]+-[0-9]{4}-[0-9]{2}-[0-9]{2}\Z/i }, allow_blank: true validate :assigned_by_role_is_valid def assign_to_attorney! diff --git a/spec/models/judge_case_assignment_to_attorney_spec.rb b/spec/models/judge_case_assignment_to_attorney_spec.rb index 13e5c46df95..d78cafb797a 100644 --- a/spec/models/judge_case_assignment_to_attorney_spec.rb +++ b/spec/models/judge_case_assignment_to_attorney_spec.rb @@ -73,7 +73,8 @@ JudgeCaseAssignmentToAttorney.update( task_id: task_id, assigned_by: assigned_by, - assigned_to: assigned_to + assigned_to: assigned_to, + appeal_id: appeal.id ) end context "when all required values are present" do From 3465d2f429b2623a0866a43d375fa515c2550a8f Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 18 Sep 2023 08:43:36 -0400 Subject: [PATCH 130/203] colocated tasks in on hold tab fixed (#19493) --- app/models/queue_tabs/on_hold_tasks_tab.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/queue_tabs/on_hold_tasks_tab.rb b/app/models/queue_tabs/on_hold_tasks_tab.rb index f2490369105..1643d94390f 100644 --- a/app/models/queue_tabs/on_hold_tasks_tab.rb +++ b/app/models/queue_tabs/on_hold_tasks_tab.rb @@ -39,7 +39,9 @@ def ama_task_ids def legacy_colocated_task_ids_assigned_by_assignee colocated_tasks = ColocatedTask.open.order(:created_at) .where(assigned_by: assignee, assigned_to_type: Organization.name, appeal_type: LegacyAppeal.name) - + .select do |task| + task&.parent&.type&.is_a?(ColocatedTask) + end colocated_tasks.group_by(&:appeal_id).map { |_appeal_id, tasks| tasks.first.id } end From 8c2e5dada42f4186d431c7d37a98c404825e7e94 Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:39:42 -0500 Subject: [PATCH 131/203] spec fix in change_hearing_disposition_spec (#19490) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/feature/hearings/change_hearing_disposition_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/feature/hearings/change_hearing_disposition_spec.rb b/spec/feature/hearings/change_hearing_disposition_spec.rb index 667d4883ceb..3a2376c3c46 100644 --- a/spec/feature/hearings/change_hearing_disposition_spec.rb +++ b/spec/feature/hearings/change_hearing_disposition_spec.rb @@ -407,8 +407,8 @@ expect(choices).to_not include(*mgmt_full_names) fill_in COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: assign_instructions_text - click_on "Submit" - expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % other_admin_full_name + click_on "Assign" + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, other_admin_full_name)) end step "the other user logs in and sees the task in their queue" do @@ -436,8 +436,8 @@ click_dropdown(prompt: "Select an action", text: "Assign to person") fill_in COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: assign_instructions_text - click_on "Submit" - expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % current_full_name + click_on "Assign" + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, current_full_name)) end step "the task in my personal queue" do From a74cc4aa4e7b920210aecce7a3fffe8ef2a66190 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:01:55 -0400 Subject: [PATCH 132/203] Vinner57/appeals 30821 (#19499) * corecting the rspec test cases * corecting the rspec test cases * corecting the rspec test cases * corecting the rspec test cases * fixing pre_docket_spec rspecs * reverting cavc_task_queue_spec changes --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/feature/queue/pre_docket_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/feature/queue/pre_docket_spec.rb b/spec/feature/queue/pre_docket_spec.rb index 178e4ad86f3..cb8cd15d369 100644 --- a/spec/feature/queue/pre_docket_spec.rb +++ b/spec/feature/queue/pre_docket_spec.rb @@ -295,7 +295,7 @@ instructions_textarea = find("textarea", id: "taskInstructions") instructions_textarea.send_keys("Please review this appeal, CAREGIVER.") - find("button", text: COPY::MODAL_RETURN_BUTTON).click + find("button", text: COPY::MODAL_ASSIGN_BUTTON).click expect(page).to have_current_path("/organizations/#{bva_intake.url}?tab=pending&#{default_bva_query_params}") @@ -408,7 +408,7 @@ find("button", class: "usa-button", text: COPY::MODAL_ASSIGN_BUTTON).click expect(page).to have_current_path("/organizations/#{camo.url}?tab=camo_assigned&#{default_query_params}") - expect(page).to have_content("Task assigned to #{program_office.name}") + expect(page).to have_content("You have successfully reassigned this task to #{program_office.name}") expect(AssessDocumentationTask.last).to have_attributes( type: "AssessDocumentationTask", @@ -474,7 +474,7 @@ expect(page).to have_current_path( "/organizations/#{program_office.url}?tab=po_assigned&#{default_query_params}" ) - expect(page).to have_content("Task assigned to #{dropdown_visn_text}") + expect(page).to have_content("You have successfully reassigned this task to #{dropdown_visn_text}") expect(page).to have_content(format(COPY::ORGANIZATIONAL_QUEUE_ON_HOLD_TAB_TITLE, 1)) end @@ -718,7 +718,7 @@ instructions_textarea = find("textarea", id: "taskInstructions") instructions_textarea.send_keys("Please review this appeal, CAMO.") - find("button", text: COPY::MODAL_RETURN_BUTTON).click + find("button", text: COPY::MODAL_ASSIGN_BUTTON).click expect(page).to have_current_path("/organizations/#{bva_intake.url}?tab=pending&#{default_bva_query_params}") @@ -914,7 +914,7 @@ def bva_intake_dockets_appeal expect(page).to have_current_path("/organizations/#{emo.url}"\ "?tab=education_emo_unassigned&#{default_query_params}") - expect(page).to have_content("Task assigned to #{education_rpo.name}") + expect(page).to have_content("You have successfully reassigned this task to #{education_rpo.name}") expect(EducationDocumentSearchTask.last).to have_attributes( type: "EducationDocumentSearchTask", @@ -1085,7 +1085,7 @@ def bva_intake_dockets_appeal instructions_textarea = find("textarea", id: "taskInstructions") instructions_textarea.send_keys("The intake details have been corrected. Please review this appeal.") - find("button", class: "usa-button", text: COPY::MODAL_RETURN_BUTTON).click + find("button", class: "usa-button", text: COPY::MODAL_ASSIGN_BUTTON).click end step "Switch to an EMO user and make sure the active @@ -1248,7 +1248,7 @@ def bva_intake_dockets_appeal instructions_textarea = find("textarea", id: "taskInstructions") instructions_textarea.send_keys("Please review this appeal, EMO.") - find("button", text: COPY::MODAL_RETURN_BUTTON).click + find("button", text: COPY::MODAL_ASSIGN_BUTTON).click expect(page).to have_current_path("/organizations/#{bva_intake.url}?tab=pending&#{default_bva_query_params}") From ecd1d1166cdb20a905d51762bc4c1c4017467160 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:13:29 -0400 Subject: [PATCH 133/203] removes taskid validation for judge assign to atty (#19530) Co-authored-by: MuhGrayVA <98366428+MuhGrayVA@users.noreply.github.com> --- app/models/judge_case_assignment_to_attorney.rb | 1 - .../models/judge_case_assignment_to_attorney_spec.rb | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/app/models/judge_case_assignment_to_attorney.rb b/app/models/judge_case_assignment_to_attorney.rb index d638505f7b1..cc42bbe1ddc 100644 --- a/app/models/judge_case_assignment_to_attorney.rb +++ b/app/models/judge_case_assignment_to_attorney.rb @@ -6,7 +6,6 @@ class JudgeCaseAssignmentToAttorney attr_accessor :appeal_id, :assigned_to, :task_id, :assigned_by, :judge validates :assigned_by, :assigned_to, presence: true - validates :task_id, format: { with: /\A[0-9A-Z]+-[0-9]{4}-[0-9]{2}-[0-9]{2}\Z/i }, allow_blank: true validate :assigned_by_role_is_valid def assign_to_attorney! diff --git a/spec/models/judge_case_assignment_to_attorney_spec.rb b/spec/models/judge_case_assignment_to_attorney_spec.rb index d78cafb797a..3cfe23cfcce 100644 --- a/spec/models/judge_case_assignment_to_attorney_spec.rb +++ b/spec/models/judge_case_assignment_to_attorney_spec.rb @@ -88,18 +88,6 @@ end end - context "when task id is not valid" do - let(:task_id) { 1234 } - let(:assigned_by) { judge } - let(:assigned_to) { attorney } - - it "does not reassign case to attorney" do - expect(QueueRepository).to_not receive(:reassign_case_to_attorney!) - expect(subject.valid?).to eq false - expect(subject.errors.full_messages).to eq ["Task is invalid"] - end - end - context "when assigned by is missing" do let(:task_id) { "3615398-2018-04-18" } let(:assigned_by) { nil } From 65ae066b3ece9af515a8020534958d99a420fb4f Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Wed, 20 Sep 2023 09:42:16 -0500 Subject: [PATCH 134/203] [APPEALS-29319] tasks controller judge assignment and quality review flow specs updated (#19534) --- app/controllers/tasks_controller.rb | 2 +- spec/controllers/tasks_controller_spec.rb | 8 ++++---- spec/feature/queue/judge_assignment_spec.rb | 10 +++++----- spec/feature/queue/quality_review_flow_spec.rb | 7 ++++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 75b69202f74..4c7a0d90dd8 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -93,7 +93,7 @@ def create tasks << valid_task_classes[task_type.to_sym].create_many_from_params(param_group, current_user) end # This should be the JudgeDecisionReviewTask - parent_task = Task.find_by(id: params[:tasks].first[:parent_id]) if params[:tasks].first[:type] == "AttorneyRewriteTask" + parent_task = Task.find_by(id: params[:tasks]&.first[:parent_id]) if params[:tasks]&.first[:type] == "AttorneyRewriteTask" if parent_task&.appeal&.is_a?(LegacyAppeal) QueueRepository.reassign_decass_to_attorney!( judge: parent_task.assigned_to, diff --git a/spec/controllers/tasks_controller_spec.rb b/spec/controllers/tasks_controller_spec.rb index b41cf3fb8bc..ec716717b78 100644 --- a/spec/controllers/tasks_controller_spec.rb +++ b/spec/controllers/tasks_controller_spec.rb @@ -493,11 +493,11 @@ context "when one admin action with task type field" do let(:params) do - { + [{ "external_id": appeal.vacols_id, "type": AddressVerificationColocatedTask.name, "instructions": "do this" - } + }] end it "should be successful" do @@ -515,11 +515,11 @@ context "when one admin action with task label field" do let(:params) do - { + [{ "external_id": appeal.vacols_id, "type": AddressVerificationColocatedTask.name, "instructions": "do this" - } + }] end it "should be successful" do diff --git a/spec/feature/queue/judge_assignment_spec.rb b/spec/feature/queue/judge_assignment_spec.rb index 7f004059d70..36c90229a11 100644 --- a/spec/feature/queue/judge_assignment_spec.rb +++ b/spec/feature/queue/judge_assignment_spec.rb @@ -287,7 +287,7 @@ click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.label) click_dropdown(prompt: "Select a user", text: attorney_one.full_name) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Assign") + click_on("Submit") expect(page).to have_content("Assigned 1 task to #{attorney_one.full_name}") end @@ -330,14 +330,14 @@ it "should allow us to assign an ama appeal to an acting judge from the 'Assign to attorney' action'" do visit("/queue/appeals/#{appeal_one.external_id}") - + refresh click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.label) click_dropdown(prompt: "Select a user", text: "Other") safe_click ".dropdown-Other" click_dropdown({ text: judge_two.full_name }, page.find(".dropdown-Other")) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Assign") + click_on("Submit") expect(page).to have_content("Assigned 1 task to #{judge_two.full_name}") end end @@ -349,12 +349,12 @@ it "should allow us to assign an ama appeal to an acting judge from the 'Assign to attorney' action'" do visit("/queue/appeals/#{appeal_one.external_id}") - + refresh click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.label) click_dropdown(prompt: "Select a user", text: judge_one.full_name) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Assign") + click_on("Submit") expect(page).to have_content("Assigned 1 task to #{judge_one.full_name}") end end diff --git a/spec/feature/queue/quality_review_flow_spec.rb b/spec/feature/queue/quality_review_flow_spec.rb index 3e10d2a5497..e79ebd9b316 100644 --- a/spec/feature/queue/quality_review_flow_spec.rb +++ b/spec/feature/queue/quality_review_flow_spec.rb @@ -83,7 +83,7 @@ find("div", class: "cf-select__option", text: Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.to_h[:label]).click fill_in "taskInstructions", with: "Review the quality" - click_on "Assign" + click_on "Submit" expect(page).to have_content("Task assigned to #{qr_user_name}") @@ -101,7 +101,7 @@ expect(dropdown_selected_value(find(".cf-modal-body"))).to eq judge_user.full_name fill_in "taskInstructions", with: qr_instructions - click_on "Assign" + click_on "Submit" expect(page).to have_content("On hold (1)") end @@ -251,7 +251,8 @@ click_dropdown(text: Constants.TASK_ACTIONS.PLACE_TIMED_HOLD.label) click_dropdown(prompt: COPY::COLOCATED_ACTION_PLACE_HOLD_LENGTH_SELECTOR_LABEL, text: hold_length) fill_in("instructions", with: "placing task on hold") - click_on(COPY::MODAL_PUT_TASK_ON_HOLD_BUTTON) + expect(page).to have_content(COPY::MODAL_PUT_TASK_ON_HOLD_BUTTON) + click_on "Submit" expect(page).to have_content(format(COPY::COLOCATED_ACTION_PLACE_HOLD_CONFIRMATION, veteran_name, hold_length)) end From b32e53c7ef65ccecaa8c537682f029da1db51c5f Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:02:37 -0400 Subject: [PATCH 135/203] banner fix in assign page (#19523) * banner fix * added conditional banner based on amount of tasks --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/components/AssignToAttorneyWidget.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 4beeaa956b4..9a8abd67f7f 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -186,9 +186,9 @@ export class AssignToAttorneyWidget extends React.PureComponent { this.props.resetAssignees(); return this.props.showSuccessMessage({ - title: sprintf(COPY.ASSIGN_LEGACY_WIDGET_SUCCESS, { + title: sprintf(COPY.ASSIGN_WIDGET_SUCCESS, { verb: isReassign ? 'You have successfully reassigned' : 'You have successfully assigned', - assigned: selectedTasks[0].appeal.appellantFullName, + numCases: selectedTasks.length > 1 ? selectedTasks.length : `${selectedTasks[0].appeal.appellantFullName}'s`, casePlural: pluralize('cases', selectedTasks.length), // eslint-disable-next-line camelcase assignee: assignee.full_name From b92894ff144edc293218d1817c5982b46a808ee5 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:03:17 -0400 Subject: [PATCH 136/203] old judge now appears for scenario 6 (#19527) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/components/TaskRows.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index eafa25e9013..b3fa208e77c 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -308,7 +308,7 @@ class TaskRows extends React.PureComponent { // to ensure a consistent margin between instruction content and the "Hide" button const divStyles = { marginTop: '2rem' }; - if ((task.previous.length >= 1) && (task.type === 'JudgeAssignTask')) { + if ((task.previous.length >= 1) && (task.type === 'JudgeAssignTask' || task.type === 'JudgeDecisionReviewTask')) { return ( {task.previous.toReversed().map((prev) => ( From e3fa230e0e404bdc8585b7e16ef0469fa8889589 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 20 Sep 2023 14:14:25 -0400 Subject: [PATCH 137/203] fix to judge reassign on legacy review tasks (#19539) --- client/app/queue/AssignToView.jsx | 2 +- client/app/queue/components/AssignToAttorneyWidget.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index af8cb7049d9..e6f51362d97 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -158,7 +158,7 @@ class AssignToView extends React.Component { } if (isReassignAction) { - return this.reassignTask(task.type === 'JudgeLegacyAssignTask' && taskType === 'JudgeLegacyAssignTask'); + return this.reassignTask(task.type === 'JudgeLegacyAssignTask' || task.type === 'JudgeLegacyDecisionReviewTask'); } return this.props. diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 9a8abd67f7f..e26908a2e53 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -188,7 +188,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { return this.props.showSuccessMessage({ title: sprintf(COPY.ASSIGN_WIDGET_SUCCESS, { verb: isReassign ? 'You have successfully reassigned' : 'You have successfully assigned', - numCases: selectedTasks.length > 1 ? selectedTasks.length : `${selectedTasks[0].appeal.appellantFullName}'s`, + numCases: selectedTasks.length === 1 && selectedTasks[0].appeal ? `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, casePlural: pluralize('cases', selectedTasks.length), // eslint-disable-next-line camelcase assignee: assignee.full_name From 5d2b29fe8580312480c69fb40203c48f9f709df8 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Wed, 20 Sep 2023 15:42:37 -0400 Subject: [PATCH 138/203] spec fix for task_queue_spec (#19525) * testing rspec changes * moving the disable submit button to PulacCerullo condition * updating sucess banner for rspec --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/AssignToView.jsx | 3 +++ spec/feature/queue/task_queue_spec.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index e6f51362d97..08f81a526cf 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -382,6 +382,7 @@ class AssignToView extends React.Component { if (isPulacCerullo) { modalProps.button = 'Notify'; + modalProps.submitDisabled = false; } if ([ @@ -394,6 +395,8 @@ class AssignToView extends React.Component { modalProps.submitButtonClassNames = ['usa-button']; } + + return (

    {actionData.modal_body ? actionData.modal_body : ''}

    diff --git a/spec/feature/queue/task_queue_spec.rb b/spec/feature/queue/task_queue_spec.rb index 54dd161adc2..e6d720fbc99 100644 --- a/spec/feature/queue/task_queue_spec.rb +++ b/spec/feature/queue/task_queue_spec.rb @@ -1010,7 +1010,7 @@ def validate_pulac_cerullo_tasks_created(task_class, label) click_on COPY::MODAL_ASSIGN_BUTTON - expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE % attorney_user.full_name) + expect(page).to have_content(COPY::REASSIGN_TASK_SUCCESS_MESSAGE % attorney_user.full_name) expect(judge_task.reload.status).to eq(Constants.TASK_STATUSES.on_hold) expect(judge_task.children.first).to be_a(AttorneyDispatchReturnTask) From aeee71cc895c22a6e7d5daba631b296eb1b1439f Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Wed, 20 Sep 2023 16:03:47 -0400 Subject: [PATCH 139/203] Fix error on on_hold_tasks_tab_spec.rb (#19536) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/queue_tabs/on_hold_tasks_tab.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/queue_tabs/on_hold_tasks_tab.rb b/app/models/queue_tabs/on_hold_tasks_tab.rb index 1643d94390f..4442d2c61c2 100644 --- a/app/models/queue_tabs/on_hold_tasks_tab.rb +++ b/app/models/queue_tabs/on_hold_tasks_tab.rb @@ -39,8 +39,8 @@ def ama_task_ids def legacy_colocated_task_ids_assigned_by_assignee colocated_tasks = ColocatedTask.open.order(:created_at) .where(assigned_by: assignee, assigned_to_type: Organization.name, appeal_type: LegacyAppeal.name) - .select do |task| - task&.parent&.type&.is_a?(ColocatedTask) + .reject do |task| + ['JudgeAssignTask','JudgeDecisionReviewTask', 'AttorneyTask','AttorneyRewriteTask'].include? task&.parent&.type end colocated_tasks.group_by(&:appeal_id).map { |_appeal_id, tasks| tasks.first.id } end From 5e9fe2ae2a87b727614a7888374a249e17723874 Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Wed, 20 Sep 2023 16:37:42 -0500 Subject: [PATCH 140/203] spec fix in special_case_movement_task (#19537) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../feature/queue/special_case_movement_task_spec.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/feature/queue/special_case_movement_task_spec.rb b/spec/feature/queue/special_case_movement_task_spec.rb index f4443e5b05b..c24ea22341a 100644 --- a/spec/feature/queue/special_case_movement_task_spec.rb +++ b/spec/feature/queue/special_case_movement_task_spec.rb @@ -22,7 +22,6 @@ context "With the Appeal in the right state" do it "successfully assigns the task to judge" do visit("queue/appeals/#{appeal.external_id}") - prompt = COPY::TASK_ACTION_DROPDOWN_BOX_LABEL text = Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT.label click_dropdown(prompt: prompt, text: text) @@ -31,9 +30,10 @@ click_dropdown(prompt: COPY::SPECIAL_CASE_MOVEMENT_MODAL_SELECTOR_PLACEHOLDER, text: judge_user.full_name) fill_in("taskInstructions", with: "instructions") - click_button("Submit") + click_button("Assign") - expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE % judge_user.full_name) + # expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE % judge_user.full_name) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, judge_user.full_name)) # Auth as judge user User.authenticate!(user: judge_user) visit "/queue" @@ -92,15 +92,11 @@ expect(page).to have_no_content(AodMotionMailTask.name) # Validate before moving on - click_on "Continue" - expect(page).to have_content(COPY::FORM_ERROR_FIELD_REQUIRED) find("label", text: "Death dismissal").click fill_in("cancellationInstructions", with: "Instructions for cancellation") click_on "Continue" # Validate before moving on - click_on "Cancel Task and Reassign" - expect(page).to have_content(COPY::FORM_ERROR_FIELD_REQUIRED) click_dropdown(prompt: "Select...", text: judge_user.full_name) fill_in("judgeInstructions", with: "Instructions for the judge") click_on "Cancel Task and Reassign" @@ -112,7 +108,7 @@ expect(page).to have_content("#{ScheduleHearingTask.name} cancelled") expect(page).to have_content("CANCELLED BY\n#{scm_user.css_id}") page.find_all(".taskInformationTimelineContainerStyling button", text: "View task instructions").first.click - expect(page).to have_content("TASK INSTRUCTIONS\nDeath dismissal: Instructions for cancellation") + expect(page).to have_content("TASK INSTRUCTIONS\nNew Judge:\nBoard of Veterans' Appeals\nDetails:\nInstructions for the judge") expect(page).to have_content("#{BlockedSpecialCaseMovementTask.name} completed") expect(page).to have_content("#{DistributionTask.name} completed") From 764f3f37acf5a5a40f972e9ec3ae5510695ec5b5 Mon Sep 17 00:00:00 2001 From: MuhGrayVA <98366428+MuhGrayVA@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:29:32 -0400 Subject: [PATCH 141/203] Legacy Task Deprecation (#19549) Utilizing Incumbent changes to deprecate Legacy Tasks --- app/models/vacols/case_docket.rb | 2 +- app/workflows/das_deprecation/assign_task_to_attorney.rb | 2 +- scripts/enable_features_dev.rb | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/vacols/case_docket.rb b/app/models/vacols/case_docket.rb index 0887c090a00..0ea10d7d9af 100644 --- a/app/models/vacols/case_docket.rb +++ b/app/models/vacols/case_docket.rb @@ -458,7 +458,7 @@ def self.distribute_appeals(query, judge, dry_run) return appeals if appeals.empty? vacols_ids = appeals.map { |appeal| appeal["bfkey"] } - location = if FeatureToggle.enabled?(:legacy_das_deprecation, user: RequestStore.store[:current_user]) + location = if !FeatureToggle.enabled?(:legacy_das_deprecation, user: RequestStore.store[:current_user]) LegacyAppeal::LOCATION_CODES[:caseflow] else judge.vacols_uniq_id diff --git a/app/workflows/das_deprecation/assign_task_to_attorney.rb b/app/workflows/das_deprecation/assign_task_to_attorney.rb index 05fb44840a8..dbf69f57fcf 100644 --- a/app/workflows/das_deprecation/assign_task_to_attorney.rb +++ b/app/workflows/das_deprecation/assign_task_to_attorney.rb @@ -21,7 +21,7 @@ def reassign_attorney_task(vacols_id, assigned_by, assigned_to) end def should_perform_workflow?(appeal_id) - return false if !FeatureToggle.enabled?(:legacy_das_deprecation, user: RequestStore.store[:current_user]) + return false if FeatureToggle.enabled?(:legacy_das_deprecation, user: RequestStore.store[:current_user]) appeal = LegacyAppeal.find(appeal_id) !JudgeAssignTask.find_by(appeal: appeal).nil? diff --git a/scripts/enable_features_dev.rb b/scripts/enable_features_dev.rb index f15d0ec5e18..594d76f70f2 100644 --- a/scripts/enable_features_dev.rb +++ b/scripts/enable_features_dev.rb @@ -55,7 +55,6 @@ def call # - the work around the feature has been paused # - the flag is only being used to disable functionality disabled_flags = %w[ - legacy_das_deprecation cavc_dashboard_workflow poa_auto_refresh interface_version_2 From 7fac3ba33de33ca255c87387e4344cff11c952a5 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Thu, 21 Sep 2023 14:53:45 -0400 Subject: [PATCH 142/203] fixes multiple ui errors with task instructions (#19547) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/components/TaskRows.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index b3fa208e77c..50de3272416 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -355,7 +355,7 @@ class TaskRows extends React.PureComponent { return ( - {task.instructions[1] && ( + {task.instructions[1] && task.type === 'JudgeAssignTask' && (
    )} - {task.assigneeName && !(task.type === ('AttorneyTask' || 'AttorneyRewriteTask')) && + {task.assigneeName && task.type !== 'AttorneyTask' && task.type !== 'AttorneyRewriteTask' && (
    - {COPY.LEGACY_APPEALS_VLJ_DETAILS_INSTRUCTIONS} + {task.type !== 'JudgeDecisionReviewTask' && COPY.LEGACY_APPEALS_VLJ_DETAILS_INSTRUCTIONS} {formatBreaks(task.instructions[0])}
    From 27b6b9e9d05c2c5b582d7c193b481a59b00b8c4d Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Thu, 21 Sep 2023 15:57:32 -0400 Subject: [PATCH 143/203] spec fix for bva_dispatch_return_flow_spec (#19541) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/feature/queue/bva_dispatch_return_flow_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/feature/queue/bva_dispatch_return_flow_spec.rb b/spec/feature/queue/bva_dispatch_return_flow_spec.rb index 646d5db4a40..170d9a0e1ec 100644 --- a/spec/feature/queue/bva_dispatch_return_flow_spec.rb +++ b/spec/feature/queue/bva_dispatch_return_flow_spec.rb @@ -52,8 +52,8 @@ click_on veteran_full_name click_dropdown(prompt: "Select an action", text: "Return to judge") fill_in("taskInstructions", with: "Returned from BVA Dispatch to correct error") - click_on "Submit" - expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE % judge_user.full_name) + click_on "Assign" + expect(page).to have_content(COPY::REASSIGN_TASK_SUCCESS_MESSAGE % judge_user.full_name) end step "Judge sends the case to the Attorney to fix the decision" do User.authenticate!(user: judge_user) @@ -61,8 +61,8 @@ click_on veteran_full_name click_dropdown(prompt: "Select an action", text: "Return to attorney") fill_in("taskInstructions", with: "Returned from BVA Dispatch to correct error") - click_on "Submit" - expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE % attorney_user.full_name) + click_on "Assign" + expect(page).to have_content(COPY::REASSIGN_TASK_SUCCESS_MESSAGE % attorney_user.full_name) end step "Attorney returns the case to the judge" do attorney_checkout From e0c1142a116ea24447a32b58d32285b1e13bb0dc Mon Sep 17 00:00:00 2001 From: Shruthi Sibi <109103820+shruthisibi@users.noreply.github.com> Date: Thu, 21 Sep 2023 15:00:34 -0500 Subject: [PATCH 144/203] Rspec fix- Judge Quality Review Task (#19538) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/models/tasks/judge_quality_review_task_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/tasks/judge_quality_review_task_spec.rb b/spec/models/tasks/judge_quality_review_task_spec.rb index 1374fe2f914..9ed7101816b 100644 --- a/spec/models/tasks/judge_quality_review_task_spec.rb +++ b/spec/models/tasks/judge_quality_review_task_spec.rb @@ -20,7 +20,7 @@ [ Constants.TASK_ACTIONS.ADD_ADMIN_ACTION.to_h, Constants.TASK_ACTIONS.TOGGLE_TIMED_HOLD.to_h, - Constants.TASK_ACTIONS.REASSIGN_TO_JUDGE.to_h, + Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.to_h, Constants.TASK_ACTIONS.JUDGE_QR_RETURN_TO_ATTORNEY.to_h, Constants.TASK_ACTIONS.MARK_COMPLETE.to_h, Constants.TASK_ACTIONS.CANCEL_TASK.to_h From a1848b09681d6022fc957c501d1f30f7f942ed15 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:13:44 -0400 Subject: [PATCH 145/203] staff user not set when generating Scenarios 1-2 (#19551) --- lib/tasks/seed_legacy_appeal_tasks.rake | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index 9112587f520..7f74b8100d3 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -11,13 +11,16 @@ namespace :db do class << self def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, docket_number, task_type) # Changes location of vacols based on if you want a hearing task or only a legacy task in location 81 - bfcurloc = if task_type == "HEARINGTASK" || task_type == "SCENARIO1EDGE" - 57 - elsif task_type == "BRIEFF_CURLOC_81_TASK" - 81 - else - VACOLS::Staff.find_by(sdomainid: user.css_id).slogid - end + if task_type == "HEARINGTASK" || task_type == "SCENARIO1EDGE" + bfcurloc = 57 + staff = false + elsif task_type == "BRIEFF_CURLOC_81_TASK" + bfcurloc = 81 + staff = false + else + bfcurloc = VACOLS::Staff.find_by(sdomainid: user.css_id).slogid + staff = VACOLS::Staff.find_by(sdomainid: user.css_id) # user for local/demo || UAT + end veteran = Veteran.find_by_file_number(file_number) fail ActiveRecord::RecordNotFound unless veteran @@ -33,7 +36,6 @@ namespace :db do cases = Array.new(num_appeals_to_create).each_with_index.map do key = VACOLS::Folder.maximum(:ticknum).next - staff = VACOLS::Staff.find_by(sdomainid: user.css_id) # user for local/demo || UAT Generators::Vacols::Case.create( decass_creation: decass_creation, corres_exists: true, From 8236dc2c7e29d812809f3a27928ae6700b279bca Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Thu, 21 Sep 2023 19:18:38 -0600 Subject: [PATCH 146/203] changing PR comment fix --- client/app/intake/components/IssueList.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/intake/components/IssueList.jsx b/client/app/intake/components/IssueList.jsx index e2351b51e47..7562f0f8f04 100644 --- a/client/app/intake/components/IssueList.jsx +++ b/client/app/intake/components/IssueList.jsx @@ -42,7 +42,7 @@ export default class IssuesList extends React.Component { options.push({ displayText: 'Correct issue', value: 'correct' }); } else if (!issue.examRequested && !issue.withdrawalDate && !issue.withdrawalPending && !isDtaError) { - if (userCanWithdrawIssues && typeof issue.id !== 'undefined') { + if (userCanWithdrawIssues && issue.id) { options.push( { displayText: 'Withdraw issue', value: 'withdraw' } From 34b3c67d30bcd9ded0efa84a31c476649f23a109 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Fri, 22 Sep 2023 12:21:18 -0400 Subject: [PATCH 147/203] spec fix quality_review_flow_spec (#19554) * spec fix quality_review_flow_spec * reverting refresh --- .../feature/queue/quality_review_flow_spec.rb | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/feature/queue/quality_review_flow_spec.rb b/spec/feature/queue/quality_review_flow_spec.rb index e79ebd9b316..a0e0ecf6c00 100644 --- a/spec/feature/queue/quality_review_flow_spec.rb +++ b/spec/feature/queue/quality_review_flow_spec.rb @@ -83,9 +83,9 @@ find("div", class: "cf-select__option", text: Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.to_h[:label]).click fill_in "taskInstructions", with: "Review the quality" - click_on "Submit" + click_on "Assign" - expect(page).to have_content("Task assigned to #{qr_user_name}") + expect(page).to have_content("You have successfully reassigned this task to #{qr_user_name}") expect(QualityReviewTask.count).to eq 2 end @@ -101,7 +101,7 @@ expect(dropdown_selected_value(find(".cf-modal-body"))).to eq judge_user.full_name fill_in "taskInstructions", with: qr_instructions - click_on "Submit" + click_on "Assign" expect(page).to have_content("On hold (1)") end @@ -126,9 +126,9 @@ ).click expect(dropdown_selected_value(find(".cf-modal-body"))).to eq attorney_user.full_name - click_on "Submit" + click_on "Assign" - expect(page).to have_content("Task assigned to #{attorney_user.full_name}") + expect(page).to have_content("You have successfully reassigned this task to #{attorney_user.full_name}") end step "attorney completes task and returns the case to the judge" do @@ -242,8 +242,8 @@ click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.label) click_dropdown({ text: user.full_name }, find(".cf-modal-body")) fill_in("instructions", with: "assigning to QR team member") - click_on(COPY::MODAL_SUBMIT_BUTTON) - expect(page).to have_content(format(COPY::ASSIGN_TASK_SUCCESS_MESSAGE, user.full_name)) + click_on(COPY::MODAL_ASSIGN_BUTTON) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE, user.full_name)) end step "place the task on hold" do @@ -252,7 +252,7 @@ click_dropdown(prompt: COPY::COLOCATED_ACTION_PLACE_HOLD_LENGTH_SELECTOR_LABEL, text: hold_length) fill_in("instructions", with: "placing task on hold") expect(page).to have_content(COPY::MODAL_PUT_TASK_ON_HOLD_BUTTON) - click_on "Submit" + click_on "Put task on hold" expect(page).to have_content(format(COPY::COLOCATED_ACTION_PLACE_HOLD_CONFIRMATION, veteran_name, hold_length)) end @@ -266,12 +266,12 @@ visit("/queue/appeals/#{appeal.uuid}") click_dropdown(text: Constants.TASK_ACTIONS.QR_RETURN_TO_JUDGE.label) fill_in("taskInstructions", with: "returning to judge") - click_on(COPY::MODAL_SUBMIT_BUTTON) + click_on(COPY::MODAL_ASSIGN_BUTTON) end step "confirm that the task is on hold but timed hold is cancelled" do qr_person_task = qr_org_task.children.first - expect(page).to have_content(format(COPY::ASSIGN_TASK_SUCCESS_MESSAGE, judge_user.full_name)) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE, judge_user.full_name)) expect(qr_person_task.status).to eq(Constants.TASK_STATUSES.on_hold) expect(qr_person_task.on_timed_hold?).to eq(false) end From b659eca9a6daf41c36bddc3be79c3cf2885a0e0f Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 22 Sep 2023 15:36:23 -0400 Subject: [PATCH 148/203] Calvin/appeals 30829 assignment spec (#19555) * fixed most issues * fixed last two errors --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../components/AssignToAttorneyWidget.jsx | 2 +- spec/feature/queue/judge_assignment_spec.rb | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index e26908a2e53..afab63aa005 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -188,7 +188,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { return this.props.showSuccessMessage({ title: sprintf(COPY.ASSIGN_WIDGET_SUCCESS, { verb: isReassign ? 'You have successfully reassigned' : 'You have successfully assigned', - numCases: selectedTasks.length === 1 && selectedTasks[0].appeal ? `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, + numCases: selectedTasks.length === 1 && selectedTasks[0].appeal?.appelantFullName ? `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, casePlural: pluralize('cases', selectedTasks.length), // eslint-disable-next-line camelcase assignee: assignee.full_name diff --git a/spec/feature/queue/judge_assignment_spec.rb b/spec/feature/queue/judge_assignment_spec.rb index 36c90229a11..52b85c5769d 100644 --- a/spec/feature/queue/judge_assignment_spec.rb +++ b/spec/feature/queue/judge_assignment_spec.rb @@ -73,7 +73,7 @@ click_dropdown(text: attorney_one.full_name) click_on "Assign 2 cases" - expect(page).to have_content("Assigned 2 tasks to #{attorney_one.full_name}") + expect(page).to have_content("You have successfully assigned 2 cases to #{attorney_one.full_name}") end step "navigates to the attorney's case list" do @@ -92,7 +92,7 @@ click_dropdown(text: attorney_two.full_name) click_on "Assign 1 case" - expect(page).to have_content("Reassigned 1 task to #{attorney_two.full_name}") + expect(page).to have_content("You have successfully reassigned 1 case to #{attorney_two.full_name}") end step "navigates to the other attorney's case list" do @@ -256,12 +256,14 @@ click_on("#{appeal.veteran_first_name} #{appeal.veteran_last_name}") click_dropdown(text: Constants.TASK_ACTIONS.REASSIGN_TO_JUDGE.label) - click_dropdown(prompt: "Select a user", text: judge_two.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_two.full_name) + end fill_in("taskInstructions", with: "Test") appeal.reload.tasks.update_all(status: Constants.TASK_STATUSES.cancelled) click_on("Assign") - expect(page).to have_content("Task reassigned to #{judge_two.full_name}") + expect(page).to have_content("You have successfully assigned #{appeal.veteran_first_name} #{appeal.veteran_last_name}’s case to #{judge_two.full_name}") click_on("Switch views") click_on(format(COPY::JUDGE_ASSIGN_DROPDOWN_LINK_LABEL, judge_one.css_id)) @@ -287,9 +289,9 @@ click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.label) click_dropdown(prompt: "Select a user", text: attorney_one.full_name) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Submit") + click_on("Assign") - expect(page).to have_content("Assigned 1 task to #{attorney_one.full_name}") + expect(page).to have_content("You have successfully assigned 1 case to #{attorney_one.full_name}") end end @@ -304,7 +306,9 @@ click_on("#{appeal_one.veteran_first_name} #{appeal_one.veteran_last_name}") click_dropdown(text: Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.label) - click_dropdown(prompt: "Select a user", text: judge_two.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_two.full_name) + end fill_in("taskInstructions", with: "Test") click_on("Assign") @@ -337,8 +341,8 @@ click_dropdown({ text: judge_two.full_name }, page.find(".dropdown-Other")) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Submit") - expect(page).to have_content("Assigned 1 task to #{judge_two.full_name}") + click_on("Assign") + expect(page).to have_content("You have successfully assigned 1 case to #{judge_two.full_name}") end end @@ -354,8 +358,8 @@ click_dropdown(prompt: "Select a user", text: judge_one.full_name) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Submit") - expect(page).to have_content("Assigned 1 task to #{judge_one.full_name}") + click_on("Assign") + expect(page).to have_content("You have successfully assigned 1 case to #{judge_one.full_name}") end end From 493392d20beb110420508fb51369c133b01c835f Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:51:27 -0400 Subject: [PATCH 149/203] rspec fix (#19556) --- spec/feature/queue/attorney_checkout_flow_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/feature/queue/attorney_checkout_flow_spec.rb b/spec/feature/queue/attorney_checkout_flow_spec.rb index b970d3733ff..45f8dfcddf0 100644 --- a/spec/feature/queue/attorney_checkout_flow_spec.rb +++ b/spec/feature/queue/attorney_checkout_flow_spec.rb @@ -99,7 +99,7 @@ click_on "Save" - expect(page).to have_content "This field is required" + expect(page).to have_content "Text box field is required" fill_in "Text Box", with: decision_issue_text find(".cf-select__control", text: "Select disposition").click From c51d0e434e7023215872b0b3a5fe38ad345b8bf4 Mon Sep 17 00:00:00 2001 From: MuhGrayVA <98366428+MuhGrayVA@users.noreply.github.com> Date: Mon, 25 Sep 2023 11:58:25 -0400 Subject: [PATCH 150/203] Adding feature toggle Adding das_deprecation feature toggle. --- app/views/queue/index.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/queue/index.html.erb b/app/views/queue/index.html.erb index 196fd9f7737..cf706c1eccc 100644 --- a/app/views/queue/index.html.erb +++ b/app/views/queue/index.html.erb @@ -54,7 +54,8 @@ cavc_dashboard_workflow: FeatureToggle.enabled?(:cavc_dashboard_workflow, user: current_user), cc_appeal_workflow: FeatureToggle.enabled?(:cc_appeal_workflow, user: current_user), cc_vacatur_visibility: FeatureToggle.enabled?(:cc_vacatur_visibility, user: current_user), - vlj_legacy_appeal: FeatureToggle.enabled?(:vlj_legacy_appeal, user: current_user) + vlj_legacy_appeal: FeatureToggle.enabled?(:vlj_legacy_appeal, user: current_user), + legacy_das_deprecation: FeatureToggle.enabled?(:legacy_das_deprecation, user: current_user) } }) %> <% end %> From 97c7ce6a1e987dbdeaabbcc4fecc9b2dba7d53f6 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:27:48 -0400 Subject: [PATCH 151/203] new veterans added to script + failsafe in JLT (#19566) --- .../legacy_tasks/judge_legacy_assign_task.rb | 20 +++++++++++++++++-- lib/tasks/seed_legacy_appeal_tasks.rake | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/models/legacy_tasks/judge_legacy_assign_task.rb b/app/models/legacy_tasks/judge_legacy_assign_task.rb index 99d5df5ce99..10095bc4f59 100644 --- a/app/models/legacy_tasks/judge_legacy_assign_task.rb +++ b/app/models/legacy_tasks/judge_legacy_assign_task.rb @@ -2,7 +2,17 @@ class JudgeLegacyAssignTask < JudgeLegacyTask def available_actions(user, role) - if assigned_to == user && role == "judge" + if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && + (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") + [ + Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h + ] + elsif current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && + %w[81 33].include?(appeal.case_record.reload.bfcurloc) + [ + Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h + ] + elsif assigned_to == user && role == "judge" [ Constants.TASK_ACTIONS.ADD_ADMIN_ACTION.to_h, Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.to_h, @@ -19,6 +29,12 @@ def available_actions(user, role) end def label - COPY::JUDGE_ASSIGN_TASK_LABEL + if (%w[81 57 + 33].include?(appeal.case_record.reload.bfcurloc) || appeal.case_record.reload.bfcurloc == "CASEFLOW") && + FeatureToggle.enabled?(:vlj_legacy_appeal) + COPY::ATTORNEY_REWRITE_TASK_LEGACY_LABEL + else + COPY::JUDGE_ASSIGN_TASK_LABEL + end end end diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index 7f74b8100d3..138de7f96ef 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -382,7 +382,7 @@ namespace :db do veterans_with_like_45_appeals = vets[0..12].pluck(:file_number) # local / test option for veterans else - veterans_with_like_45_appeals = %w[011899917 011899918] # UAT option for veterans + veterans_with_like_45_appeals = %w[583099131 589951227 333313333] # UAT option for veterans end From a32c382581334eb7fa414ea91e035a59947d6a8c Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:43:13 -0400 Subject: [PATCH 152/203] Calvin/uat/fy23 q4.5.3 docket fix (#19567) * new veterans added to script + failsafe in JLT * dynamic docket number + adding more cases generate --- lib/tasks/seed_legacy_appeal_tasks.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index 138de7f96ef..27030a866a2 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -430,8 +430,8 @@ namespace :db do docket_number = 9_000_000 veterans_with_like_45_appeals.each do |file_number| - docket_number += 1 - LegacyAppealFactory.stamp_out_legacy_appeals(1, file_number, user, docket_number, task_type) + docket_number += rand(1000) + LegacyAppealFactory.stamp_out_legacy_appeals(3, file_number, user, docket_number, task_type) end $stdout.puts("You have created Legacy Appeals") end From c0e682326756c45615737605a738bca564b152f8 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Tue, 26 Sep 2023 08:56:24 -0400 Subject: [PATCH 153/203] fix (#19571) --- app/models/legacy_tasks/judge_legacy_assign_task.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/legacy_tasks/judge_legacy_assign_task.rb b/app/models/legacy_tasks/judge_legacy_assign_task.rb index 10095bc4f59..99c382f0603 100644 --- a/app/models/legacy_tasks/judge_legacy_assign_task.rb +++ b/app/models/legacy_tasks/judge_legacy_assign_task.rb @@ -2,12 +2,12 @@ class JudgeLegacyAssignTask < JudgeLegacyTask def available_actions(user, role) - if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && + if user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") [ Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h ] - elsif current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && + elsif user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && %w[81 33].include?(appeal.case_record.reload.bfcurloc) [ Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h From 240143d7dd0c457431638655e66fb568c38005e7 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:20:41 -0400 Subject: [PATCH 154/203] spec fix for post_send_initial_notification_letter_holding_task_spec (#19572) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- ..._send_initial_notification_letter_holding_task_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/models/post_send_initial_notification_letter_holding_task_spec.rb b/spec/models/post_send_initial_notification_letter_holding_task_spec.rb index 662e24f571a..d57eb34b198 100644 --- a/spec/models/post_send_initial_notification_letter_holding_task_spec.rb +++ b/spec/models/post_send_initial_notification_letter_holding_task_spec.rb @@ -198,7 +198,7 @@ context "The TaskTimer for the hold period was not created yet" do it "returns the end date period" do - expect((post_task.timer_ends_at - post_task.created_at.prev_day).to_i / 1.day).to eq(hold_days) + expect((post_task.timer_ends_at - post_task.created_at).to_i / 1.day).to eq(hold_days) end end @@ -214,11 +214,11 @@ it "returns the same max hold period using the TaskTimer dates" do tt = TaskTimer.find_by(task_id: post_task.id) expect(tt.task_id).to eq(post_task.id) - expect((post_task.timer_ends_at - post_task.created_at.prev_day).to_i / 1.day).to eq(hold_days) + expect((post_task.timer_ends_at - post_task.created_at).to_i / 1.day).to eq(hold_days) # confirm the values are being pulled from the TaskTimer - calculate_max_hold = (tt.submitted_at - post_task.created_at.prev_day).to_i / 1.day - expect((post_task.timer_ends_at - post_task.created_at.prev_day).to_i / 1.day).to eq(calculate_max_hold) + calculate_max_hold = (tt.submitted_at - post_task.created_at).to_i / 1.day + expect((post_task.timer_ends_at - post_task.created_at).to_i / 1.day).to eq(calculate_max_hold) end end end From b543990521f056e045ddfd70c9999ba165f5d08d Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:39:33 -0500 Subject: [PATCH 155/203] changed button name (#19577) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/feature/queue/motion_to_vacate_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/feature/queue/motion_to_vacate_spec.rb b/spec/feature/queue/motion_to_vacate_spec.rb index f554f9daf06..b1e55cdba28 100644 --- a/spec/feature/queue/motion_to_vacate_spec.rb +++ b/spec/feature/queue/motion_to_vacate_spec.rb @@ -84,6 +84,7 @@ # When mail team creates VacateMotionMailTask, it gets assigned to the lit support organization User.authenticate!(user: mail_user) visit "/queue/appeals/#{appeal.uuid}" + refresh find("button", text: COPY::TASK_SNAPSHOT_ADD_NEW_TASK_LABEL).click find(".cf-select__control", text: COPY::MAIL_TASK_DROPDOWN_TYPE_SELECTOR_LABEL).click find("div", class: "cf-select__option", text: COPY::VACATE_MOTION_MAIL_TASK_LABEL).click @@ -99,7 +100,7 @@ find("div", class: "cf-select__option", text: "Assign to person").click find(".cf-modal .cf-select__control").click find("div", class: "cf-select__option", text: "Motions attorney").click - click_button(text: "Assign") + click_button(text: "Submit") expect(page).to have_content("Task assigned to Motions attorney") motions_attorney_task = VacateMotionMailTask.find_by(assigned_to: motions_attorney) expect(motions_attorney_task).to_not be_nil From b461b7143c557bec0e7b6d36ab148600b9a075a0 Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:02:23 -0400 Subject: [PATCH 156/203] Fix error in spec file and add condition for ColocateTask and TranslationTask in task.rb file (#19578) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/task.rb | 4 +--- client/app/queue/AssignToView.jsx | 4 +--- spec/feature/queue/colocated_checkout_flow_spec.rb | 7 ++----- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 23d6b1bfedc..e98486df941 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -231,10 +231,8 @@ def any_recently_updated(*tasks_arrays) def create_from_params(params, user) parent_task = create_parent_task(params, user) - params = modify_params_for_create(params) - - if parent_task.appeal_type == "LegacyAppeal" + if parent_task.appeal_type == "LegacyAppeal" && parent_task.type != "TranslationTask" && !parent_task.type.is_a?(ColocatedTask) special_case_for_legacy(parent_task, params, user) else # regular appeal child = create_child_task(parent_task, user, params) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index 08f81a526cf..5151ef9d007 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -217,7 +217,7 @@ class AssignToView extends React.Component { return assignor; }; - let titleValue = task.type === 'JudgeDecisionReviewTask' ? + const titleValue = task.type === 'JudgeDecisionReviewTask' ? sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()) : sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE_SCM, assignedByListItem(), this.getAssignee()); @@ -395,8 +395,6 @@ class AssignToView extends React.Component { modalProps.submitButtonClassNames = ['usa-button']; } - - return (

    {actionData.modal_body ? actionData.modal_body : ''}

    diff --git a/spec/feature/queue/colocated_checkout_flow_spec.rb b/spec/feature/queue/colocated_checkout_flow_spec.rb index 72705e707a7..b32bc338232 100644 --- a/spec/feature/queue/colocated_checkout_flow_spec.rb +++ b/spec/feature/queue/colocated_checkout_flow_spec.rb @@ -138,13 +138,10 @@ click_dropdown({ text: "CAVC Litigation Support" }, find(".cf-modal-body")) fill_in "taskInstructions", with: "testing this out" - click_on COPY::MODAL_SUBMIT_BUTTON + click_on COPY::MODAL_ASSIGN_BUTTON expect(page).to have_current_path("/queue") - expect(page).to have_content( - format(COPY::ASSIGN_TASK_SUCCESS_MESSAGE, "CAVC Litigation Support") - ) - + expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE, 'CAVC Support') expect(translation_action.reload.status).to eq "on_hold" end end From 4124e99b97bcc7fbb75298aa8c6b60edecf64df2 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Tue, 26 Sep 2023 12:02:29 -0600 Subject: [PATCH 157/203] changing deprecated functions to componentdidupdate --- client/app/certification/ConfirmCaseDetails.jsx | 9 +-------- client/app/certification/ConfirmHearing.jsx | 8 +------- client/app/certification/DocumentsCheck.jsx | 6 +----- client/app/certification/SignAndCertify.jsx | 8 +------- client/app/components/LoadingDataDisplay.jsx | 4 ++-- client/app/components/SearchBar.jsx | 2 +- client/app/components/SearchableDropdown.jsx | 7 ++++--- .../EstablishClaimPage/EstablishClaimAssociateEP.jsx | 3 --- client/app/queue/JudgeSelectComponent.jsx | 2 +- client/app/reader/PdfFile.jsx | 2 +- client/app/reader/PdfUIPageNumInput.jsx | 2 +- client/app/reader/PdfViewer.jsx | 2 +- 12 files changed, 15 insertions(+), 40 deletions(-) diff --git a/client/app/certification/ConfirmCaseDetails.jsx b/client/app/certification/ConfirmCaseDetails.jsx index 63b0f9d1644..3d1501b2545 100644 --- a/client/app/certification/ConfirmCaseDetails.jsx +++ b/client/app/certification/ConfirmCaseDetails.jsx @@ -122,19 +122,12 @@ const ERRORS = { */ export class ConfirmCaseDetails extends React.Component { - // TODO: updating state in UNSAFE_componentWillMount is - // sometimes thought of as an anti-pattern. - // is there a better way to do this? - // eslint-disable-next-line camelcase - UNSAFE_componentWillMount() { - this.props.updateProgressBar(); - } - componentWillUnmount() { this.props.resetState(); } componentDidMount() { + this.props.updateProgressBar(); window.scrollTo(0, 0); } diff --git a/client/app/certification/ConfirmHearing.jsx b/client/app/certification/ConfirmHearing.jsx index 99fa968d129..38685fa3590 100644 --- a/client/app/certification/ConfirmHearing.jsx +++ b/client/app/certification/ConfirmHearing.jsx @@ -122,18 +122,12 @@ const ERRORS = { // TODO: refactor to use shared components where helpful export class ConfirmHearing extends React.Component { - // TODO: updating state in UNSAFE_componentWillMount is - // sometimes thought of as an anti-pattern. - // is there a better way to do this? - UNSAFE_componentWillMount() { - this.props.updateProgressBar(); - } - componentWillUnmount() { this.props.resetState(); } componentDidMount() { + this.props.updateProgressBar(); window.scrollTo(0, 0); } diff --git a/client/app/certification/DocumentsCheck.jsx b/client/app/certification/DocumentsCheck.jsx index d74b3b93f5a..0cbb620a18a 100644 --- a/client/app/certification/DocumentsCheck.jsx +++ b/client/app/certification/DocumentsCheck.jsx @@ -15,11 +15,7 @@ import CertificationProgressBar from './CertificationProgressBar'; import WindowUtil from '../util/WindowUtil'; export class DocumentsCheck extends React.Component { - // TODO: updating state in UNSAFE_componentWillMount is - // sometimes thought of as an anti-pattern. - // is there a better way to do this? - // eslint-disable-next-line camelcase - UNSAFE_componentWillMount() { + componentDidMount() { this.props.updateProgressBar(); } diff --git a/client/app/certification/SignAndCertify.jsx b/client/app/certification/SignAndCertify.jsx index cef885d12ca..0ac49ca8c63 100644 --- a/client/app/certification/SignAndCertify.jsx +++ b/client/app/certification/SignAndCertify.jsx @@ -41,15 +41,9 @@ const ERRORS = { }; export class SignAndCertify extends React.Component { - // TODO: updating state in UNSAFE_componentWillMount is - // sometimes thought of as an anti-pattern. - // is there a better way to do this? - UNSAFE_componentWillMount() { - this.props.updateProgressBar(); - } - /* eslint class-methods-use-this: ["error", { "exceptMethods": ["componentDidMount"] }] */ componentDidMount() { + this.props.updateProgressBar(); window.scrollTo(0, 0); } diff --git a/client/app/components/LoadingDataDisplay.jsx b/client/app/components/LoadingDataDisplay.jsx index 449e54a0e61..3445f8eabeb 100644 --- a/client/app/components/LoadingDataDisplay.jsx +++ b/client/app/components/LoadingDataDisplay.jsx @@ -42,6 +42,7 @@ class LoadingDataDisplay extends React.PureComponent { this.setState({ promiseStartTimeMs: Date.now() }); + // Promise does not give us a way to "un-then" and stop listening // when the component unmounts. So we'll leave this reference dangling, // but at least we can use this._isMounted to avoid taking action if necessary. @@ -93,8 +94,7 @@ class LoadingDataDisplay extends React.PureComponent { this._isMounted = false; } - // eslint-disable-next-line camelcase - UNSAFE_componentWillReceiveProps(nextProps) { + componentDidUpdate(nextProps) { if (this.props.createLoadPromise.toString() !== nextProps.createLoadPromise.toString()) { throw new Error("Once LoadingDataDisplay is instantiated, you can't change the createLoadPromise function."); } diff --git a/client/app/components/SearchBar.jsx b/client/app/components/SearchBar.jsx index ad52dc68ed1..ed2bcb935d9 100644 --- a/client/app/components/SearchBar.jsx +++ b/client/app/components/SearchBar.jsx @@ -41,7 +41,7 @@ export default class SearchBar extends React.Component { } /* eslint-disable camelcase */ - UNSAFE_componentWillReceiveProps(nextProps) { + componentDidUpdate(nextProps) { if (this.props.value !== nextProps.value) { this.clearSearchCallback(); diff --git a/client/app/components/SearchableDropdown.jsx b/client/app/components/SearchableDropdown.jsx index cc7a2cbd093..a80b052dccc 100644 --- a/client/app/components/SearchableDropdown.jsx +++ b/client/app/components/SearchableDropdown.jsx @@ -91,9 +91,10 @@ export class SearchableDropdown extends React.Component { } } - // eslint-disable-next-line camelcase - UNSAFE_componentWillReceiveProps = (nextProps) => { - this.setState({ value: nextProps.value }); + componentDidUpdate = (prevProps, nextProps) => { + if (prevProps !== this.props) { + this.setState({ value: nextProps.value }); + } }; onChange = (value) => { diff --git a/client/app/containers/EstablishClaimPage/EstablishClaimAssociateEP.jsx b/client/app/containers/EstablishClaimPage/EstablishClaimAssociateEP.jsx index af18f7ed6da..48a8129997f 100644 --- a/client/app/containers/EstablishClaimPage/EstablishClaimAssociateEP.jsx +++ b/client/app/containers/EstablishClaimPage/EstablishClaimAssociateEP.jsx @@ -19,10 +19,7 @@ export class AssociatePage extends React.Component { epLoading: null, sortedEndProducts: this.props.endProducts.sort(this.sortEndProduct) }; - } - // eslint-disable-next-line camelcase - UNSAFE_componentWillMount() { if (!this.props.endProducts.length) { this.props.history.goBack(); } diff --git a/client/app/queue/JudgeSelectComponent.jsx b/client/app/queue/JudgeSelectComponent.jsx index 5ad3a6ed6d4..74259f65b0a 100644 --- a/client/app/queue/JudgeSelectComponent.jsx +++ b/client/app/queue/JudgeSelectComponent.jsx @@ -38,7 +38,7 @@ class JudgeSelectComponent extends React.PureComponent { } }; - UNSAFE_componentWillReceiveProps = (nextProps) => { + componentDidUpdate = (nextProps) => { if (nextProps.judges !== this.props.judges) { this.setDefaultJudge(nextProps.judges); } diff --git a/client/app/reader/PdfFile.jsx b/client/app/reader/PdfFile.jsx index 1941496aa7e..846eda76912 100644 --- a/client/app/reader/PdfFile.jsx +++ b/client/app/reader/PdfFile.jsx @@ -183,7 +183,7 @@ export class PdfFile extends React.PureComponent { } // eslint-disable-next-line camelcase - UNSAFE_componentWillReceiveProps(nextProps) { + componentDidUpdate(nextProps) { if (nextProps.isVisible !== this.props.isVisible) { this.currentPage = 0; } diff --git a/client/app/reader/PdfUIPageNumInput.jsx b/client/app/reader/PdfUIPageNumInput.jsx index 7cadb593331..9541d586b34 100644 --- a/client/app/reader/PdfUIPageNumInput.jsx +++ b/client/app/reader/PdfUIPageNumInput.jsx @@ -18,7 +18,7 @@ export class PdfUIPageNumInput extends React.PureComponent { }; } - UNSAFE_componentWillUpdate = (nextProps) => { // eslint-disable-line camelcase + componentDidUpdate = (nextProps) => { if (nextProps.currentPage !== this.props.currentPage) { this.setPageNumber(nextProps.currentPage); } diff --git a/client/app/reader/PdfViewer.jsx b/client/app/reader/PdfViewer.jsx index c91339722a7..946f57bd710 100644 --- a/client/app/reader/PdfViewer.jsx +++ b/client/app/reader/PdfViewer.jsx @@ -156,7 +156,7 @@ export class PdfViewer extends React.Component { } /* eslint-disable camelcase */ - UNSAFE_componentWillReceiveProps = (nextProps) => { + componentDidUpdate = (nextProps) => { const nextDocId = Number(nextProps.match.params.docId); if (nextDocId !== this.selectedDocId()) { From 5a22b7e75cde8863c93bbfb3eb6b7368972b60d7 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Tue, 26 Sep 2023 17:35:50 -0600 Subject: [PATCH 158/203] fixing reader and review spec --- client/app/components/SearchableDropdown.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/app/components/SearchableDropdown.jsx b/client/app/components/SearchableDropdown.jsx index a80b052dccc..da55b525011 100644 --- a/client/app/components/SearchableDropdown.jsx +++ b/client/app/components/SearchableDropdown.jsx @@ -91,9 +91,9 @@ export class SearchableDropdown extends React.Component { } } - componentDidUpdate = (prevProps, nextProps) => { + componentDidUpdate = (prevProps) => { if (prevProps !== this.props) { - this.setState({ value: nextProps.value }); + this.setState({ value: this.props.value }); } }; From db9f701016867fe0cfa17590052ec67693095bdc Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Wed, 27 Sep 2023 02:23:47 -0600 Subject: [PATCH 159/203] fixing some of the linting issues --- client/app/certification/DocumentsCheck.jsx | 4 ++-- client/app/components/LoadingDataDisplay.jsx | 1 - client/app/queue/JudgeSelectComponent.jsx | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/app/certification/DocumentsCheck.jsx b/client/app/certification/DocumentsCheck.jsx index 0cbb620a18a..0cec2fae1d3 100644 --- a/client/app/certification/DocumentsCheck.jsx +++ b/client/app/certification/DocumentsCheck.jsx @@ -53,13 +53,13 @@ export class DocumentsCheck extends React.Component {

    If the document status is marked with an , try checking:

    + labeled correctly.
      The document date in VBMS. NOD and Form 9 dates must match their VACOLS dates. SOC and SSOC dates are considered matching if the VBMS date is the same as the VACOLS date, or if the VBMS date is 4 days or fewer before the VACOLS date. Learn more about document dates.

    Once you've made corrections,  - refresh this page.

    + refresh this page.

    If you can't find the document, cancel this certification.

    ; diff --git a/client/app/components/LoadingDataDisplay.jsx b/client/app/components/LoadingDataDisplay.jsx index 3445f8eabeb..14177f5b5fc 100644 --- a/client/app/components/LoadingDataDisplay.jsx +++ b/client/app/components/LoadingDataDisplay.jsx @@ -42,7 +42,6 @@ class LoadingDataDisplay extends React.PureComponent { this.setState({ promiseStartTimeMs: Date.now() }); - // Promise does not give us a way to "un-then" and stop listening // when the component unmounts. So we'll leave this reference dangling, // but at least we can use this._isMounted to avoid taking action if necessary. diff --git a/client/app/queue/JudgeSelectComponent.jsx b/client/app/queue/JudgeSelectComponent.jsx index 74259f65b0a..ea2d33a3faf 100644 --- a/client/app/queue/JudgeSelectComponent.jsx +++ b/client/app/queue/JudgeSelectComponent.jsx @@ -13,7 +13,7 @@ import { setSelectingJudge } from './uiReducer/uiActions'; import Button from '../components/Button'; import SearchableDropdown from '../components/SearchableDropdown'; -import COPY from '../../COPY.json'; +import COPY from '../../COPY'; const selectJudgeButtonStyling = (selectedJudge) => css({ paddingLeft: selectedJudge ? '' : 0 }); From af3c032eaf83d6508f905f5f4e46ef95614870c8 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Wed, 27 Sep 2023 06:13:20 -0600 Subject: [PATCH 160/203] fixing linting and jest --- client/app/certification/ConfirmHearing.jsx | 9 +- client/app/certification/SignAndCertify.jsx | 9 +- client/app/queue/JudgeSelectComponent.jsx | 12 + .../ScheduleVeteranForm.test.js.snap | 416 +++++++++++++----- 4 files changed, 340 insertions(+), 106 deletions(-) diff --git a/client/app/certification/ConfirmHearing.jsx b/client/app/certification/ConfirmHearing.jsx index 38685fa3590..80c5ffb6884 100644 --- a/client/app/certification/ConfirmHearing.jsx +++ b/client/app/certification/ConfirmHearing.jsx @@ -423,5 +423,12 @@ ConfirmHearing.propTypes = { hearingPreference: PropTypes.string, onHearingPreferenceChange: PropTypes.func, match: PropTypes.object.isRequired, - certificationStatus: PropTypes.string + certificationStatus: PropTypes.string, + resetState: PropTypes.func, + updateProgressBar: PropTypes.func, + showValidationErrors: PropTypes.func, + certificationUpdateStart: PropTypes.func, + loading: PropTypes.bool, + serverError: PropTypes.bool, + updateConfirmHearingSucceeded: PropTypes.func }; diff --git a/client/app/certification/SignAndCertify.jsx b/client/app/certification/SignAndCertify.jsx index 0ac49ca8c63..ece0996acab 100644 --- a/client/app/certification/SignAndCertify.jsx +++ b/client/app/certification/SignAndCertify.jsx @@ -261,5 +261,12 @@ SignAndCertify.propTypes = { erroredFields: PropTypes.array, scrollToError: PropTypes.bool, match: PropTypes.object.isRequired, - certificationStatus: PropTypes.string + certificationStatus: PropTypes.string, + updateProgressBar: PropTypes.func, + showValidationErrors: PropTypes.func, + certificationUpdateStart: PropTypes.func, + showValidationErrors: PropTypes.func, + loading: PropTypes.bool, + serverError: PropTypes.bool, + updateSucceeded: PropTypes.bool }; diff --git a/client/app/queue/JudgeSelectComponent.jsx b/client/app/queue/JudgeSelectComponent.jsx index ea2d33a3faf..f999ebd3bb9 100644 --- a/client/app/queue/JudgeSelectComponent.jsx +++ b/client/app/queue/JudgeSelectComponent.jsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { css } from 'glamor'; @@ -137,3 +138,14 @@ export default (connect( mapStateToProps, mapDispatchToProps )(JudgeSelectComponent)); + +JudgeSelectComponent.propTypes = { + judge: PropTypes.string, + fetchJudges: PropTypes.func, + judgeSelector: PropTypes.string, + setDecisionOptions: PropTypes.func, + selectingJudge: PropTypes.bool, + decision: PropTypes.object, + highlightFormItems: PropTypes.bool, + setSelectingJudge: PropTypes.func +} diff --git a/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap b/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap index 94f8e768d8b..0a02ee7d692 100644 --- a/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap +++ b/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap @@ -90626,15 +90626,31 @@ SAN FRANCISCO, CA 94103 } value={ Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, } @@ -91568,15 +91584,31 @@ SAN FRANCISCO, CA 94103 tabSelectsValue={true} value={ Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, } @@ -93394,15 +93426,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -95272,15 +95320,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -97158,15 +97222,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -97229,15 +97309,31 @@ SAN FRANCISCO, CA 94103 cx={[Function]} data={ Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, } @@ -99044,15 +99140,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -99113,7 +99225,7 @@ SAN FRANCISCO, CA 94103
    - Central + St. Petersburg regional office
    @@ -100057,15 +100169,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -101050,15 +101178,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -103015,15 +103159,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -104883,15 +105043,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -106762,15 +106938,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -106884,13 +107076,29 @@ SAN FRANCISCO, CA 94103 type="hidden" value={ Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", } } From 62e0f89fe65ceb7d8bfa3ee311394e68a6859521 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 27 Sep 2023 08:32:09 -0400 Subject: [PATCH 161/203] changed staff create to find by or create (#19585) --- lib/generators/vacols/staff.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/generators/vacols/staff.rb b/lib/generators/vacols/staff.rb index 71a4e8c038d..c792cf77253 100644 --- a/lib/generators/vacols/staff.rb +++ b/lib/generators/vacols/staff.rb @@ -59,8 +59,7 @@ def staff_attrs def create(attrs = {}) merged_attrs = staff_attrs.merge(attrs) - - VACOLS::Staff.create(merged_attrs) + VACOLS::Staff.find_or_create_by(merged_attrs) end end end From 7204ae675634c060ffc5c892a0ac0a47d05b136b Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Wed, 27 Sep 2023 06:47:12 -0600 Subject: [PATCH 162/203] some more fixing linter --- client/app/certification/SignAndCertify.jsx | 1 - client/app/queue/JudgeSelectComponent.jsx | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/app/certification/SignAndCertify.jsx b/client/app/certification/SignAndCertify.jsx index ece0996acab..894e42bcf9b 100644 --- a/client/app/certification/SignAndCertify.jsx +++ b/client/app/certification/SignAndCertify.jsx @@ -265,7 +265,6 @@ SignAndCertify.propTypes = { updateProgressBar: PropTypes.func, showValidationErrors: PropTypes.func, certificationUpdateStart: PropTypes.func, - showValidationErrors: PropTypes.func, loading: PropTypes.bool, serverError: PropTypes.bool, updateSucceeded: PropTypes.bool diff --git a/client/app/queue/JudgeSelectComponent.jsx b/client/app/queue/JudgeSelectComponent.jsx index f999ebd3bb9..7f2109f4c71 100644 --- a/client/app/queue/JudgeSelectComponent.jsx +++ b/client/app/queue/JudgeSelectComponent.jsx @@ -141,6 +141,7 @@ export default (connect( JudgeSelectComponent.propTypes = { judge: PropTypes.string, + judges: PropTypes.object, fetchJudges: PropTypes.func, judgeSelector: PropTypes.string, setDecisionOptions: PropTypes.func, @@ -148,4 +149,4 @@ JudgeSelectComponent.propTypes = { decision: PropTypes.object, highlightFormItems: PropTypes.bool, setSelectingJudge: PropTypes.func -} +}; From 2cca89c13c6f2ce4a76fb258a205a9de4b49dd00 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:07:06 -0500 Subject: [PATCH 163/203] [APPEALS-31202] queue/mail_task_spec.rb (#19588) --- spec/feature/queue/mail_task_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/feature/queue/mail_task_spec.rb b/spec/feature/queue/mail_task_spec.rb index a480cd11eb8..48ad3c9ab20 100644 --- a/spec/feature/queue/mail_task_spec.rb +++ b/spec/feature/queue/mail_task_spec.rb @@ -41,7 +41,7 @@ text = Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.label click_dropdown(prompt: prompt, text: text) fill_in("taskInstructions", with: "instructions") - click_button("Assign") + click_button("Submit") expect(page).to have_content(format(COPY::ASSIGN_TASK_SUCCESS_MESSAGE, user.full_name)) expect(page.current_path).to eq("/queue") @@ -120,7 +120,7 @@ find("button", text: COPY::CHANGE_TASK_TYPE_SUBHEAD).click # Instructions field is required - expect(page).to have_content(COPY::INSTRUCTIONS_ERROR_FIELD_REQUIRED) + expect(page).to have_content(COPY::FORM_ERROR_FIELD_REQUIRED) # Add instructions and try again new_instructions = generate_words(5) From 5edcd689dafe26e99e095e8e9e8ac497ca15ce81 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:07:35 -0400 Subject: [PATCH 164/203] fixed typo that was causing wrong banner to appear (#19589) --- client/app/queue/components/AssignToAttorneyWidget.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index afab63aa005..269bd0e0fe5 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -188,7 +188,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { return this.props.showSuccessMessage({ title: sprintf(COPY.ASSIGN_WIDGET_SUCCESS, { verb: isReassign ? 'You have successfully reassigned' : 'You have successfully assigned', - numCases: selectedTasks.length === 1 && selectedTasks[0].appeal?.appelantFullName ? `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, + numCases: selectedTasks.length === 1 && selectedTasks[0].appeal?.appellantFullName ? `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, casePlural: pluralize('cases', selectedTasks.length), // eslint-disable-next-line camelcase assignee: assignee.full_name From b79ebcf8df4405e15280bee98c384ecbd052274c Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Wed, 27 Sep 2023 13:03:33 -0400 Subject: [PATCH 165/203] spec fix for case_docket_spec (#19587) * spec fix for case_docket_spec * adding feature toggle to spec --- spec/models/vacols/case_docket_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/models/vacols/case_docket_spec.rb b/spec/models/vacols/case_docket_spec.rb index 59d3e7978f3..fcb6d3bda6b 100644 --- a/spec/models/vacols/case_docket_spec.rb +++ b/spec/models/vacols/case_docket_spec.rb @@ -4,6 +4,7 @@ before do FeatureToggle.enable!(:test_facols) FeatureToggle.enable!(:acd_disable_legacy_lock_ready_appeals) + FeatureToggle.enable!(:legacy_das_deprecation) end after do @@ -654,7 +655,7 @@ it "sets the case location to 'CASEFLOW'" do VACOLS::CaseDocket.distribute_nonpriority_appeals(judge, "any", nil, 2, false) - expect(nonpriority_ready_case.reload.bfcurloc).to eq(LegacyAppeal::LOCATION_CODES[:caseflow]) + expect(nonpriority_ready_case.reload.bfcurloc).to eq(judge.vacols_uniq_id) end end -end +end \ No newline at end of file From f2fb8658e0569e7994ae187801bdb6fbe8de3fb9 Mon Sep 17 00:00:00 2001 From: Shruthi Sibi <109103820+shruthisibi@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:43:30 -0500 Subject: [PATCH 166/203] Rspecfix- Assign task to attorney (#19582) * Rspecfix- Assign task to attorney * Rspec fix- assign task to attorney spec Feature flag set to false * Add stub for das deprecation toggle * Remove stub for toggle in spec --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> Co-authored-by: Christopher Aceves --- app/workflows/das_deprecation/assign_task_to_attorney.rb | 1 - spec/workflows/das_deprecation/assign_task_to_attorney_spec.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/workflows/das_deprecation/assign_task_to_attorney.rb b/app/workflows/das_deprecation/assign_task_to_attorney.rb index dbf69f57fcf..116b55b7c20 100644 --- a/app/workflows/das_deprecation/assign_task_to_attorney.rb +++ b/app/workflows/das_deprecation/assign_task_to_attorney.rb @@ -22,7 +22,6 @@ def reassign_attorney_task(vacols_id, assigned_by, assigned_to) def should_perform_workflow?(appeal_id) return false if FeatureToggle.enabled?(:legacy_das_deprecation, user: RequestStore.store[:current_user]) - appeal = LegacyAppeal.find(appeal_id) !JudgeAssignTask.find_by(appeal: appeal).nil? end diff --git a/spec/workflows/das_deprecation/assign_task_to_attorney_spec.rb b/spec/workflows/das_deprecation/assign_task_to_attorney_spec.rb index b89c081009f..707e3c1f113 100644 --- a/spec/workflows/das_deprecation/assign_task_to_attorney_spec.rb +++ b/spec/workflows/das_deprecation/assign_task_to_attorney_spec.rb @@ -25,7 +25,7 @@ describe "#should_perform_workflow?" do it "feature flag is enabled and appeal has JudgeAssignTask" do - expect(DasDeprecation::AssignTaskToAttorney.should_perform_workflow?(appeal.id)).to eq(true) + expect(DasDeprecation::AssignTaskToAttorney.should_perform_workflow?(appeal.id)).to eq(false) end end From 655294da6459210e5b6d6f774ac6ded5025ed659 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Wed, 27 Sep 2023 16:33:34 -0400 Subject: [PATCH 167/203] scenario 1 edge fix (#19594) --- app/models/task.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/task.rb b/app/models/task.rb index e98486df941..97db2249022 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -321,6 +321,9 @@ def cancel_all_children(current_task) end else current_task.children.each { |current_task| cancel_all_children(current_task) } + if current_task.status != "Cancelled" && current_task.status != "completed" + cancelled_task(current_task) + end end end From 1176ebcbafb1651ed68decb24d5798314a49fab1 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Wed, 27 Sep 2023 23:10:53 -0600 Subject: [PATCH 168/203] fixing pr comment --- client/app/components/SearchableDropdown.jsx | 10 ++++--- .../EstablishClaimAssociateEP.jsx | 2 ++ client/app/reader/PdfFile.jsx | 30 +++++++++++-------- client/app/reader/PdfViewer.jsx | 3 +- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/client/app/components/SearchableDropdown.jsx b/client/app/components/SearchableDropdown.jsx index da55b525011..8a6c0e5cb83 100644 --- a/client/app/components/SearchableDropdown.jsx +++ b/client/app/components/SearchableDropdown.jsx @@ -91,11 +91,13 @@ export class SearchableDropdown extends React.Component { } } - componentDidUpdate = (prevProps) => { - if (prevProps !== this.props) { - this.setState({ value: this.props.value }); + static getDerivedStateFromProps(nextProps, prevState) { + if (nextProps.value !== prevState.value) { + return { value: nextProps.value }; } - }; + + return null; + } onChange = (value) => { let newValue = value; diff --git a/client/app/containers/EstablishClaimPage/EstablishClaimAssociateEP.jsx b/client/app/containers/EstablishClaimPage/EstablishClaimAssociateEP.jsx index 48a8129997f..900576d0eb8 100644 --- a/client/app/containers/EstablishClaimPage/EstablishClaimAssociateEP.jsx +++ b/client/app/containers/EstablishClaimPage/EstablishClaimAssociateEP.jsx @@ -19,7 +19,9 @@ export class AssociatePage extends React.Component { epLoading: null, sortedEndProducts: this.props.endProducts.sort(this.sortEndProduct) }; + } + componentDidMount() { if (!this.props.endProducts.length) { this.props.history.goBack(); } diff --git a/client/app/reader/PdfFile.jsx b/client/app/reader/PdfFile.jsx index 846eda76912..fc88ddf77f2 100644 --- a/client/app/reader/PdfFile.jsx +++ b/client/app/reader/PdfFile.jsx @@ -183,22 +183,26 @@ export class PdfFile extends React.PureComponent { } // eslint-disable-next-line camelcase - componentDidUpdate(nextProps) { - if (nextProps.isVisible !== this.props.isVisible) { - this.currentPage = 0; - } + static getDerivedStateFromProps(nextProps, prevProps) { + if (nextProps.isVisible != prevProps.isVisible) { + if (nextProps.isVisible !== this.props.isVisible) { + this.currentPage = 0; + } - if (this.grid && nextProps.scale !== this.props.scale) { - // Set the scroll location based on the current page and where you - // are on that page scaled by the zoom factor. - const zoomFactor = nextProps.scale / this.props.scale; - const nonZoomedLocation = (this.scrollTop - this.getOffsetForPageIndex(this.currentPage).scrollTop); + if (this.grid && nextProps.scale !== this.props.scale) { + // Set the scroll location based on the current page and where you + // are on that page scaled by the zoom factor. + const zoomFactor = nextProps.scale / this.props.scale; + const nonZoomedLocation = (this.scrollTop - this.getOffsetForPageIndex(this.currentPage).scrollTop); - this.scrollLocation = { - page: this.currentPage, - locationOnPage: nonZoomedLocation * zoomFactor - }; + this.scrollLocation = { + page: this.currentPage, + locationOnPage: nonZoomedLocation * zoomFactor + }; + } + return this.scrollLocation; } + return null; } getPage = ({ rowIndex, columnIndex, style, isVisible }) => { diff --git a/client/app/reader/PdfViewer.jsx b/client/app/reader/PdfViewer.jsx index 946f57bd710..24bc3e974cf 100644 --- a/client/app/reader/PdfViewer.jsx +++ b/client/app/reader/PdfViewer.jsx @@ -133,8 +133,6 @@ export class PdfViewer extends React.Component { document.title = `${(selectedDoc && selectedDoc.type) || ''} | Document Viewer | Caseflow Reader`; } - componentDidUpdate = () => this.updateWindowTitle(); - componentDidMount() { this.props.handleSelectCurrentPdf(this.selectedDocId()); window.addEventListener('keydown', this.keyListener); @@ -162,6 +160,7 @@ export class PdfViewer extends React.Component { if (nextDocId !== this.selectedDocId()) { this.props.handleSelectCurrentPdf(nextDocId); } + this.updateWindowTitle(); } /* eslint-enable camelcase */ From f8488add007c33bd42043e3ee1d7a4aef7b5ed08 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Wed, 27 Sep 2023 23:38:15 -0600 Subject: [PATCH 169/203] fixing snap and linter --- client/app/reader/PdfFile.jsx | 2 +- .../ScheduleVeteranForm.test.js.snap | 416 +++++------------- 2 files changed, 105 insertions(+), 313 deletions(-) diff --git a/client/app/reader/PdfFile.jsx b/client/app/reader/PdfFile.jsx index fc88ddf77f2..a9810e4ec13 100644 --- a/client/app/reader/PdfFile.jsx +++ b/client/app/reader/PdfFile.jsx @@ -184,7 +184,7 @@ export class PdfFile extends React.PureComponent { // eslint-disable-next-line camelcase static getDerivedStateFromProps(nextProps, prevProps) { - if (nextProps.isVisible != prevProps.isVisible) { + if (nextProps.isVisible !== prevProps.isVisible) { if (nextProps.isVisible !== this.props.isVisible) { this.currentPage = 0; } diff --git a/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap b/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap index 0a02ee7d692..94f8e768d8b 100644 --- a/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap +++ b/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap @@ -90626,31 +90626,15 @@ SAN FRANCISCO, CA 94103 } value={ Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, } @@ -91584,31 +91568,15 @@ SAN FRANCISCO, CA 94103 tabSelectsValue={true} value={ Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, } @@ -93426,31 +93394,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -95320,31 +95272,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -97222,31 +97158,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -97309,31 +97229,15 @@ SAN FRANCISCO, CA 94103 cx={[Function]} data={ Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, } @@ -99140,31 +99044,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -99225,7 +99113,7 @@ SAN FRANCISCO, CA 94103
    - St. Petersburg regional office + Central
    @@ -100169,31 +100057,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -101178,31 +101050,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -103159,31 +103015,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -105043,31 +104883,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -106938,31 +106762,15 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "St. Petersburg regional office", + "label": "Central", "value": Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", }, }, @@ -107076,29 +106884,13 @@ SAN FRANCISCO, CA 94103 type="hidden" value={ Object { - "alternate_locations": Array [ - "vba_317a", - "vc_0742V", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - "vba_317", - ], - "city": "St. Petersburg", - "facility_locator_id": "vba_317", - "hold_hearings": true, - "key": "RO17", - "label": "St. Petersburg regional office", - "state": "FL", + "alternate_locations": null, + "city": "Washington", + "facility_locator_id": "vba_372", + "hold_hearings": false, + "key": "C", + "label": "Central", + "state": "DC", "timezone": "America/New_York", } } From 73b47dc58781575b8691f661dbeb66ef80b0d23a Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Thu, 28 Sep 2023 03:25:48 -0600 Subject: [PATCH 170/203] reverting for spec --- client/app/components/SearchableDropdown.jsx | 10 +- .../ScheduleVeteranForm.test.js.snap | 416 +++++++++++++----- 2 files changed, 316 insertions(+), 110 deletions(-) diff --git a/client/app/components/SearchableDropdown.jsx b/client/app/components/SearchableDropdown.jsx index 8a6c0e5cb83..da55b525011 100644 --- a/client/app/components/SearchableDropdown.jsx +++ b/client/app/components/SearchableDropdown.jsx @@ -91,13 +91,11 @@ export class SearchableDropdown extends React.Component { } } - static getDerivedStateFromProps(nextProps, prevState) { - if (nextProps.value !== prevState.value) { - return { value: nextProps.value }; + componentDidUpdate = (prevProps) => { + if (prevProps !== this.props) { + this.setState({ value: this.props.value }); } - - return null; - } + }; onChange = (value) => { let newValue = value; diff --git a/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap b/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap index 94f8e768d8b..0a02ee7d692 100644 --- a/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap +++ b/client/test/app/hearings/components/__snapshots__/ScheduleVeteranForm.test.js.snap @@ -90626,15 +90626,31 @@ SAN FRANCISCO, CA 94103 } value={ Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, } @@ -91568,15 +91584,31 @@ SAN FRANCISCO, CA 94103 tabSelectsValue={true} value={ Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, } @@ -93394,15 +93426,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -95272,15 +95320,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -97158,15 +97222,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -97229,15 +97309,31 @@ SAN FRANCISCO, CA 94103 cx={[Function]} data={ Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, } @@ -99044,15 +99140,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -99113,7 +99225,7 @@ SAN FRANCISCO, CA 94103
    - Central + St. Petersburg regional office
    @@ -100057,15 +100169,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -101050,15 +101178,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -103015,15 +103159,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -104883,15 +105043,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -106762,15 +106938,31 @@ SAN FRANCISCO, CA 94103 "tabIndex": "0", "tabSelectsValue": true, "value": Object { - "label": "Central", + "label": "St. Petersburg regional office", "value": Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", }, }, @@ -106884,13 +107076,29 @@ SAN FRANCISCO, CA 94103 type="hidden" value={ Object { - "alternate_locations": null, - "city": "Washington", - "facility_locator_id": "vba_372", - "hold_hearings": false, - "key": "C", - "label": "Central", - "state": "DC", + "alternate_locations": Array [ + "vba_317a", + "vc_0742V", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + "vba_317", + ], + "city": "St. Petersburg", + "facility_locator_id": "vba_317", + "hold_hearings": true, + "key": "RO17", + "label": "St. Petersburg regional office", + "state": "FL", "timezone": "America/New_York", } } From eeec10b7b3b70448a0fee9990c45c90708b54bde Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Thu, 28 Sep 2023 03:26:45 -0600 Subject: [PATCH 171/203] reverting for spec --- client/app/reader/PdfFile.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/app/reader/PdfFile.jsx b/client/app/reader/PdfFile.jsx index a9810e4ec13..962929ad629 100644 --- a/client/app/reader/PdfFile.jsx +++ b/client/app/reader/PdfFile.jsx @@ -200,8 +200,10 @@ export class PdfFile extends React.PureComponent { locationOnPage: nonZoomedLocation * zoomFactor }; } + return this.scrollLocation; } + return null; } From 09e68075f25be9c8ad04a6e9fcd45f06e3bce523 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Thu, 28 Sep 2023 05:34:49 -0600 Subject: [PATCH 172/203] changing to componentDidUpdate --- client/app/reader/PdfFile.jsx | 41 ++++++++++++++--------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/client/app/reader/PdfFile.jsx b/client/app/reader/PdfFile.jsx index 962929ad629..241a5ccf73e 100644 --- a/client/app/reader/PdfFile.jsx +++ b/client/app/reader/PdfFile.jsx @@ -182,31 +182,6 @@ export class PdfFile extends React.PureComponent { } } - // eslint-disable-next-line camelcase - static getDerivedStateFromProps(nextProps, prevProps) { - if (nextProps.isVisible !== prevProps.isVisible) { - if (nextProps.isVisible !== this.props.isVisible) { - this.currentPage = 0; - } - - if (this.grid && nextProps.scale !== this.props.scale) { - // Set the scroll location based on the current page and where you - // are on that page scaled by the zoom factor. - const zoomFactor = nextProps.scale / this.props.scale; - const nonZoomedLocation = (this.scrollTop - this.getOffsetForPageIndex(this.currentPage).scrollTop); - - this.scrollLocation = { - page: this.currentPage, - locationOnPage: nonZoomedLocation * zoomFactor - }; - } - - return this.scrollLocation; - } - - return null; - } - getPage = ({ rowIndex, columnIndex, style, isVisible }) => { const pageIndex = (this.columnCount * rowIndex) + columnIndex; @@ -368,6 +343,22 @@ export class PdfFile extends React.PureComponent { } componentDidUpdate = (prevProps) => { + if (prevProps.isVisible !== this.props.isVisible) { + this.currentPage = 0; + } + + if (this.grid && prevProps.scale !== this.props.scale) { + // Set the scroll location based on the current page and where you + // are on that page scaled by the zoom factor. + const zoomFactor = this.props.scale / prevProps.scale; + const nonZoomedLocation = (this.scrollTop - this.getOffsetForPageIndex(this.currentPage).scrollTop); + + this.scrollLocation = { + page: this.currentPage, + locationOnPage: nonZoomedLocation * zoomFactor + }; + } + if (this.grid && this.props.isVisible) { if (!prevProps.isVisible) { // eslint-disable-next-line react/no-find-dom-node From 69ed0119c24f9689753fcfe177594df540809002 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Thu, 28 Sep 2023 06:35:14 -0600 Subject: [PATCH 173/203] changing nextProps to prevProp for lifecycle --- client/app/components/LoadingDataDisplay.jsx | 4 ++-- client/app/components/SearchBar.jsx | 4 ++-- client/app/queue/JudgeSelectComponent.jsx | 6 +++--- client/app/reader/PdfUIPageNumInput.jsx | 6 +++--- client/app/reader/PdfViewer.jsx | 7 ++++--- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/client/app/components/LoadingDataDisplay.jsx b/client/app/components/LoadingDataDisplay.jsx index 14177f5b5fc..ef5c377afd9 100644 --- a/client/app/components/LoadingDataDisplay.jsx +++ b/client/app/components/LoadingDataDisplay.jsx @@ -93,8 +93,8 @@ class LoadingDataDisplay extends React.PureComponent { this._isMounted = false; } - componentDidUpdate(nextProps) { - if (this.props.createLoadPromise.toString() !== nextProps.createLoadPromise.toString()) { + componentDidUpdate(prevProps) { + if (this.props.createLoadPromise.toString() !== prevProps.createLoadPromise.toString()) { throw new Error("Once LoadingDataDisplay is instantiated, you can't change the createLoadPromise function."); } } diff --git a/client/app/components/SearchBar.jsx b/client/app/components/SearchBar.jsx index ed2bcb935d9..70c0ebe40bb 100644 --- a/client/app/components/SearchBar.jsx +++ b/client/app/components/SearchBar.jsx @@ -41,8 +41,8 @@ export default class SearchBar extends React.Component { } /* eslint-disable camelcase */ - componentDidUpdate(nextProps) { - if (this.props.value !== nextProps.value) { + componentDidUpdate(prevProps) { + if (this.props.value !== prevProps.value) { this.clearSearchCallback(); this.searchTimeout = setTimeout(() => { diff --git a/client/app/queue/JudgeSelectComponent.jsx b/client/app/queue/JudgeSelectComponent.jsx index 7f2109f4c71..90c20c65be1 100644 --- a/client/app/queue/JudgeSelectComponent.jsx +++ b/client/app/queue/JudgeSelectComponent.jsx @@ -39,9 +39,9 @@ class JudgeSelectComponent extends React.PureComponent { } }; - componentDidUpdate = (nextProps) => { - if (nextProps.judges !== this.props.judges) { - this.setDefaultJudge(nextProps.judges); + componentDidUpdate = (prevProps) => { + if (prevProps.judges !== this.props.judges) { + this.setDefaultJudge(this.props.judges); } } diff --git a/client/app/reader/PdfUIPageNumInput.jsx b/client/app/reader/PdfUIPageNumInput.jsx index 9541d586b34..6f97b9c0b1b 100644 --- a/client/app/reader/PdfUIPageNumInput.jsx +++ b/client/app/reader/PdfUIPageNumInput.jsx @@ -18,9 +18,9 @@ export class PdfUIPageNumInput extends React.PureComponent { }; } - componentDidUpdate = (nextProps) => { - if (nextProps.currentPage !== this.props.currentPage) { - this.setPageNumber(nextProps.currentPage); + componentDidUpdate = (prevProps) => { + if (prevProps.currentPage !== this.props.currentPage) { + this.setPageNumber(this.props.currentPage); } } diff --git a/client/app/reader/PdfViewer.jsx b/client/app/reader/PdfViewer.jsx index 24bc3e974cf..6cec0639f4a 100644 --- a/client/app/reader/PdfViewer.jsx +++ b/client/app/reader/PdfViewer.jsx @@ -154,10 +154,11 @@ export class PdfViewer extends React.Component { } /* eslint-disable camelcase */ - componentDidUpdate = (nextProps) => { - const nextDocId = Number(nextProps.match.params.docId); + componentDidUpdate = (prevProps) => { + const nextDocId = Number(this.props.match.params.docId); + const prevDocId = Number(prevProps.match.params.docId); - if (nextDocId !== this.selectedDocId()) { + if (nextDocId !== prevDocId) { this.props.handleSelectCurrentPdf(nextDocId); } this.updateWindowTitle(); From 8f74d8ee8e9d88597426b84dbb755da2965f7292 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Thu, 28 Sep 2023 10:49:19 -0400 Subject: [PATCH 174/203] spec fix for privacy_team_spec (#19597) --- spec/feature/queue/privacy_team_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/feature/queue/privacy_team_spec.rb b/spec/feature/queue/privacy_team_spec.rb index cb9cd880d43..8aa629735d6 100644 --- a/spec/feature/queue/privacy_team_spec.rb +++ b/spec/feature/queue/privacy_team_spec.rb @@ -43,9 +43,9 @@ # Assignee dropdown selector should be hidden. expect(find_all(".cf-modal-body .cf-select__control").count).to eq(0) fill_in("taskInstructions", with: instructions_text) - find("button", text: "Submit").click + find("button", text: "Assign").click - expect(page).to have_content("Task assigned to #{PrivacyTeam.singleton.name}") + expect(page).to have_content("You have successfully reassigned this task to #{PrivacyTeam.singleton.name}") # Log in as Privacy team member. User.authenticate!(user: privacy_team_member) @@ -72,7 +72,7 @@ fill_in("taskInstructions", with: instructions_text) find("button", text: "Assign").click - expect(page).to have_content("Task assigned to #{PrivacyTeam.singleton.name}") + expect(page).to have_content("You have successfully reassigned this task to #{PrivacyTeam.singleton.name}") # Log in as Privacy team member. User.authenticate!(user: privacy_team_member) From d0a077c4011c95c1f973004b97953491857e49a0 Mon Sep 17 00:00:00 2001 From: Prajwal Amatya Date: Thu, 28 Sep 2023 10:53:44 -0600 Subject: [PATCH 175/203] ading value prop comparision --- client/app/components/SearchableDropdown.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/components/SearchableDropdown.jsx b/client/app/components/SearchableDropdown.jsx index da55b525011..30cac9f2d29 100644 --- a/client/app/components/SearchableDropdown.jsx +++ b/client/app/components/SearchableDropdown.jsx @@ -92,7 +92,7 @@ export class SearchableDropdown extends React.Component { } componentDidUpdate = (prevProps) => { - if (prevProps !== this.props) { + if (prevProps.value !== this.props.value) { this.setState({ value: this.props.value }); } }; From 3a8bc41a7719982f35cd54f687c6e146eae598e7 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:25:01 -0400 Subject: [PATCH 176/203] added reasoning to task timeline (#19608) --- app/models/task.rb | 23 +++++-------------- .../blocked_special_case_movement_task.rb | 2 +- client/app/queue/components/TaskRows.jsx | 6 ++--- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 97db2249022..fc1bdd692ec 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -255,6 +255,7 @@ def create_parent_task(params, user) verify_user_can_create!(user, parent_task) end + parent_task end @@ -267,6 +268,7 @@ def special_case_for_legacy(parent_task, params, user) judge = User.find(params[:assigned_to_id]) legacy_appeal = LegacyAppeal.find(parent_task.appeal_id) + child = create_child_task(parent_task, user, params) parent_task.update!(status: params[:status]) if params[:status] AppealRepository.update_location!(legacy_appeal, judge.vacols_uniq_id) @@ -292,7 +294,7 @@ def create_parent_task(params, user) end def cancel_blocking_task_legacy(params, parent_task) - parent_task.children.each { |current_task| seach_for_blocking(current_task) } + parent_task.children.each { |current_task| search_for_blocking(params[:instructions], current_task) } legacy_appeal = LegacyAppeal.find(parent_task.appeal_id) judge = User.find(params["assigned_to_id"]) @@ -314,23 +316,10 @@ def cancelled_task(task) ) end - def cancel_all_children(current_task) - if current_task.children.count == 0 - if current_task.status != "Cancelled" && current_task.status != "completed" - cancelled_task(current_task) - end - else - current_task.children.each { |current_task| cancel_all_children(current_task) } - if current_task.status != "Cancelled" && current_task.status != "completed" - cancelled_task(current_task) - end - end - end - - def seach_for_blocking(current_task) + def search_for_blocking(instructions, current_task) current_task.legacy_blocking? ? - cancel_all_children(current_task) : - current_task.children.each { |current_task| seach_for_blocking(current_task) } + current_task.cancel_descendants(instructions: "**#{COPY::LEGACY_APPEALS_VLJ_REASON_INSTRUCTIONS}**\n" + instructions[1]) : + current_task.children.each { |current_task| search_for_blocking(current_task) } end def create_judge_assigned_task_for_legacy(params, parent_task) diff --git a/app/models/tasks/special_case_movement/blocked_special_case_movement_task.rb b/app/models/tasks/special_case_movement/blocked_special_case_movement_task.rb index 0288a5e6a86..4071f55fa87 100644 --- a/app/models/tasks/special_case_movement/blocked_special_case_movement_task.rb +++ b/app/models/tasks/special_case_movement/blocked_special_case_movement_task.rb @@ -15,7 +15,7 @@ def distribute_to_judge end def cancel_tasks_blocking_distribution - parent.cancel_descendants(instructions: instructions.first) + parent.cancel_descendants(instructions: "**#{COPY::LEGACY_APPEALS_VLJ_REASON_INSTRUCTIONS}**\n" + instructions[1]) end def verify_appeal_distributable diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index 50de3272416..39695fb8c82 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -355,7 +355,7 @@ class TaskRows extends React.PureComponent { return ( - {task.instructions[1] && task.type === 'JudgeAssignTask' && ( + {task.instructions[1] && !(task.type === 'AttorneyTask' || task.type === 'JudgeDecisionReviewTask' || task.type === 'AttorneyRewriteTask') && (
    )} - {task.assigneeName && task.type !== 'AttorneyTask' && task.type !== 'AttorneyRewriteTask' && + {task.assigneeName && (task.type === 'JudgeAssignTask' || task.type === 'JudgeDecisionReviewTask') && (
    - {task.type !== 'JudgeDecisionReviewTask' && COPY.LEGACY_APPEALS_VLJ_DETAILS_INSTRUCTIONS} + {(task.instructions[0].includes('**Reason:**') || task.type === 'JudgeDecisionReviewTask') ? null : COPY.LEGACY_APPEALS_VLJ_DETAILS_INSTRUCTIONS} {formatBreaks(task.instructions[0])}
    From 8431859870dd744157e8b91b2bf7623a4e9652c0 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:47:30 -0400 Subject: [PATCH 177/203] spec fix for investigate_scm_cant_reassign_spec (#19606) --- spec/fixes/investigate_scm_cant_reassign_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/fixes/investigate_scm_cant_reassign_spec.rb b/spec/fixes/investigate_scm_cant_reassign_spec.rb index 3e7fde1ef67..3900d1841e1 100644 --- a/spec/fixes/investigate_scm_cant_reassign_spec.rb +++ b/spec/fixes/investigate_scm_cant_reassign_spec.rb @@ -32,7 +32,9 @@ click_dropdown(prompt: "Select a user", text: "Other") # Clicking on "Other" and starting to type "TALAM" shows the attorney. - click_dropdown(prompt: "Select a user", text: attorney_user.full_name) + within all(".cf-select")[2] do + click_dropdown(prompt: "Select", text: attorney_user.full_name) + end fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "\nSCM user reassigning to different attorney") # Clicking Submit button shows an "Error assigning tasks" error banner in the modal From 0343636e2b561b0251734b9ba7f1d58a6d9f7997 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:46:58 -0400 Subject: [PATCH 178/203] fixed rspec for blocked scm (#19617) --- .../blocked_special_case_movement_task_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/models/tasks/special_case_movement/blocked_special_case_movement_task_spec.rb b/spec/models/tasks/special_case_movement/blocked_special_case_movement_task_spec.rb index 9ceec1c388a..4e02a257cd9 100644 --- a/spec/models/tasks/special_case_movement/blocked_special_case_movement_task_spec.rb +++ b/spec/models/tasks/special_case_movement/blocked_special_case_movement_task_spec.rb @@ -8,7 +8,7 @@ let(:cm_user) { create(:user) } let(:cancellation_instructions) { "Cancelling task" } let(:assign_instructions) { "Assigning task" } - let(:instructions) { [cancellation_instructions, assign_instructions] } + let(:instructions) { [assign_instructions, cancellation_instructions] } subject do BlockedSpecialCaseMovementTask.create!(appeal: appeal, @@ -29,7 +29,7 @@ expect { subject }.not_to raise_error open_tasks.each do |task| expect(task.reload.status).to eq(Constants.TASK_STATUSES.cancelled) - expect(task.reload.instructions).to eq([cancellation_instructions]) + expect(task.reload.instructions).to eq(["**Reason:**\n" + cancellation_instructions]) end end end From 0f8caab177b317edd96383707ac4fe1dd50ada0c Mon Sep 17 00:00:00 2001 From: cacevesva <109166981+cacevesva@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:00:39 -0700 Subject: [PATCH 179/203] Update specs for queue repository (#19604) * Update specs for queue repository * Remove created_in_vacols_date from reassign case to attorney in spec * Update queue repository subject judge_vacols_user_id * Add safe navigation * Resolved vacols id and date valid failures * Added comment on pending subject raise that is now invalid because created_in_vacols_date does not exist --- app/repositories/queue_repository.rb | 4 ++-- spec/repositories/queue_repository_spec.rb | 24 ++++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/repositories/queue_repository.rb b/app/repositories/queue_repository.rb index 41ac5bfaa8a..51eadcb37cf 100644 --- a/app/repositories/queue_repository.rb +++ b/app/repositories/queue_repository.rb @@ -61,12 +61,12 @@ def reassign_case_to_judge!(vacols_id:, assigned_by:, created_in_vacols_date:, j # In attorney checkout, we are automatically selecting the judge who # assigned the attorney the case. But we also have a drop down for the # attorney to select a different judge if they are checking it out to someone else - if decass_record.deadusr != judge_vacols_user_id.vacols_uniq_id + if decass_record.deadusr != judge_vacols_user_id&.vacols_uniq_id BusinessMetrics.record(service: :queue, name: "reassign_case_to_different_judge") end update_decass_record(decass_record, decass_attrs) # update location with the judge's slogid - decass_record.update_vacols_location!(judge_vacols_user_id.vacols_uniq_id) + decass_record.update_vacols_location!(judge_vacols_user_id&.vacols_uniq_id) true end diff --git a/spec/repositories/queue_repository_spec.rb b/spec/repositories/queue_repository_spec.rb index eda8f87fc91..ac2a6dfb908 100644 --- a/spec/repositories/queue_repository_spec.rb +++ b/spec/repositories/queue_repository_spec.rb @@ -137,8 +137,9 @@ def vacols_id subject do QueueRepository.reassign_case_to_judge!( vacols_id: vacols_case.bfkey, + assigned_by: judge, created_in_vacols_date: date_added, - judge_vacols_user_id: judge.vacols_uniq_id, + judge_vacols_user_id: judge, decass_attrs: decass_attrs ) end @@ -223,8 +224,7 @@ def vacols_id QueueRepository.reassign_case_to_attorney!( judge: judge, attorney: attorney, - vacols_id: vacols_case.bfkey, - created_in_vacols_date: date_added + vacols_id: vacols_case.bfkey ) end @@ -248,14 +248,14 @@ def vacols_id subject expect(vacols_case.reload.bfcurloc).to eq attorney_staff.slogid expect(vacols_case.bfattid).to eq attorney_staff.sattyid - decass = VACOLS::Decass.where(defolder: vacols_case.bfkey).first + decass = VACOLS::Decass.where(defolder: vacols_case.bfkey) expect(decass.present?).to eq true - expect(decass.deatty).to eq attorney_staff.sattyid - expect(decass.deteam).to eq attorney_staff.stitle[0..2] - expect(decass.demdusr).to eq judge_staff.slogid - expect(decass.deadtim).to eq date_added - expect(decass.dedeadline).to eq VacolsHelper.local_date_with_utc_timezone + 30.days - expect(decass.deassign).to eq VacolsHelper.local_time_with_utc_timezone + expect(decass.last.deatty).to eq attorney_staff.sattyid + expect(decass.last.deteam).to eq attorney_staff.stitle[0..2] + expect(decass.last.demdusr).to eq judge_staff.slogid + expect(decass.first.deadtim).to eq date_added + expect(decass.last.dedeadline).to eq VacolsHelper.local_date_with_utc_timezone + 30.days + expect(decass.last.deassign).to eq VacolsHelper.local_time_with_utc_timezone end end @@ -263,7 +263,9 @@ def vacols_id let(:date_added) { "2018-04-18".to_date } let!(:decass) { create(:decass, defolder: vacols_case.bfkey, deadtim: "2014-04-18".to_date) } - it "should raise Caseflow::Error::QueueRepositoryError" do + xit "should raise Caseflow::Error::QueueRepositoryError" do + # QueueRepository.reassign_case_to_attorney! No longer has the created_in_vacols_date: date_added + # This line I marked to pending but may need to be omitted all together. expect { subject }.to raise_error(Caseflow::Error::QueueRepositoryError) end end From 3e2c84e7713e0bc4d73ae14f8816ee5bf98e03a6 Mon Sep 17 00:00:00 2001 From: vinner57 <128258952+vinner57@users.noreply.github.com> Date: Fri, 29 Sep 2023 17:20:16 -0400 Subject: [PATCH 180/203] spec fix for cavc_task_queue_spec (#19613) * spec fix for cavc_task_queue_spec * updating to assign * added back split assignee --------- Co-authored-by: Calvin Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/AssignToView.jsx | 13 +++--- spec/feature/queue/cavc_task_queue_spec.rb | 46 ++++++++++++---------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index 5151ef9d007..b3776967da2 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -140,7 +140,7 @@ class AssignToView extends React.Component { const assignTaskSuccessMessage = { title: taskActionData(this.props).message_title ? sprintf(taskActionData(this.props).message_title, caseNameListItem(), - this.getAssignee()) : sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE, this.getAssignee()), + this.getAssignee(isTeamAssign ? 'Organization' : 'User')) : sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE, this.getAssignee(isTeamAssign ? 'Organization' : 'User')), detail: taskActionData(this.props).message_detail || null }; @@ -171,7 +171,7 @@ class AssignToView extends React.Component { }); }; - getAssignee = () => { + getAssignee = (AssigneeType) => { let assignee = 'person'; if (this.isVHAAssignToRegional()) { @@ -183,10 +183,11 @@ class AssignToView extends React.Component { assignee = opt.label; } }); + const splitAssignee = assignee.split(' '); - if (splitAssignee.length >= 3) { - assignee = `${splitAssignee[0]} ${splitAssignee[2]}`; + if (splitAssignee.length === 3 && AssigneeType === 'User') { + assignee = `${splitAssignee[0] } ${ splitAssignee[2]}`; } return assignee; @@ -218,8 +219,8 @@ class AssignToView extends React.Component { }; const titleValue = task.type === 'JudgeDecisionReviewTask' ? - sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()) : - sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE_SCM, assignedByListItem(), this.getAssignee()); + sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee('User')) : + sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE_SCM, assignedByListItem(), this.getAssignee('User')); const successMsg = { title: titleValue }; diff --git a/spec/feature/queue/cavc_task_queue_spec.rb b/spec/feature/queue/cavc_task_queue_spec.rb index 40342714eab..0491c852dbd 100644 --- a/spec/feature/queue/cavc_task_queue_spec.rb +++ b/spec/feature/queue/cavc_task_queue_spec.rb @@ -565,8 +565,8 @@ find(".cf-select__control", text: org_admin.full_name).click find("div", class: "cf-select__option", text: org_nonadmin.full_name).click fill_in "taskInstructions", with: "Confirm info and send letter to Veteran." - click_on "Submit" - expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % org_nonadmin.full_name + click_on "Assign" + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % org_nonadmin.full_name end step "assigned user can reassign task" do @@ -579,11 +579,13 @@ expect(page).to have_content Constants.TASK_ACTIONS.REASSIGN_TO_PERSON.label find("div", class: "cf-select__option", text: Constants.TASK_ACTIONS.REASSIGN_TO_PERSON.label).click - find(".cf-select__control", text: COPY::ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER).click + within all(".cf-select")[1] do + find(".cf-select__control", text: COPY::ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER).click find("div", class: "cf-select__option", text: org_nonadmin2.full_name).click + end fill_in "taskInstructions", with: "Going fishing. Handing off to you." - click_on "Submit" - expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % org_nonadmin2.full_name + click_on "Assign" + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, task.appeal.veteran_full_name, org_nonadmin2.full_name)) end end end @@ -597,7 +599,7 @@ click_dropdown(text: Constants.TASK_ACTIONS.SEND_TO_TRANSLATION_BLOCKING_DISTRIBUTION.label) fill_in "taskInstructions", with: "Please translate the documents in spanish" click_on "Assign" - expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % Translation.singleton.name + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % Translation.singleton.name end end @@ -610,18 +612,18 @@ click_dropdown(text: Constants.TASK_ACTIONS.SEND_TO_TRANSCRIPTION_BLOCKING_DISTRIBUTION.label) fill_in "taskInstructions", with: "Please transcribe the hearing on record for this appeal" - click_on "Submit" - expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % TranscriptionTeam.singleton.name + click_on "Assign" + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % TranscriptionTeam.singleton.name click_dropdown(text: Constants.TASK_ACTIONS.SEND_TO_PRIVACY_TEAM_BLOCKING_DISTRIBUTION.label) fill_in "taskInstructions", with: "Please handle the freedom of intformation act request for this appeal" - click_on "Submit" - expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % PrivacyTeam.singleton.name + click_on "Assign" + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % PrivacyTeam.singleton.name click_dropdown(text: Constants.TASK_ACTIONS.SEND_IHP_TO_COLOCATED_BLOCKING_DISTRIBUTION.label) fill_in "taskInstructions", with: "Have veteran's POA write an informal hearing presentation for this appeal" - click_on "Submit" - expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % Colocated.singleton.name + click_on "Assign" + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % Colocated.singleton.name end end @@ -708,8 +710,8 @@ # Assign an admin action that DOES block the sending of the 90 day letter click_dropdown(text: Constants.TASK_ACTIONS.CLARIFY_POA_BLOCKING_CAVC.label) fill_in "taskInstructions", with: "Please find out the POA for this veteran" - click_on "Submit" - expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % CavcLitigationSupport.singleton.name + click_on "Assign" + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % CavcLitigationSupport.singleton.name # Ensure there are no actions on the send letter task as it is blocked by poa clarification active_task_rows = page.find("#currently-active-tasks").find_all("tr") @@ -793,8 +795,8 @@ find(".cf-select__control", text: org_admin.full_name).click find("div", class: "cf-select__option", text: org_nonadmin.full_name).click fill_in "taskInstructions", with: "Assigning to user." - click_on "Submit" - expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % org_nonadmin.full_name + click_on "Assign" + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % org_nonadmin.full_name end step "assigned user adds schedule hearing task" do @@ -804,8 +806,8 @@ click_dropdown(text: Constants.TASK_ACTIONS.SEND_TO_HEARINGS_BLOCKING_DISTRIBUTION.label) fill_in "taskInstructions", with: "Please transcribe the hearing on record for this appeal" - click_on "Submit" - expect(page).to have_content COPY::ASSIGN_TASK_SUCCESS_MESSAGE % Bva.singleton.name + click_on "Assign" + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % Bva.singleton.name end step "assigned user adds denied extension request" do @@ -854,11 +856,13 @@ expect(timed_hold_task.parent.assigned_to).to eq org_nonadmin click_dropdown(text: Constants.TASK_ACTIONS.REASSIGN_TO_PERSON.label) - find(".cf-select__control", text: COPY::ASSIGN_WIDGET_DROPDOWN_PLACEHOLDER).click + within all(".cf-select")[1] do + find(".cf-select__control", text: COPY::ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER).click + end find("div", class: "cf-select__option", text: org_nonadmin2.full_name).click fill_in "taskInstructions", with: "Reassigning to org_nonadmin3 to check that TimedHoldTask moves." - click_on "Submit" - expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % org_nonadmin2.full_name + click_on "Assign" + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, task.appeal.veteran_full_name, org_nonadmin2.full_name)) # open timed_hold_task is moved to new parent task assigned to org_nonadmin2 expect(timed_hold_task.reload.parent.assigned_to).to eq org_nonadmin2 From 429e9386cf6a281bef900a805cc86771c31a51ad Mon Sep 17 00:00:00 2001 From: Kevma50287 <104021955+Kevma50287@users.noreply.github.com> Date: Fri, 29 Sep 2023 17:58:48 -0400 Subject: [PATCH 181/203] APPEALS-31791 Updated task controller and rspecs (#19620) * APPEALS-31791 Updated task controller and rspecs * Fix the array type error for condition --------- Co-authored-by: Christopher Aceves Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/controllers/tasks_controller.rb | 6 +++++- spec/feature/queue/vha_camo_assignment_spec.rb | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 4c7a0d90dd8..d6df6cab207 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -93,7 +93,11 @@ def create tasks << valid_task_classes[task_type.to_sym].create_many_from_params(param_group, current_user) end # This should be the JudgeDecisionReviewTask - parent_task = Task.find_by(id: params[:tasks]&.first[:parent_id]) if params[:tasks]&.first[:type] == "AttorneyRewriteTask" + parent_task = if params[:tasks].is_a?(Array) && params[:tasks]&.first[:type] == "AttorneyRewriteTask" + Task.find_by(id: params[:tasks].first[:parent_id]) + elsif !params[:tasks].is_a?(Array) && params[:tasks][:type] == "AttorneyRewriteTask" + Task.find_by(id: params[:tasks][:parent_id]) + end if parent_task&.appeal&.is_a?(LegacyAppeal) QueueRepository.reassign_decass_to_attorney!( judge: parent_task.assigned_to, diff --git a/spec/feature/queue/vha_camo_assignment_spec.rb b/spec/feature/queue/vha_camo_assignment_spec.rb index 154fe32c34e..ee526f0489c 100644 --- a/spec/feature/queue/vha_camo_assignment_spec.rb +++ b/spec/feature/queue/vha_camo_assignment_spec.rb @@ -69,7 +69,6 @@ step "page errors when cases aren't selected" do safe_click ".cf-select" click_dropdown(text: vha_po_org.name) - click_on "Assign 0 cases" expect(page).to have_content(COPY::ASSIGN_WIDGET_NO_TASK_TITLE) expect(page).to have_content(COPY::ASSIGN_WIDGET_NO_TASK_DETAIL) @@ -77,6 +76,7 @@ step "page errors when a program office isn't selected" do visit "/queue/#{camo_user.css_id}/assign?role=camo" + refresh while page.has_text?("Something went wrong") scroll_to(".usa-table-borderless") page.find(:css, "input[name='#{task_first.id}']", visible: false).execute_script("this.click()") page.find(:css, "input[name='#{task_last.id}']", visible: false).execute_script("this.click()") @@ -89,7 +89,6 @@ step "cases are assignable when a program office and tasks are selected" do safe_click ".cf-select" click_dropdown(text: vha_po_org.name) - click_on "Assign 2 cases" expect(page).to have_content("Assigned 2 tasks to #{vha_po_org.name}") expect(page).to have_content("Assign 3 Cases") @@ -100,6 +99,7 @@ scenario "It has the correct body text and column headings" do visit "/queue/#{camo_user.css_id}/assign?role=camo" + refresh while page.has_text?("Something went wrong") html_table_headings = all("th").map(&:text).reject(&:empty?).compact expect(page).to have_content "Cases to Assign" expect(html_table_headings).to eq(column_heading_names) @@ -111,7 +111,7 @@ let(:filter_column_label_text) { "Issue Type" } scenario "CAMO User can sort by issue types" do visit "/queue/#{camo_user.css_id}/assign?role=camo" - + refresh while page.has_text?("Something went wrong") # Sort by issue type find("[aria-label='Sort by Issue Type']").click @@ -133,6 +133,7 @@ scenario "CAMO User can filter by issue types" do visit "/queue/#{camo_user.css_id}/assign?role=camo" + refresh while page.has_text?("Something went wrong") # Verify Spina Bifida is present on the page expect(page).to have_content("Spina Bifida Treatment (Non-Compensation)") From e1445e870e624f920f7f291a11a3f46a7e289b35 Mon Sep 17 00:00:00 2001 From: MuhGrayVA <98366428+MuhGrayVA@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:07:15 -0400 Subject: [PATCH 182/203] Seed file update for max ticknum value in VAOLS folder updating how we evaluate max ticknum in folder table as somone thought it was smart to store numerical IDs in a varchar2 --- lib/tasks/seed_legacy_appeal_tasks.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index 27030a866a2..fffda219d21 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -34,7 +34,7 @@ namespace :db do else false end cases = Array.new(num_appeals_to_create).each_with_index.map do - key = VACOLS::Folder.maximum(:ticknum).next + key = VACOLS::Folder.find_by_sql("SELECT max(to_number(ticknum)) as maxtick FROM FOLDER").first.maxtick.next Generators::Vacols::Case.create( decass_creation: decass_creation, From 40f1dd662fbb06db85ad5434f97bad6a6df5183e Mon Sep 17 00:00:00 2001 From: MuhGrayVA <98366428+MuhGrayVA@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:14:22 -0400 Subject: [PATCH 183/203] Added UAT conditional check --- lib/tasks/seed_legacy_appeal_tasks.rake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index fffda219d21..2fef4000da2 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -34,7 +34,11 @@ namespace :db do else false end cases = Array.new(num_appeals_to_create).each_with_index.map do - key = VACOLS::Folder.find_by_sql("SELECT max(to_number(ticknum)) as maxtick FROM FOLDER").first.maxtick.next + if Rails.env.development? || Rails.env.test? + key = VACOLS::Folder.maximum(:ticknum).next + else + key = VACOLS::Folder.find_by_sql("SELECT max(to_number(ticknum)) as maxtick FROM FOLDER").first.maxtick.next + end Generators::Vacols::Case.create( decass_creation: decass_creation, From 1911ee7dfbbfda0e2a546a7ff502cd3ecf398d0d Mon Sep 17 00:00:00 2001 From: cacevesva <109166981+cacevesva@users.noreply.github.com> Date: Mon, 2 Oct 2023 09:24:31 -0700 Subject: [PATCH 184/203] spec fix in ama_queue_spec (#19575) * spec fix in ama_queue_spec * ama_queue_spec fix 9-27-2023 * Fix error in spec --------- Co-authored-by: Kamala Madamanchi Co-authored-by: piedram --- client/COPY.json | 4 +- spec/feature/queue/ama_queue_spec.rb | 59 ++++++++++++++++------------ 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/client/COPY.json b/client/COPY.json index b18a7082166..7fd82e2a970 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -670,9 +670,9 @@ "PULAC_CERULLO_REMINDER_MODAL_OPT_FALSE": "No, continue sending to Dispatch", "PULAC_CERULLO_REMINDER_MODAL_OPT_TRUE": "Yes, notify Pulac Cerullo team of jurisdictional conflict", "ASSIGN_TASK_SUCCESS_MESSAGE": "Task assigned to %s", - "ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE": "You have successfully reassigned this task to %s", - "REASSIGN_TASK_SUCCESS_MESSAGE_SCM": "You have successfully assigned %s’s case to %s", + "ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE": "You have successfully reassigned this task to %s", "REASSIGN_TASK_SUCCESS_MESSAGE": "You have successfully reassigned this task to %s", + "REASSIGN_TASK_SUCCESS_MESSAGE_SCM": "You have successfully assigned %s’s case to %s", "HEARING_ASSIGN_TASK_SUCCESS_MESSAGE_DETAIL": "You can continue to assign tasks to yourself and others using this queue.", "ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ": "You have successfully reassigned %s’s case to %s", "ASSIGN_TASK_SUCCESS_MESSAGE_MOVE_LEGACY_APPEALS_VLJ_MESSAGE_DETAIL": " All blocking tasks have been cancelled.", diff --git a/spec/feature/queue/ama_queue_spec.rb b/spec/feature/queue/ama_queue_spec.rb index c73c0447837..3285739c771 100644 --- a/spec/feature/queue/ama_queue_spec.rb +++ b/spec/feature/queue/ama_queue_spec.rb @@ -259,9 +259,9 @@ def valid_document_id find("div", class: "cf-select__option", text: other_user.full_name).click expect(page).to have_content(existing_instruction) - click_on "Submit" + click_on COPY::MODAL_ASSIGN_BUTTON - expect(page).to have_content("Task assigned to #{other_user_name}") + expect(page).to have_content(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, other_user.full_name) expect(translation_task.reload.status).to eq("on_hold") visit "/organizations/#{translation_organization.url}" @@ -270,11 +270,12 @@ def valid_document_id find(".cf-select__control", text: "Select an action").click find("div", class: "cf-select__option", text: Constants.TASK_ACTIONS.REASSIGN_TO_PERSON.to_h[:label]).click - fill_in "taskInstructions", with: instructions - click_on "Submit" + click_on COPY::MODAL_ASSIGN_BUTTON - expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE % user_name + expect(page).to have_content( + format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeals[0].veteran.first_name + " " + appeals[0].veteran.last_name, user_name) + ) old_task = translation_task.reload.children.find { |task| task.assigned_to == other_user } expect(old_task.status).to eq(Constants.TASK_STATUSES.cancelled) @@ -297,9 +298,9 @@ def valid_document_id find("div", class: "cf-select__option", text: other_organization.name).click fill_in "taskInstructions", with: instructions - click_on "Submit" + click_on COPY::MODAL_ASSIGN_BUTTON - expect(page).to have_content("Task assigned to #{other_organization.name}") + expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE % other_organization.name) expect(Task.last.instructions.first).to eq(instructions) end @@ -463,10 +464,9 @@ def judge_assign_to_attorney click_dropdown(prompt: "Select an action", text: "Assign to attorney") click_dropdown(prompt: "Select a user", text: attorney_user.full_name) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on "Assign" - expect(page).to have_content("Assigned 1 task to #{attorney_user.full_name}") + expect(page).to have_content("You have successfully assigned Tom Brady's case to #{attorney_user.full_name}") end it "judge can return report to attorney for corrections" do @@ -550,7 +550,7 @@ def judge_assign_to_attorney click_on "Assign" - expect(page).to have_content("Task assigned to #{attorney_user.full_name}") + expect(page).to have_content("You have successfully reassigned this task to #{attorney_user.full_name}") end step "attorney corrects case and returns it to the judge" do @@ -674,7 +674,7 @@ def judge_assign_to_attorney click_on "Assign" - expect(page).to have_content("Task assigned to #{attorney_user.full_name}") + expect(page).to have_content("You have successfully reassigned this task to #{attorney_user.full_name}") end step "attorney corrects case and returns it to the judge" do @@ -740,12 +740,15 @@ def judge_assign_to_attorney click_on veteran_full_name click_dropdown(prompt: "Select an action", text: "Re-assign to a judge") - click_dropdown(prompt: "Select a user", text: judge_user2.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_user2.full_name) + end fill_in "taskInstructions", with: "Going on leave, please manage this case" - click_on "Submit" - - expect(page).to have_content("Task reassigned to #{judge_user2.full_name}") + click_on "Assign" + # binding.pry + # expect(page).to have_content("Task reassigned to #{judge_user2.full_name}") + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, "Andrea Harless")) end step "judge2 has the case in their queue" do User.authenticate!(user: judge_user2) @@ -763,24 +766,27 @@ def judge_assign_to_attorney it "judge can reassign the review judge tasks to another judge" do step "judge reviews case and assigns a task to an attorney" do visit "/queue" + # binding.pry expect(page).to have_content(COPY::USER_QUEUE_PAGE_TABLE_TITLE) find(".cf-dropdown-trigger", text: COPY::CASE_LIST_TABLE_QUEUE_DROPDOWN_LABEL).click expect(page).to have_content(format(COPY::JUDGE_ASSIGN_DROPDOWN_LINK_LABEL, judge_user.css_id)) - click_on format(COPY::JUDGE_ASSIGN_DROPDOWN_LINK_LABEL, judge_user.css_id) + click_on format(COPY::JUDGE_ASSIGN_DROPDOWN_LINK_LABEL, judge_user.css_id) click_on veteran_full_name # wait for page to load with veteran name expect(page).to have_content(veteran_full_name) click_dropdown(prompt: "Select an action", text: "Assign to attorney") - click_dropdown(prompt: "Select a user", text: attorney_user.full_name) + # click_dropdown(prompt: "Select a user", text: attorney_user.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: attorney_user.full_name) + end fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") click_on "Assign" - - expect(page).to have_content("Assigned 1 task to #{attorney_user.full_name}") + expect(page).to have_content("You have successfully assigned Tom Brady's case to #{attorney_user.full_name}") end step "attorney completes task and returns the case to the judge" do @@ -834,7 +840,6 @@ def judge_assign_to_attorney expect(page).to have_content("Submit to judge:", wait: 10) fill_in "notes", with: "all done" click_on "Continue" - expect(page).to have_content( "Thank you for drafting #{veteran_full_name}'s decision. It's been "\ "sent to #{judge_user.full_name} for review." @@ -849,12 +854,16 @@ def judge_assign_to_attorney click_on veteran_full_name click_dropdown(prompt: "Select an action", text: "Re-assign to a judge") - click_dropdown(prompt: "Select a user", text: judge_user2.full_name) + # click_dropdown(prompt: "Select a user", text: judge_user2.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_user2.full_name) + end fill_in "taskInstructions", with: "Going on leave, please manage this case" - click_on "Submit" + click_on "Assign" + expect(page).to have_content COPY::REASSIGN_TASK_SUCCESS_MESSAGE, "Andrea Harless" - expect(page).to have_content("Task reassigned to #{judge_user2.full_name}") + # expect(page).to have_content("Task reassigned to #{judge_user2.full_name}") end step "judge2 has the case in their queue" do @@ -908,7 +917,7 @@ def judge_assign_to_attorney text: Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.label ) fill_in("taskInstructions", with: "instructions here") - click_on(COPY::MODAL_SUBMIT_BUTTON) + click_on "Assign" expect(page).to have_content(COPY::USER_QUEUE_PAGE_TABLE_TITLE) end @@ -926,7 +935,7 @@ def judge_assign_to_attorney text: Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.label ) fill_in("taskInstructions", with: "instructions here") - click_on(COPY::MODAL_SUBMIT_BUTTON) + click_on(COPY::MODAL_ASSIGN_BUTTON) expect(page).to have_content(COPY::USER_QUEUE_PAGE_TABLE_TITLE) end end From 92fb9aa60a76344cacd96871d85a0e1fc06ca7d1 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:26:20 -0400 Subject: [PATCH 185/203] fixes rspec errors in judge assignment spec (#19622) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/feature/queue/judge_assignment_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/feature/queue/judge_assignment_spec.rb b/spec/feature/queue/judge_assignment_spec.rb index 52b85c5769d..734e2683ea1 100644 --- a/spec/feature/queue/judge_assignment_spec.rb +++ b/spec/feature/queue/judge_assignment_spec.rb @@ -342,7 +342,7 @@ fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") click_on("Assign") - expect(page).to have_content("You have successfully assigned 1 case to #{judge_two.full_name}") + expect(page).to have_content("You have successfully assigned #{appeal_one.veteran_first_name} #{appeal_one.veteran_last_name}'s case to #{judge_two.full_name}") end end @@ -359,7 +359,7 @@ fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") click_on("Assign") - expect(page).to have_content("You have successfully assigned 1 case to #{judge_one.full_name}") + expect(page).to have_content("You have successfully assigned #{appeal_one.veteran_first_name} #{appeal_one.veteran_last_name}'s case to #{judge_one.full_name}") end end From 5b6e0a81779793c07408fef7f09749d84975e820 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:49:49 -0400 Subject: [PATCH 186/203] fixes rspecs in mail_task_spec.rb (#19623) --- spec/feature/queue/mail_task_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/feature/queue/mail_task_spec.rb b/spec/feature/queue/mail_task_spec.rb index 48ad3c9ab20..6078fd996c1 100644 --- a/spec/feature/queue/mail_task_spec.rb +++ b/spec/feature/queue/mail_task_spec.rb @@ -41,9 +41,9 @@ text = Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.label click_dropdown(prompt: prompt, text: text) fill_in("taskInstructions", with: "instructions") - click_button("Submit") + click_button("Assign") - expect(page).to have_content(format(COPY::ASSIGN_TASK_SUCCESS_MESSAGE, user.full_name)) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE, user.full_name)) expect(page.current_path).to eq("/queue") new_tasks = aod_team_task.children @@ -120,7 +120,7 @@ find("button", text: COPY::CHANGE_TASK_TYPE_SUBHEAD).click # Instructions field is required - expect(page).to have_content(COPY::FORM_ERROR_FIELD_REQUIRED) + expect(page).to have_content(COPY::INSTRUCTIONS_ERROR_FIELD_REQUIRED) # Add instructions and try again new_instructions = generate_words(5) From eef1594f683937fd97f54cb208b3d7eb29b0130b Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 2 Oct 2023 13:15:29 -0400 Subject: [PATCH 187/203] added details label to task instructions in spec (#19624) --- spec/feature/queue/case_details_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/feature/queue/case_details_spec.rb b/spec/feature/queue/case_details_spec.rb index 82c8c6383b9..72ff2526e66 100644 --- a/spec/feature/queue/case_details_spec.rb +++ b/spec/feature/queue/case_details_spec.rb @@ -1037,7 +1037,7 @@ def wait_for_page_render expect(page).to have_content("TASK\n#{on_hold_task.label}") find("button", text: COPY::TASK_SNAPSHOT_VIEW_TASK_INSTRUCTIONS_LABEL).click - expect(page).to have_content("TASK INSTRUCTIONS\n#{on_hold_task.instructions[0].squeeze(' ').strip}") + expect(page).to have_content("TASK INSTRUCTIONS\nDetails:\n#{on_hold_task.instructions[0].squeeze(' ').strip}") expect(page).to have_content("#{assigner_name.first[0]}. #{assigner_name.last}") expect(Task.find(on_hold_task.id).status).to eq("on_hold") From 262d0b2e3cd9d43f908618fcc6cd54ff8c375634 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 2 Oct 2023 13:30:33 -0400 Subject: [PATCH 188/203] added middle name back to banner expectation (#19625) --- spec/feature/queue/colocated_checkout_flow_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/feature/queue/colocated_checkout_flow_spec.rb b/spec/feature/queue/colocated_checkout_flow_spec.rb index b32bc338232..486205c88f3 100644 --- a/spec/feature/queue/colocated_checkout_flow_spec.rb +++ b/spec/feature/queue/colocated_checkout_flow_spec.rb @@ -141,7 +141,7 @@ click_on COPY::MODAL_ASSIGN_BUTTON expect(page).to have_current_path("/queue") - expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE, 'CAVC Support') + expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE, "CAVC Litigation Support") expect(translation_action.reload.status).to eq "on_hold" end end From 02d18228a880035af4211dadcd4d313a372b1104 Mon Sep 17 00:00:00 2001 From: SanthiParakal133 <132940479+SanthiParakal133@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:55:38 -0400 Subject: [PATCH 189/203] update the rspec (#19628) --- spec/models/legacy_tasks/judge_legacy_task_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/models/legacy_tasks/judge_legacy_task_spec.rb b/spec/models/legacy_tasks/judge_legacy_task_spec.rb index 683fa7b0ac9..f635f9b8dc3 100644 --- a/spec/models/legacy_tasks/judge_legacy_task_spec.rb +++ b/spec/models/legacy_tasks/judge_legacy_task_spec.rb @@ -11,11 +11,13 @@ let(:assigned_by_last_name) { "Snuffy" } let(:reassigned_to_judge_date) { nil } let(:assigned_to_attorney_date) { nil } + let(:bfcurloc) { "64" } + let(:vacols_case) { create(:case, bfcurloc: bfcurloc) } let(:legacy_judge_task) do JudgeLegacyTask.from_vacols( case_assignment, - LegacyAppeal.create(vacols_id: vacols_id), - judge + LegacyAppeal.create(vacols_id: vacols_id, case_record: vacols_case), + judge, ) end let(:case_assignment) do From 859be7555127fce467e699a233a456d4d323507b Mon Sep 17 00:00:00 2001 From: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:19:21 -0500 Subject: [PATCH 190/203] J hoang/appeals 24914 code climate duplicates (#19626) * fix code climate duplicates * revert task.rb verify_user_can_create methods * delete unused component --------- Co-authored-by: Jonathan Hoang Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/task.rb | 17 +- client/app/queue/QueueActions.js | 55 ++-- client/app/queue/ReAssignToJudgeLegacy.jsx | 293 ------------------ .../legacy_tasks/judge_legacy_task_spec.rb | 11 - 4 files changed, 21 insertions(+), 355 deletions(-) delete mode 100644 client/app/queue/ReAssignToJudgeLegacy.jsx diff --git a/app/models/task.rb b/app/models/task.rb index fc1bdd692ec..0706957fb38 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -189,6 +189,7 @@ def verify_user_can_create!(user, parent) end&.any? do |action| action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option.dig(:value) == name } end + if !parent&.actions_allowable?(user) || !can_create user_description = user ? "User #{user.id}" : "nil User" parent_description = parent ? " from #{parent.class.name} #{parent.id}" : "" @@ -276,22 +277,6 @@ def special_case_for_legacy(parent_task, params, user) end end - def create_parent_task(params, user) - parent_task = {} - if (params[:appeal_type] == "LegacyAppeal") && (params[:legacy_task_type] == "AttorneyLegacyTask") - if params[:type] == "SpecialCaseMovementTask" || params[:type] == "BlockedSpecialCaseMovementTask" - parent_task = LegacyWorkQueue.tasks_by_appeal_id(params[:external_id])[0] - verify_user_can_create_legacy!(user, parent_task) - parent_task = Task.find(params[:parent_id]) - end - else - parent_task = Task.find(params[:parent_id]) - fail Caseflow::Error::ChildTaskAssignedToSameUser if parent_of_same_type_has_same_assignee(parent_task, params) - - verify_user_can_create!(user, parent_task) - end - parent_task - end def cancel_blocking_task_legacy(params, parent_task) parent_task.children.each { |current_task| search_for_blocking(params[:instructions], current_task) } diff --git a/client/app/queue/QueueActions.js b/client/app/queue/QueueActions.js index 20c9448cf14..a110b5f9e38 100644 --- a/client/app/queue/QueueActions.js +++ b/client/app/queue/QueueActions.js @@ -564,20 +564,7 @@ export const reassignTasksToUser = ({ }) => (dispatch) => Promise.all(tasks.map((oldTask) => { let params, url; - if (oldTask.appealType === 'LegacyAppeal' && (oldTask.type === 'AttorneyTask' || oldTask.type === 'AttorneyRewriteTask')) { - url = `/tasks/${oldTask.taskId}`; - params = { - data: { - task: { - reassign: { - assigned_to_id: assigneeId, - assigned_to_type: 'User', - instructions - } - } - } - }; - + const makeRequest = () => { ApiUtil.patch(url, params). then((resp) => resp.body). then((resp) => { @@ -599,6 +586,24 @@ export const reassignTasksToUser = ({ dispatch(setOvertime(oldTask.externalAppealId, false)); }); + }; + + if (oldTask.appealType === 'LegacyAppeal' && + (oldTask.type === 'AttorneyTask' || oldTask.type === 'AttorneyRewriteTask')) { + url = `/tasks/${oldTask.taskId}`; + params = { + data: { + task: { + reassign: { + assigned_to_id: assigneeId, + assigned_to_type: 'User', + instructions + } + } + } + }; + + makeRequest(); } if (oldTask.appealType === 'Appeal') { @@ -627,27 +632,7 @@ export const reassignTasksToUser = ({ }; } - return ApiUtil.patch(url, params). - then((resp) => resp.body). - then((resp) => { - dispatchOldTasks(dispatch, oldTask, resp); - - dispatch(setSelectionOfTaskOfUser({ - userId: previousAssigneeId, - taskId: oldTask.uniqueId, - selected: false - })); - - dispatch(incrementTaskCountForAttorney({ - id: assigneeId - })); - - dispatch(decrementTaskCountForAttorney({ - id: previousAssigneeId - })); - - dispatch(setOvertime(oldTask.externalAppealId, false)); - }); + return makeRequest(); })); export const legacyReassignToJudge = ({ diff --git a/client/app/queue/ReAssignToJudgeLegacy.jsx b/client/app/queue/ReAssignToJudgeLegacy.jsx deleted file mode 100644 index fab08a9132e..00000000000 --- a/client/app/queue/ReAssignToJudgeLegacy.jsx +++ /dev/null @@ -1,293 +0,0 @@ -import * as React from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; -import { withRouter } from 'react-router-dom'; -import { sprintf } from 'sprintf-js'; - -import COPY from '../../COPY'; - -import { taskById, appealWithDetailSelector } from './selectors'; - -import { onReceiveAmaTasks, legacyReassignToJudge, setOvertime } from './QueueActions'; - -import SearchableDropdown from '../components/SearchableDropdown'; -import TextareaField from '../components/TextareaField'; -import QueueFlowModal from './components/QueueFlowModal'; - -import { requestPatch, requestSave, resetSuccessMessages } from './uiReducer/uiActions'; - -import { taskActionData } from './utils'; - -const validInstructions = (instructions) => { - return instructions?.length > 0; -}; - -const selectedAction = (props) => { - const actionData = taskActionData(props); - - return actionData.selected ? actionData.options.find((option) => option.value === actionData.selected.id) : null; -}; - -const getAction = (props) => { - return props.task && props.task.availableActions.length > 0 ? selectedAction(props) : null; -}; - -class ReAssignToJudgeLegacy extends React.Component { - constructor(props) { - super(props); - - // Autofill the instruction field if assigning to a person on the team. Since they will - // probably want the instructions from the assigner. - const instructions = this.props.task.instructions; - const instructionLength = instructions ? instructions.length : 0; - let existingInstructions = ''; - - if (instructions && instructionLength > 0 && !this.props.isTeamAssign && !this.props.isReassignAction) { - existingInstructions = instructions[instructionLength - 1]; - } - - const action = selectedAction(this.props); - - this.state = { - selectedValue: action ? action.value : null, - instructions: existingInstructions - }; - } - - componentDidMount = () => this.props.resetSuccessMessages(); - - validateForm = () => { - if (this.title === COPY.BVA_INTAKE_RETURN_TO_CAREGIVER_MODAL_TITLE) { - return validInstructions(this.state.instructions); - } - - const actionData = taskActionData(this.props); - - if (actionData.body_optional) { - return this.state.selectedValue !== null; - } - - return this.state.selectedValue !== null && this.state.instructions.trim().length > 0; - }; - - submit = () => { - const { appeal, task, isReassignAction, isTeamAssign } = this.props; - - const action = getAction(this.props); - const isPulacCerullo = action && action.label === 'Pulac-Cerullo'; - - const actionData = taskActionData(this.props); - const taskType = actionData.type || 'Task'; - - const payload = { - data: { - tasks: [ - { - type: taskType, - external_id: appeal.externalId, - parent_id: actionData.parent_id || task.taskId, - assigned_to_id: this.state.selectedValue, - assigned_to_type: isTeamAssign ? 'Organization' : 'User', - instructions: this.state.instructions - } - ] - } - }; - - const assignTaskSuccessMessage = { - title: taskActionData(this.props).message_title || sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()), - detail: taskActionData(this.props).message_detail - }; - - const pulacCerulloSuccessMessage = { - title: COPY.PULAC_CERULLO_SUCCESS_TITLE, - detail: sprintf(COPY.PULAC_CERULLO_SUCCESS_DETAIL, appeal.veteranFullName) - }; - - if (isReassignAction) { - return this.reassignTask(taskType === 'JudgeLegacyAssignTask'); - } - - return this.props. - requestSave('/tasks', payload, isPulacCerullo ? pulacCerulloSuccessMessage : assignTaskSuccessMessage). - then((resp) => this.props.onReceiveAmaTasks(resp.body.tasks.data)). - catch(() => { - // handle the error from the frontend - }); - }; - - getAssignee = () => { - let assignee = 'person'; - - taskActionData(this.props).options.forEach((opt) => { - if (opt.value === this.state.selectedValue) { - assignee = opt.label; - } - }); - - return assignee; - }; - - reassignTask = (isLegacyReassignToJudge = false) => { - const task = this.props.task; - const payload = { - data: { - task: { - reassign: { - assigned_to_id: this.state.selectedValue, - assigned_to_type: 'User', - instructions: this.state.instructions - } - } - } - }; - - const successMsg = { title: sprintf(COPY.REASSIGN_TASK_SUCCESS_MESSAGE, this.getAssignee()) }; - - if (isLegacyReassignToJudge) { - return this.props.legacyReassignToJudge({ - tasks: [task], - assigneeId: this.state.selectedValue, - instructions: this.state.instructions - }, successMsg); - } - - return this.props.requestPatch(`/tasks/${task.taskId}`, payload, successMsg).then((resp) => { - this.props.onReceiveAmaTasks(resp.body.tasks.data); - if (task.type === 'JudgeAssignTask') { - this.props.setOvertime(task.externalAppealId, false); - } - }); - }; - - determineTitle = () => { - return COPY.ASSIGN_TASK_TITLE; - }; - - determinePlaceholder = (props, actionData) => { - if (actionData.modal_selector_placeholder) { - return actionData.modal_selector_placeholder; - } - - if (this.props.isTeamAssign) { - return COPY.ASSIGN_TO_TEAM_DROPDOWN; - } - - return COPY.ASSIGN_TO_USER_DROPDOWN; - }; - - render = () => { - const { assigneeAlreadySelected, highlightFormItems, task } = this.props; - - const action = getAction(this.props); - const actionData = taskActionData(this.props); - const isPulacCerullo = action && action.label === 'Pulac-Cerullo'; - - if (!task || task.availableActions.length === 0) { - return null; - } - - const modalProps = { - title: this.determineTitle(this.props, action, isPulacCerullo, actionData), - pathAfterSubmit: (actionData && actionData.redirect_after) || '/queue', - submitButtonClassNames: ['usa-button'], - button: COPY.JUDGE_ASSIGN_TASK_LABEL, - submit: this.submit, - submitDisabled: !this.validateForm() - }; - - return ( - -

    {actionData.modal_body ? actionData.modal_body : ''}

    - {!assigneeAlreadySelected && ( - - this.setState({ selectedValue: option ? option.value : null })} - options={taskActionData(this.props).options} - /> -
    -
    - )} - {!isPulacCerullo && ( - this.setState({ instructions: value })} - value={this.state.instructions} - optional={actionData.body_optional} - /> - )} - {isPulacCerullo && ( -
    -

    {COPY.PULAC_CERULLO_MODAL_BODY_1}

    -

    {COPY.PULAC_CERULLO_MODAL_BODY_2}

    -
    - )} -
    - ); - }; -} - -ReAssignToJudgeLegacy.propTypes = { - appeal: PropTypes.shape({ - externalId: PropTypes.string, - id: PropTypes.string, - veteranFullName: PropTypes.string - }), - assigneeAlreadySelected: PropTypes.bool, - highlightFormItems: PropTypes.bool, - isReassignAction: PropTypes.bool, - isTeamAssign: PropTypes.bool, - onReceiveAmaTasks: PropTypes.func, - legacyReassignToJudge: PropTypes.func, - requestPatch: PropTypes.func, - requestSave: PropTypes.func, - task: PropTypes.shape({ - instructions: PropTypes.string, - taskId: PropTypes.string, - availableActions: PropTypes.arrayOf(PropTypes.object), - externalAppealId: PropTypes.string, - type: PropTypes.string - }), - setOvertime: PropTypes.func, - resetSuccessMessages: PropTypes.func -}; - -const mapStateToProps = (state, ownProps) => { - const { highlightFormItems } = state.ui; - - return { - highlightFormItems, - task: taskById(state, { taskId: ownProps.taskId }), - appeal: appealWithDetailSelector(state, ownProps) - }; -}; - -const mapDispatchToProps = (dispatch) => - bindActionCreators( - { - requestPatch, - requestSave, - onReceiveAmaTasks, - legacyReassignToJudge, - setOvertime, - resetSuccessMessages - }, - dispatch - ); - -export default withRouter( - connect( - mapStateToProps, - mapDispatchToProps - )(ReAssignToJudgeLegacy) -); diff --git a/spec/models/legacy_tasks/judge_legacy_task_spec.rb b/spec/models/legacy_tasks/judge_legacy_task_spec.rb index f635f9b8dc3..3c154f6c12b 100644 --- a/spec/models/legacy_tasks/judge_legacy_task_spec.rb +++ b/spec/models/legacy_tasks/judge_legacy_task_spec.rb @@ -89,17 +89,6 @@ end end - context "when the user is on the special case movement team" do - let(:user) { create(:user).tap { |scm_user| SpecialCaseMovementTeam.singleton.add_user(scm_user) } } - - it "returns only case movement actions" do - expect(subject).to match_array [ - Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.to_h, - Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h - ] - end - end - context "when the user is on the special case movement team" do let(:user) { create(:user).tap { |scm_user| SpecialCaseMovementTeam.singleton.add_user(scm_user) } } From c1f3b70d836b464195122985bae18f43f2c0c7d1 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Mon, 2 Oct 2023 17:30:04 -0400 Subject: [PATCH 191/203] added vacols_uniq_id to spec users (#19630) --- app/controllers/tasks_controller.rb | 3 +-- spec/feature/hearings/change_hearing_disposition_spec.rb | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index d6df6cab207..918ae254daa 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -94,7 +94,7 @@ def create end # This should be the JudgeDecisionReviewTask parent_task = if params[:tasks].is_a?(Array) && params[:tasks]&.first[:type] == "AttorneyRewriteTask" - Task.find_by(id: params[:tasks].first[:parent_id]) + Task.find_by(id: params[:tasks].first[:parent_id]) elsif !params[:tasks].is_a?(Array) && params[:tasks][:type] == "AttorneyRewriteTask" Task.find_by(id: params[:tasks][:parent_id]) end @@ -123,7 +123,6 @@ def update Task.transaction do tasks = task.update_from_params(update_params, current_user) tasks.each { |t| return invalid_record_error(t) unless t.valid? } - tasks_hash = json_tasks(tasks.uniq) if task.appeal.class == LegacyAppeal assigned_to = if update_params&.[](:reassign)&.[](:assigned_to_id) diff --git a/spec/feature/hearings/change_hearing_disposition_spec.rb b/spec/feature/hearings/change_hearing_disposition_spec.rb index 3a2376c3c46..944ebc80482 100644 --- a/spec/feature/hearings/change_hearing_disposition_spec.rb +++ b/spec/feature/hearings/change_hearing_disposition_spec.rb @@ -2,7 +2,8 @@ RSpec.shared_examples "Change hearing disposition" do let(:current_full_name) { "Leonela Harbold" } - let(:hearing_admin_user) { create(:user, full_name: current_full_name, station_id: 101) } + let(:staff_record) { create(:staff) } + let(:hearing_admin_user) { create(:user, full_name: current_full_name, station_id: 101, vacols_uniq_id: staff_record.slogid) } let(:veteran_link_text) { "#{appeal.veteran_full_name} (#{appeal.veteran_file_number})" } let(:root_task) { create(:root_task, appeal: appeal) } let(:hearing_task) { create(:hearing_task, parent: root_task) } @@ -372,7 +373,8 @@ context "there are other hearing admin and hearings management members" do let(:other_admin_full_name) { "Remika Hanisco" } - let!(:other_admin_user) { create(:user, full_name: other_admin_full_name, station_id: 101) } + let(:staff_record) { create(:staff) } + let!(:other_admin_user) { create(:user, full_name: other_admin_full_name, station_id: 101, vacols_uniq_id: staff_record.slogid) } let(:admin_full_names) { ["Bisar Helget", "Rose Hidrogo", "Rihab Hancin", "Abby Hudmon"] } let(:mgmt_full_names) { ["Claudia Heraty", "Nouf Heigl", "Hayley Houlahan", "Bahiya Haese"] } let(:assign_instructions_text) { "This is why I'm assigning this to you." } From aafd7ac5f2436a2adcd28e64c074a38cd0bf11aa Mon Sep 17 00:00:00 2001 From: Shruthi Sibi <109103820+shruthisibi@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:32:30 -0500 Subject: [PATCH 192/203] Rspec fix - Post send initial notification letter holding task spec (#19635) --- ...post_send_initial_notification_letter_holding_task_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/models/post_send_initial_notification_letter_holding_task_spec.rb b/spec/models/post_send_initial_notification_letter_holding_task_spec.rb index bce018538fc..9291d678fc9 100644 --- a/spec/models/post_send_initial_notification_letter_holding_task_spec.rb +++ b/spec/models/post_send_initial_notification_letter_holding_task_spec.rb @@ -200,7 +200,7 @@ context "The TaskTimer for the hold period was not created yet" do it "returns the end date period" do - expect((post_task.timer_ends_at - post_task.created_at).to_i / 1.day).to eq(hold_days) + expect((post_task.timer_ends_at - post_task.created_at).round()/ 1.day).to eq(hold_days) end end @@ -216,7 +216,7 @@ it "returns the same max hold period using the TaskTimer dates" do tt = TaskTimer.find_by(task_id: post_task.id) expect(tt.task_id).to eq(post_task.id) - expect((post_task.timer_ends_at - post_task.created_at).to_i / 1.day).to eq(hold_days) + expect((post_task.timer_ends_at - post_task.created_at).round() / 1.day).to eq(hold_days) # confirm the values are being pulled from the TaskTimer calculate_max_hold = (tt.submitted_at - post_task.created_at).to_i / 1.day From fc0a681f03270b57706b7f8cc6311a3c8dc19f3b Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:47:42 -0500 Subject: [PATCH 193/203] spec fix in motion_to_vacate_spec (#19640) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/feature/queue/motion_to_vacate_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/feature/queue/motion_to_vacate_spec.rb b/spec/feature/queue/motion_to_vacate_spec.rb index b1e55cdba28..c823de018d9 100644 --- a/spec/feature/queue/motion_to_vacate_spec.rb +++ b/spec/feature/queue/motion_to_vacate_spec.rb @@ -100,8 +100,8 @@ find("div", class: "cf-select__option", text: "Assign to person").click find(".cf-modal .cf-select__control").click find("div", class: "cf-select__option", text: "Motions attorney").click - click_button(text: "Submit") - expect(page).to have_content("Task assigned to Motions attorney") + click_button(text: "Assign") + expect(page).to have_content("You have successfully reassigned this task to Motions attorney") motions_attorney_task = VacateMotionMailTask.find_by(assigned_to: motions_attorney) expect(motions_attorney_task).to_not be_nil @@ -902,7 +902,7 @@ def return_to_lit_support(disposition:) expect(vacate_stream.decision_issues.size).to eq(6) - remanded = vacate_stream.decision_issues.select { |di| di.remanded? } + remanded = vacate_stream.decision_issues.select(&:remanded?) remanded1 = remanded.find { |di| di.description.eql? "remanded test" } remanded2 = remanded.find { |di| di.description.eql? "remanded test 2" } @@ -1031,7 +1031,7 @@ def add_decision_to_issue(idx, disposition, description) "sent to #{judge.full_name} for review." ) - judge_task = vacate_stream.tasks.find_by(type: 'JudgeDecisionReviewTask'); + judge_task = vacate_stream.tasks.find_by(type: "JudgeDecisionReviewTask") expect(vacate_stream.decision_issues.size).to eq(3) expect(vacate_stream.tasks.size).to eq(4) From 6f52d7b8d5377a398dc3ce099a8e6f461b075c69 Mon Sep 17 00:00:00 2001 From: piedram <110848569+piedram@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:49:26 -0400 Subject: [PATCH 194/203] Fix error in scm_judge_assignment_spec.rb file (#19638) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../queue/scm_judge_assignment_spec.rb | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/spec/feature/queue/scm_judge_assignment_spec.rb b/spec/feature/queue/scm_judge_assignment_spec.rb index f4ca117929e..8299069dbec 100644 --- a/spec/feature/queue/scm_judge_assignment_spec.rb +++ b/spec/feature/queue/scm_judge_assignment_spec.rb @@ -140,12 +140,14 @@ expect(page).to have_content("ASSIGNED TO\n#{judge_one.css_id}") click_dropdown(propmt: "Select an action...", text: "Re-assign to a judge") - click_dropdown(prompt: "Select a user", text: judge_two.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_two.full_name) + end instructions = "#{judge_one.full_name} is on leave. Please take over this case" fill_in("taskInstructions", with: instructions) click_on("Assign") - expect(page).to have_content("Task reassigned to #{judge_two.full_name}") + expect(page).to have_content("You have successfully assigned Bob Smithrath’s case to #{judge_two.full_name}") visit "/queue/appeals/#{appeal.external_id}" expect(page).to have_content("ASSIGNED TO\n#{judge_two.css_id}") @@ -158,12 +160,14 @@ step "assign an AttorneyTask" do click_dropdown(propmt: "Select an action...", text: "Assign to attorney") click_dropdown(prompt: "Select a user", text: "Other") - click_dropdown(prompt: "Select a user", text: attorney_one.full_name) + within all(".cf-select")[2] do + click_dropdown(prompt: "Select", text: attorney_one.full_name) + end instructions = "#{judge_one.full_name} is on leave. Please draft a decision for this case" fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: instructions) - click_on("Submit") + click_on("Assign") - expect(page).to have_content("Assigned 1 task to #{attorney_one.full_name}") + expect(page).to have_content("You have successfully assigned Bob Smithrath's case to #{attorney_one.full_name}") visit "/queue/appeals/#{appeal.external_id}" expect(page).to have_content("ASSIGNED TO\n#{attorney_one.css_id}") @@ -178,10 +182,11 @@ step "reassign an AttorneyTask" do click_dropdown(propmt: "Select an action...", text: "Assign to attorney") click_dropdown(prompt: "Select a user", text: "Other") - click_dropdown(prompt: "Select a user", text: attorney_two.full_name) - click_on("Submit") - - expect(page).to have_content("Reassigned 1 task to #{attorney_two.full_name}") + within all(".cf-select")[2] do + click_dropdown(prompt: "Select", text: attorney_two.full_name) + end + click_on("Assign") + expect(page).to have_content("You have successfully reassigned Bob Smithrath's case to #{attorney_two.full_name}") visit "/queue/appeals/#{appeal.external_id}" active_tasks_section = page.find("#currently-active-tasks") @@ -212,11 +217,12 @@ expect(page).to have_content("ASSIGNED TO\n#{judge_one.css_id}") expect(page).to have_content("TASK\n#{JudgeDecisionReviewTask.label}") click_dropdown(propmt: "Select an action...", text: "Re-assign to a judge") - click_dropdown(prompt: "Select a user", text: judge_two.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_two.full_name) + end fill_in("taskInstructions", with: "#{judge_one.full_name} is on leave. Please take over this case") - click_on("Submit") - - expect(page).to have_content("Task reassigned to #{judge_two.full_name}") + click_on("Assign") + expect(page).to have_content("You have successfully reassigned this task to #{judge_two.full_name}") visit "/queue/appeals/#{review_appeal.external_id}" expect(page).to have_content("ASSIGNED TO\n#{judge_two.css_id}") @@ -232,11 +238,12 @@ expect(page).to have_content("ASSIGNED TO\n#{judge_one.vacols_uniq_id}") click_dropdown(propmt: "Select an action...", text: "Re-assign to a judge") - click_dropdown(prompt: "Select a user", text: judge_two.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_two.full_name) + end fill_in("taskInstructions", with: "#{judge_one.full_name} is on leave. Please take over this case") click_on("Assign") - - expect(page).to have_content("Task reassigned to #{judge_two.full_name}") + expect(page).to have_content("You have successfully assigned Joshua Chamberlain’s case to #{judge_two.full_name}") visit "/queue/appeals/#{legacy_appeal.external_id}" expect(page).to have_content("ASSIGNED TO\n#{judge_two.vacols_uniq_id}") @@ -248,12 +255,14 @@ step "assign an AttorneyTask" do click_dropdown(propmt: "Select an action...", text: "Assign to attorney") click_dropdown(prompt: "Select a user", text: "Other") - click_dropdown(prompt: "Select a user", text: attorney_one.full_name) + within all(".cf-select")[2] do + click_dropdown(prompt: "Select", text: attorney_one.full_name) + end + instructions = "#{judge_one.full_name} is on leave. Please draft a decision for this case" fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: instructions) - click_on("Submit") - - expect(page).to have_content("Assigned 1 task to #{attorney_one.full_name}") + click_on("Assign") + expect(page).to have_content("You have successfully assigned 1 case to #{attorney_one.full_name}") visit "/queue/appeals/#{legacy_appeal.external_id}" expect(page).to have_content("ASSIGNED TO\n#{attorney_one.vacols_uniq_id}") From c6d98bd34ce69633437a88081798da1b7f5b4fd9 Mon Sep 17 00:00:00 2001 From: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:37:06 -0500 Subject: [PATCH 195/203] [APPEALS-30712] Fixed reader_spec (#19646) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- lib/generators/vacols/case_issue.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/generators/vacols/case_issue.rb b/lib/generators/vacols/case_issue.rb index 3c6b1aa75f0..f6182a97e72 100644 --- a/lib/generators/vacols/case_issue.rb +++ b/lib/generators/vacols/case_issue.rb @@ -5,7 +5,7 @@ class << self def case_issue_attrs { isskey: "877483", - issseq: 1, + issseq: 8, issprog: "02", isscode: "12", isslev1: "04", @@ -25,13 +25,7 @@ def case_issue_attrs end def create(attrs = [{}]) - attrs = attrs.each_with_index do |issue, index| - # increment issseq - issue[:issseq] = index + 1 - - case_issue_attrs.merge(issue) - end - + attrs = attrs.map { |issue| case_issue_attrs.merge(issue) } VACOLS::CaseIssue.create(attrs) end end From cbbc1fc98a4de7c5dae87e3ce2593170c1f05eec Mon Sep 17 00:00:00 2001 From: Kevma50287 <104021955+Kevma50287@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:32:35 -0400 Subject: [PATCH 196/203] APPEALS-31813 Updated test for proper text (#19627) * APPEALS-31813 Updated test for proper text * APPEALS-31813 Updated flaky tests * APPEALS-31813 Updated Spec Test --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../feature/queue/special_case_movement_task_spec.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spec/feature/queue/special_case_movement_task_spec.rb b/spec/feature/queue/special_case_movement_task_spec.rb index c24ea22341a..986e11cbf4a 100644 --- a/spec/feature/queue/special_case_movement_task_spec.rb +++ b/spec/feature/queue/special_case_movement_task_spec.rb @@ -22,18 +22,22 @@ context "With the Appeal in the right state" do it "successfully assigns the task to judge" do visit("queue/appeals/#{appeal.external_id}") + refresh while page.has_text?("Unable to load") prompt = COPY::TASK_ACTION_DROPDOWN_BOX_LABEL text = Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT.label + expect(page).to have_content(prompt.to_s) click_dropdown(prompt: prompt, text: text) - # Select a judge, fill in instructions, submit click_dropdown(prompt: COPY::SPECIAL_CASE_MOVEMENT_MODAL_SELECTOR_PLACEHOLDER, text: judge_user.full_name) + fill_in("taskInstructions", with: "instructions") - click_button("Assign") + click_button("Assign") # expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE % judge_user.full_name) - expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, judge_user.full_name)) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, + appeal.veteran_full_name, + judge_user.full_name)) # Auth as judge user User.authenticate!(user: judge_user) visit "/queue" @@ -108,7 +112,7 @@ expect(page).to have_content("#{ScheduleHearingTask.name} cancelled") expect(page).to have_content("CANCELLED BY\n#{scm_user.css_id}") page.find_all(".taskInformationTimelineContainerStyling button", text: "View task instructions").first.click - expect(page).to have_content("TASK INSTRUCTIONS\nNew Judge:\nBoard of Veterans' Appeals\nDetails:\nInstructions for the judge") + expect(page).to have_content("TASK INSTRUCTIONS\nReason:\nDeath dismissal: Instructions for cancellation") expect(page).to have_content("#{BlockedSpecialCaseMovementTask.name} completed") expect(page).to have_content("#{DistributionTask.name} completed") From 4ae0adf0730fe4541b88c211c1f8f42c51b00dbd Mon Sep 17 00:00:00 2001 From: SanthiParakal133 <132940479+SanthiParakal133@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:36:11 -0400 Subject: [PATCH 197/203] update the rspec (#19642) Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- spec/controllers/legacy_tasks_controller_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/controllers/legacy_tasks_controller_spec.rb b/spec/controllers/legacy_tasks_controller_spec.rb index 487eb6a401c..529c8928d6f 100644 --- a/spec/controllers/legacy_tasks_controller_spec.rb +++ b/spec/controllers/legacy_tasks_controller_spec.rb @@ -353,11 +353,9 @@ describe "Das Deprecation" do before do - FeatureToggle.enable!(:legacy_das_deprecation) User.authenticate!(user: judge) end - after { FeatureToggle.disable!(:legacy_das_deprecation) } let(:task_type) { :attorney_task } let!(:vacols_case) { create(:case) } let!(:appeal) { create(:legacy_appeal, vacols_case: vacols_case) } From 78882433295f831fd08ad8a69e3168de61c764e2 Mon Sep 17 00:00:00 2001 From: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:09:39 -0500 Subject: [PATCH 198/203] code climate complexity fixes (#19637) * code climate complexity fixes * updated assigntoattorneywidget.jsx * more seed legacy rake cleanup * disable rubocop for seed legacy appeal rake * fix spacing * extra line * fix judge_assignment_spec.rb failure --------- Co-authored-by: Jonathan Hoang Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/controllers/tasks_controller.rb | 67 ++++++++++++------- app/models/attorney_case_review.rb | 1 - .../legacy_tasks/attorney_legacy_task.rb | 50 +++++++++----- .../legacy_tasks/judge_legacy_assign_task.rb | 48 +++++++++---- app/models/task.rb | 4 +- app/models/tasks/attorney_task.rb | 8 ++- app/repositories/queue_repository.rb | 2 +- client/app/queue/QueueActions.js | 4 +- .../components/AssignToAttorneyWidget.jsx | 9 +-- client/app/queue/components/TaskRows.jsx | 4 +- lib/tasks/seed_legacy_appeal_tasks.rake | 8 +-- spec/repositories/queue_repository_spec.rb | 1 - 12 files changed, 135 insertions(+), 71 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 918ae254daa..e876160e21a 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -93,18 +93,8 @@ def create tasks << valid_task_classes[task_type.to_sym].create_many_from_params(param_group, current_user) end # This should be the JudgeDecisionReviewTask - parent_task = if params[:tasks].is_a?(Array) && params[:tasks]&.first[:type] == "AttorneyRewriteTask" - Task.find_by(id: params[:tasks].first[:parent_id]) - elsif !params[:tasks].is_a?(Array) && params[:tasks][:type] == "AttorneyRewriteTask" - Task.find_by(id: params[:tasks][:parent_id]) - end - if parent_task&.appeal&.is_a?(LegacyAppeal) - QueueRepository.reassign_decass_to_attorney!( - judge: parent_task.assigned_to, - attorney: User.find(params[:tasks].first[:assigned_to_id]), - vacols_id: parent_task.appeal.external_id - ) - end + parent_task = attorney_rewrite_task? + parent_legacy_appeal?(parent_task) modified_tasks = [parent_tasks_from_params, tasks].flatten.uniq render json: { tasks: json_tasks(modified_tasks) } @@ -114,26 +104,37 @@ def create render(error.serialize_response) end + def parent_legacy_appeal?(parent_task) + if parent_task&.appeal.is_a?(LegacyAppeal) + QueueRepository.reassign_decass_to_attorney!( + judge: parent_task.assigned_to, + attorney: User.find(params[:tasks].first[:assigned_to_id]), + vacols_id: parent_task.appeal.external_id + ) + end + end + + def attorney_rewrite_task? + if params[:tasks].is_a?(Array) && params[:tasks].first[:type] == "AttorneyRewriteTask" + Task.find_by(id: params[:tasks].first[:parent_id]) + elsif !params[:tasks].is_a?(Array) && params[:tasks][:type] == "AttorneyRewriteTask" + Task.find_by(id: params[:tasks][:parent_id]) + end + end + # To update attorney task # e.g, for ama/legacy appeal => PATCH /tasks/:id, # { # assigned_to_id: 23 # } + + # rubocop:disable Metrics/AbcSize def update Task.transaction do tasks = task.update_from_params(update_params, current_user) tasks.each { |t| return invalid_record_error(t) unless t.valid? } tasks_hash = json_tasks(tasks.uniq) - if task.appeal.class == LegacyAppeal - assigned_to = if update_params&.[](:reassign)&.[](:assigned_to_id) - User.find(update_params[:reassign][:assigned_to_id]) - elsif task.type == "AttorneyTask" || task.type == "AttorneyRewriteTask" - User.find(Task.find_by(id: task.parent_id).assigned_to_id) - end - QueueRepository.update_location_to_judge(task.appeal.vacols_id, assigned_to) if assigned_to - else - modified_task_contested_claim - end + modify_task(task, update_params) # currently alerts are only returned by ScheduleHearingTask # and AssignHearingDispositionTask for virtual hearing related updates # Start with any alerts on the current task, then find alerts on the tasks @@ -159,6 +160,25 @@ def update render_update_errors(["title": COPY::FAILED_HEARING_UPDATE, "message": error.message, "code": error.code]) end + # rubocop:enable Metrics/AbcSize + + def reassign_task?(task, update_params) + assigned_to = + if update_params&.[](:reassign)&.[](:assigned_to_id) + User.find(update_params[:reassign][:assigned_to_id]) + elsif task.type == "AttorneyTask" || task.type == "AttorneyRewriteTask" + User.find(Task.find_by(id: task.parent_id).assigned_to_id) + end + QueueRepository.update_location_to_judge(task.appeal.vacols_id, assigned_to) if assigned_to + end + + def modify_task(task, update_params) + if task.appeal.instance_of?(LegacyAppeal) + reassign_task?(task, update_params) + else + modified_task_contested_claim + end + end def for_appeal no_cache @@ -373,7 +393,7 @@ def task def parent_tasks_from_params Task.where(id: create_params.map { |params| params[:parent_id] }) end - + # rubocop:disable Metrics/AbcSize def create_params @create_params ||= [params.require("tasks")].flatten.map do |task| appeal = Appeal.find_appeal_by_uuid_or_find_or_create_legacy_appeal_by_vacols_id(task[:external_id]) @@ -394,6 +414,7 @@ def create_params task end end + # rubocop:enable Metrics/AbcSize def update_params params.require("task").permit( diff --git a/app/models/attorney_case_review.rb b/app/models/attorney_case_review.rb index 0efd58da35e..2ddc14650e8 100644 --- a/app/models/attorney_case_review.rb +++ b/app/models/attorney_case_review.rb @@ -79,7 +79,6 @@ def reassign_case_to_judge_in_vacols! attorney.fail_if_no_access_to_legacy_task!(vacols_id) AttorneyCaseReview.repository.reassign_case_to_judge!( vacols_id: vacols_id, - assigned_by: attorney, created_in_vacols_date: created_in_vacols_date, judge_vacols_user_id: reviewing_judge, decass_attrs: { diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index 8866844ef0c..1d627afdfe2 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -6,33 +6,53 @@ def available_actions(current_user, role) # assignment in the VACOLS.DECASS table or is being used as a Case Movement action. task_id is created using the created_at field from the VACOLS.DECASS table # so we use the absence of this value to indicate that there is no case assignment and return no actions. - if current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && - (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") - [ - Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h - ] - elsif current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && - %w[81 33].include?(appeal.case_record.reload.bfcurloc) - [ - Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h - ] + if case_movement_blocked_for_distribution?(current_user) + [Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h] + elsif case_movement_ready_for_distribution?(current_user) + [Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h] elsif task_id.nil? [] - elsif role == "attorney" && current_user == assigned_to + elsif attorney_user?(current_user, role) [ Constants.TASK_ACTIONS.REVIEW_LEGACY_DECISION.to_h, Constants.TASK_ACTIONS.SUBMIT_OMO_REQUEST_FOR_REVIEW.to_h, Constants.TASK_ACTIONS.ADD_ADMIN_ACTION.to_h ] - elsif current_user&.can_act_on_behalf_of_legacy_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) - [ - Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h - ] + elsif ssc_legacy_case_movement?(current_user) + [Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h] else [] end end + def attorney_user?(current_user, role) + role == "attorney" && current_user == assigned_to + end + + def ssc_legacy_case_movement?(current_user) + current_user&.can_act_on_behalf_of_legacy_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) + end + + def legacy_case_movement?(current_user) + current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) + end + + def appeal_not_ready_for_distribution? + appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW" + end + + def case_movement_blocked_for_distribution?(current_user) + legacy_case_movement?(current_user) && appeal_not_ready_for_distribution? + end + + def case_movement_ready_for_distribution?(current_user) + legacy_case_movement?(current_user) && appeal_ready_for_distribution? + end + + def appeal_ready_for_distribution? + %w[81 33].include?(appeal.case_record.reload.bfcurloc) + end + def timeline_title COPY::CASE_TIMELINE_ATTORNEY_TASK end diff --git a/app/models/legacy_tasks/judge_legacy_assign_task.rb b/app/models/legacy_tasks/judge_legacy_assign_task.rb index 99c382f0603..2332e48ef49 100644 --- a/app/models/legacy_tasks/judge_legacy_assign_task.rb +++ b/app/models/legacy_tasks/judge_legacy_assign_task.rb @@ -1,24 +1,18 @@ # frozen_string_literal: true class JudgeLegacyAssignTask < JudgeLegacyTask - def available_actions(user, role) - if user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && - (appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW") - [ - Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h - ] - elsif user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) && - %w[81 33].include?(appeal.case_record.reload.bfcurloc) - [ - Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h - ] - elsif assigned_to == user && role == "judge" + def available_actions(current_user, role) + if case_movement_blocked_for_distribution?(current_user) + [Constants.TASK_ACTIONS.BLOCKED_SPECIAL_CASE_MOVEMENT_LEGACY.to_h] + elsif case_movement_ready_for_distribution?(current_user) + [Constants.TASK_ACTIONS.SPECIAL_CASE_MOVEMENT_LEGACY.to_h] + elsif judge_user?(current_user, role) [ Constants.TASK_ACTIONS.ADD_ADMIN_ACTION.to_h, Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.to_h, Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.to_h ] - elsif user.can_act_on_behalf_of_judges? && assigned_to.judge_in_vacols? + elsif judge_case_movement?(current_user) [ Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.to_h, Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY_LEGACY.to_h @@ -28,6 +22,34 @@ def available_actions(user, role) end end + def judge_user?(current_user, role) + role == "judge" && current_user == assigned_to + end + + def judge_case_movement?(current_user) + current_user&.can_act_on_behalf_of_judges? && assigned_to.judge_in_vacols? + end + + def legacy_case_movement?(current_user) + current_user&.can_act_on_behalf_of_judges? && FeatureToggle.enabled?(:vlj_legacy_appeal) + end + + def appeal_not_ready_for_distribution? + appeal.case_record.reload.bfcurloc == "57" || appeal.case_record.reload.bfcurloc == "CASEFLOW" + end + + def case_movement_blocked_for_distribution?(current_user) + legacy_case_movement?(current_user) && appeal_not_ready_for_distribution? + end + + def case_movement_ready_for_distribution?(current_user) + legacy_case_movement?(current_user) && appeal_ready_for_distribution? + end + + def appeal_ready_for_distribution? + %w[81 33].include?(appeal.case_record.reload.bfcurloc) + end + def label if (%w[81 57 33].include?(appeal.case_record.reload.bfcurloc) || appeal.case_record.reload.bfcurloc == "CASEFLOW") && diff --git a/app/models/task.rb b/app/models/task.rb index 0706957fb38..2ee2cd89e47 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -718,7 +718,7 @@ def verify_user_can_update!(user) end end - # rubocop:disable Metrics/AbcSize + # rubocop:disable Metrics/AbcSize, Metrics/MethodLength def reassign(reassign_params, current_user) # We do not validate the number of tasks in this scenario because when a # task is reassigned, more than one open task of the same type must exist during the reassignment. @@ -750,7 +750,7 @@ def reassign(reassign_params, current_user) [replacement, self, replacement.children].flatten end - # rubocop:enable Metrics/AbcSize + # rubocop:enable Metrics/AbcSize, Metrics/MethodLength def can_move_on_docket_switch? return false unless open_with_no_children? diff --git a/app/models/tasks/attorney_task.rb b/app/models/tasks/attorney_task.rb index 4f2f9c06637..c59670a9c37 100644 --- a/app/models/tasks/attorney_task.rb +++ b/app/models/tasks/attorney_task.rb @@ -100,12 +100,16 @@ def can_be_moved_by_user?(user) # Allows SSC, SCM, VLJ's if legacy if appeal.is_a?(LegacyAppeal) - return parent.assigned_to == user || assigned_by == user || user&.can_act_on_behalf_of_legacy_judges? + return current_assignee?(user) || user&.can_act_on_behalf_of_legacy_judges? end # The judge who is assigned the parent review task, the assigning judge, and SpecialCaseMovementTeam members can # cancel or reassign this task - parent.assigned_to == user || assigned_by == user || user&.can_act_on_behalf_of_judges? + current_assignee?(user) || user&.can_act_on_behalf_of_judges? + end + + def current_assignee?(user) + parent.assigned_to == user || assigned_by == user end # VLJs can assign these to themselves diff --git a/app/repositories/queue_repository.rb b/app/repositories/queue_repository.rb index 51eadcb37cf..a430ba53f0e 100644 --- a/app/repositories/queue_repository.rb +++ b/app/repositories/queue_repository.rb @@ -56,7 +56,7 @@ def appeals_by_vacols_ids(vacols_ids) appeals end - def reassign_case_to_judge!(vacols_id:, assigned_by:, created_in_vacols_date:, judge_vacols_user_id:, decass_attrs:) + def reassign_case_to_judge!(vacols_id:, created_in_vacols_date:, judge_vacols_user_id:, decass_attrs:) decass_record = find_decass_record(vacols_id, created_in_vacols_date) # In attorney checkout, we are automatically selecting the judge who # assigned the attorney the case. But we also have a drop down for the diff --git a/client/app/queue/QueueActions.js b/client/app/queue/QueueActions.js index a110b5f9e38..8952f45f055 100644 --- a/client/app/queue/QueueActions.js +++ b/client/app/queue/QueueActions.js @@ -564,8 +564,8 @@ export const reassignTasksToUser = ({ }) => (dispatch) => Promise.all(tasks.map((oldTask) => { let params, url; - const makeRequest = () => { - ApiUtil.patch(url, params). + const makeRequest = async () => { + await ApiUtil.patch(url, params). then((resp) => resp.body). then((resp) => { dispatchOldTasks(dispatch, oldTask, resp); diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index 269bd0e0fe5..6dd291ad769 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -28,7 +28,6 @@ import { ACTIONS } from '../uiReducer/uiConstants'; import { taskActionData } from '../utils'; import QueueFlowModal from './QueueFlowModal'; -// import { options } from 'superagent'; const OTHER = 'OTHER'; @@ -42,9 +41,11 @@ export class AssignToAttorneyWidget extends React.PureComponent { constructor(props) { super(props); - if (props.selectedTasks.length > 0 && props.selectedTasks[0].appealType === 'LegacyAppeal') { - const instructions = (props.selectedTasks[0].instructions.length === 0 ? [] : - props.selectedTasks[0].instructions.filter((instructionData) => instructionData)); + const selectedTasks = props.selectedTasks; + const doesTaskExistAndIsLegacy = selectedTasks.length > 0 && selectedTasks[0].appealType === 'LegacyAppeal'; + + if (doesTaskExistAndIsLegacy) { + const instructions = selectedTasks[0]?.instructions?.filter((instructionData) => instructionData) || []; const isInstructionArray = (instructions.length === 0 ? [] : instructions); const instructionType = Array.isArray(props.selectedTasks[0].instructions) ? isInstructionArray : []; diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index 39695fb8c82..11bece60bb0 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -307,8 +307,10 @@ class TaskRows extends React.PureComponent { // We specify the same 2.4rem margin-bottom as paragraphs to each set of instructions // to ensure a consistent margin between instruction content and the "Hide" button const divStyles = { marginTop: '2rem' }; + const taskIsAssignOrDecisionReview = task.type === 'JudgeAssignTask' || + task.type === 'JudgeDecisionReviewTask'; - if ((task.previous.length >= 1) && (task.type === 'JudgeAssignTask' || task.type === 'JudgeDecisionReviewTask')) { + if ((task.previous.length >= 1) && (taskIsAssignOrDecisionReview)) { return ( {task.previous.toReversed().map((prev) => ( diff --git a/lib/tasks/seed_legacy_appeal_tasks.rake b/lib/tasks/seed_legacy_appeal_tasks.rake index 2fef4000da2..d7696b288d7 100644 --- a/lib/tasks/seed_legacy_appeal_tasks.rake +++ b/lib/tasks/seed_legacy_appeal_tasks.rake @@ -4,6 +4,7 @@ # then select an option between 'HearingTask', 'JudgeTask', 'AttorneyTask', 'ReviewTask', 'Scenario1edge' # and 'Brieff_Curloc_81_Task' +# rubocop:disable all namespace :db do desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" task generate_legacy_appeals_with_tasks: :environment do @@ -61,7 +62,6 @@ namespace :db do end.compact build_the_cases_in_caseflow(cases, task_type, user) - # rubocop:enable, Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength end def custom_folder_attributes(veteran, docket_number) @@ -357,7 +357,6 @@ namespace :db do elsif task_type == "SCENARIO1EDGE" create_edge_case_task_for_legacy_appeals(appeal) end - # rubocop:enable end ######################################################## @@ -382,12 +381,9 @@ namespace :db do if Rails.env.development? || Rails.env.test? vets = Veteran.first(5) - veterans_with_like_45_appeals = vets[0..12].pluck(:file_number) # local / test option for veterans - else veterans_with_like_45_appeals = %w[583099131 589951227 333313333] # UAT option for veterans - end $stdout.puts("Which type of tasks do you want to add to these Legacy Appeals?") @@ -396,7 +392,6 @@ namespace :db do task_type = $stdin.gets.chomp.upcase if task_type == "JUDGETASK" || task_type == "REVIEWTASK" $stdout.puts("Enter the CSS ID of a judge user that you want to assign these appeals to") - if Rails.env.development? || Rails.env.test? $stdout.puts("Hint: Judge Options include 'BVARERDMAN'") # local / test option else @@ -441,3 +436,4 @@ namespace :db do end end end +# rubocop:enable all diff --git a/spec/repositories/queue_repository_spec.rb b/spec/repositories/queue_repository_spec.rb index ac2a6dfb908..f6485f81d56 100644 --- a/spec/repositories/queue_repository_spec.rb +++ b/spec/repositories/queue_repository_spec.rb @@ -137,7 +137,6 @@ def vacols_id subject do QueueRepository.reassign_case_to_judge!( vacols_id: vacols_case.bfkey, - assigned_by: judge, created_in_vacols_date: date_added, judge_vacols_user_id: judge, decass_attrs: decass_attrs From 3cc1ab4b60f1cff89c19fb43e8e9a498132e93bf Mon Sep 17 00:00:00 2001 From: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:11:10 -0500 Subject: [PATCH 199/203] code climate duplicate fix (#19639) * code climate duplicate fix * disable complexity in task.rb --------- Co-authored-by: Jonathan Hoang Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- app/models/task.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 2ee2cd89e47..93d4f653b93 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -183,6 +183,7 @@ def cannot_have_children false end + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def verify_user_can_create!(user, parent) can_create = parent&.available_actions(user)&.map do |action| parent.build_action_hash(action, user) @@ -190,12 +191,7 @@ def verify_user_can_create!(user, parent) action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option.dig(:value) == name } end - if !parent&.actions_allowable?(user) || !can_create - user_description = user ? "User #{user.id}" : "nil User" - parent_description = parent ? " from #{parent.class.name} #{parent.id}" : "" - message = "#{user_description} cannot assign #{name}#{parent_description}." - fail Caseflow::Error::ActionForbiddenError, message: message - end + can_assign_to_parent?(user, parent, can_create) end def verify_user_can_create_legacy!(user, parent) @@ -205,6 +201,11 @@ def verify_user_can_create_legacy!(user, parent) action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option.dig(:value) == name } end + can_assign_to_parent?(user, parent, can_create) + end + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity + + def can_assign_to_parent?(user, parent, can_create) if !parent&.actions_allowable?(user) || !can_create user_description = user ? "User #{user.id}" : "nil User" parent_description = parent ? " from #{parent.class.name} #{parent.id}" : "" From e16c8237551840da11bc44b40ecf709244b68ac0 Mon Sep 17 00:00:00 2001 From: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com> Date: Thu, 5 Oct 2023 08:57:08 -0500 Subject: [PATCH 200/203] spec fix in scm_judge_assignment_spec (#19655) * spec fix in scm_judge_assignment_spec * latest spec fix in scm_judge_assignment_spec --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- client/app/queue/components/TaskRows.jsx | 2 +- spec/feature/queue/scm_judge_assignment_spec.rb | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index 11bece60bb0..fc5acbc64ca 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -313,7 +313,7 @@ class TaskRows extends React.PureComponent { if ((task.previous.length >= 1) && (taskIsAssignOrDecisionReview)) { return ( - {task.previous.toReversed().map((prev) => ( + {(task.previous.length > 1 ? task.previous.toReversed() : task.previous).map((prev) => (
    {prev.old_judge && (
    Date: Fri, 6 Oct 2023 07:21:20 -0700 Subject: [PATCH 201/203] Caceves/appeals 24914 test f (#19659) * Rspec fix - Post send initial notification letter holding task spec * Fixes for code climate styles * Reduce post send initial notiication letter holding task * Remove comma * SCM spec fixes * Fix special case movement * Fix judge assignment spec * Update cavc task queue spec * Fix all changing hearing dispostion * Fix rubocop offenses seed legacy appeals * Remove rubocop offenses for hide legacy tasks * Assign_task_to_attorney fixed * Remove rubocop offense for task_controller * Task controller create_params rubocop offense * Fixed line length * Fixed parameter formatting for linting * Updated reek for cyclomatic complexities and utility function * Fix some rubocop new line offenses * Fix jest test error * Refactor HearingsTask, updated Reek for Tasks Controller * fixed on_hold_tasks_tab.rb code climate errors * fixed rubocop offenses on attorney_legacy_task.rb * Lint fix - Queue App * fixed rubocop offenses on case_review_concern.rb * Fix all task model rubocop code climate offenses * Fix code climate offense enable features dev * fixed lint issues * Fix new scm judge assignment code climate failures new line * Fix new rubocop offenses for task controller * AssignToAttorney code climate fix * ignore task.rb reek offenses * style & lint fix * fix jext error * fix rubocop offenses in enable_features_dev.rb * fixed rubocop offenses in attorney_legacy_task.rb * Fixes rubocop offenses for task model * fix code climate style error in task.rb --------- Co-authored-by: shruthisibi Co-authored-by: Kevin Ma Co-authored-by: piedram Co-authored-by: Calvin Co-authored-by: samasudhirreddy Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> --- .reek.yml | 10 ++- app/controllers/tasks_controller.rb | 17 ++-- app/models/concerns/case_review_concern.rb | 8 +- .../legacy_tasks/attorney_legacy_task.rb | 3 +- app/models/queue_tabs/on_hold_tasks_tab.rb | 2 +- app/models/task.rb | 21 +++-- app/models/tasks/hearing_task.rb | 11 ++- .../assign_task_to_attorney.rb | 1 + app/workflows/tasks_for_appeal.rb | 7 +- client/app/queue/AssignToView.jsx | 6 +- client/app/queue/AttorneyTaskListView.jsx | 3 +- .../app/queue/BlockedAdvanceToJudgeView.jsx | 1 + .../queue/JudgeDecisionReviewTaskListView.jsx | 3 +- client/app/queue/QueueApp.jsx | 90 +++++++++++++------ client/app/queue/SubmitDecisionView.jsx | 1 - .../components/AssignToAttorneyWidget.jsx | 14 ++- client/app/queue/components/TaskRows.jsx | 6 +- client/app/styles/_style_guide.scss | 2 +- client/test/app/queue/CaseDetailsView.test.js | 4 +- .../app/queue/components/AssignToView.test.js | 35 ++++---- lib/tasks/seed_legacy_appeals.rake | 3 + scripts/enable_features_dev.rb | 6 +- .../change_hearing_disposition_spec.rb | 18 ++-- spec/feature/queue/ama_queue_spec.rb | 6 +- spec/feature/queue/cavc_task_queue_spec.rb | 20 +++-- spec/feature/queue/judge_assignment_spec.rb | 9 +- .../queue/scm_judge_assignment_spec.rb | 13 +-- .../queue/special_case_movement_task_spec.rb | 3 +- .../investigate_scm_cant_reassign_spec.rb | 10 +-- .../legacy_tasks/judge_legacy_task_spec.rb | 2 +- ...l_notification_letter_holding_task_spec.rb | 2 +- spec/models/task_spec.rb | 4 +- spec/models/tasks/judge_task_spec.rb | 2 +- spec/models/vacols/case_docket_spec.rb | 2 +- 34 files changed, 215 insertions(+), 130 deletions(-) diff --git a/.reek.yml b/.reek.yml index f1de4d08095..76781c2b751 100644 --- a/.reek.yml +++ b/.reek.yml @@ -9,6 +9,7 @@ detectors: - PowerOfAttorney - QueueConfig - RatingDecision + - Task#skip_check_for_only_open_task_of_type BooleanParameter: exclude: - AsyncableJobsReporter#initialize @@ -40,6 +41,8 @@ detectors: - VirtualHearing#email_recipient_name - JudgeDecisionReviewTask#additional_available_actions - LegacyDocket#should_distribute? + - AttorneyLegacyTask + - JudgeLegacyAssignTask UncommunicativeVariableName: exclude: - Address @@ -65,6 +68,7 @@ detectors: - SanitizedJsonExporter - Seeds::Tasks - TaskTreeRenderModule + - Task DuplicateMethodCall: enabled: false FeatureEnvy: @@ -136,6 +140,8 @@ detectors: - ExternalApi::PexipService#send_pexip_request - ControllerSchema#remove_unknown_keys - BusinessLineReporter#as_csv + - TasksController#parent_legacy_appeal? + - Task#cancel_task_and_child_subtasks InstanceVariableAssumption: exclude: - Appeal @@ -255,12 +261,14 @@ detectors: - UpdatePOAConcern - VBMSCaseflowLogger#log - LegacyDocket + - AttorneyLegacyTask + - JudgeLegacyAssignTask + - TasksController#reassign_task UnusedParameters: exclude: - Docket#distribute_appeals - HearingRequestDocket#distribute_appeals - ### Directory specific configuration # You can configure smells on a per-directory base. # E.g. the classic Rails case: controllers smell of NestedIterators (see /docs/Nested-Iterators.md) and diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index e876160e21a..0233d6c47e4 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -393,23 +393,24 @@ def task def parent_tasks_from_params Task.where(id: create_params.map { |params| params[:parent_id] }) end + # rubocop:disable Metrics/AbcSize def create_params @create_params ||= [params.require("tasks")].flatten.map do |task| appeal = Appeal.find_appeal_by_uuid_or_find_or_create_legacy_appeal_by_vacols_id(task[:external_id]) task = task.merge(instructions: [task[:instructions]].flatten.compact) task = task.permit(:type, { instructions: [] }, :assigned_to_id, :cancellation_reason, - :assigned_to_type, :parent_id, business_payloads: [:description, values: {}]) + :assigned_to_type, :parent_id, business_payloads: [:description, { values: {} }]) .merge(assigned_by: current_user) .merge(appeal: appeal) task = task.merge(assigned_to_type: User.name) if !task[:assigned_to_type] - if appeal.is_a?(LegacyAppeal) - if task[:type] == "BlockedSpecialCaseMovementTask" || task[:type] == "SpecialCaseMovementTask" - task = task.merge(external_id: params["tasks"][0]["external_id"], legacy_task_type: params["tasks"][0]["legacy_task_type"], - appeal_type: params["tasks"][0]["appeal_type"]) - end + if appeal.is_a?(LegacyAppeal) && (task[:type] == "BlockedSpecialCaseMovementTask" || + task[:type] == "SpecialCaseMovementTask") + task = task.merge(external_id: params["tasks"][0]["external_id"], + legacy_task_type: params["tasks"][0]["legacy_task_type"], + appeal_type: params["tasks"][0]["appeal_type"]) end task end @@ -425,8 +426,8 @@ def update_params :select_opc, :radio_value, :parent_id, - reassign: [:assigned_to_id, :assigned_to_type, :instructions, previous: [:details, :old_judge, :new_judge]], - business_payloads: [:description, values: {}] + reassign: [:assigned_to_id, :assigned_to_type, :instructions, { previous: [:details, :old_judge, :new_judge] }], + business_payloads: [:description, { values: {} }] ) end diff --git a/app/models/concerns/case_review_concern.rb b/app/models/concerns/case_review_concern.rb index 6e35ae38d4c..b214d7fa79a 100644 --- a/app/models/concerns/case_review_concern.rb +++ b/app/models/concerns/case_review_concern.rb @@ -23,7 +23,7 @@ def appeal def associate_with_appeal # Populate appeal_* column values based on original implementation that uses `task_id` - update_attributes( + update( appeal_id: appeal_through_task_id&.id, appeal_type: appeal_through_task_id&.class&.name ) @@ -41,7 +41,7 @@ def legacy? # use column values if they exist return appeal.is_a?(LegacyAppeal) if appeal_association? - return task.appeal.is_a?(LegacyAppeal) if task && task.appeal + return task.appeal.is_a?(LegacyAppeal) if task&.appeal # fall back to original implementation (task_id =~ LegacyTask::TASK_ID_REGEX) ? true : false @@ -52,14 +52,14 @@ def legacy? def vacols_id # use column values if they exist return appeal.vacols_id if appeal_association? - return task.appeal.vacols_id if task && task.appeal&.is_a?(LegacyAppeal) + return task.appeal.vacols_id if task&.appeal.is_a?(LegacyAppeal) # fall back to original implementation task_id&.split("-", 2)&.first end def created_in_vacols_date - if task&.appeal&.is_a?(LegacyAppeal) + if task&.appeal.is_a?(LegacyAppeal) return VACOLS::Decass.where(defolder: task.appeal.vacols_id).max_by(&:deadtim).deadtim end diff --git a/app/models/legacy_tasks/attorney_legacy_task.rb b/app/models/legacy_tasks/attorney_legacy_task.rb index 1d627afdfe2..36bc2c07c90 100644 --- a/app/models/legacy_tasks/attorney_legacy_task.rb +++ b/app/models/legacy_tasks/attorney_legacy_task.rb @@ -3,7 +3,8 @@ class AttorneyLegacyTask < LegacyTask def available_actions(current_user, role) # AttorneyLegacyTasks are drawn from the VACOLS.BRIEFF table but should not be actionable unless there is a case - # assignment in the VACOLS.DECASS table or is being used as a Case Movement action. task_id is created using the created_at field from the VACOLS.DECASS table + # assignment in the VACOLS.DECASS table or is being used as a Case Movement action. + # task_id is created using the created_at field from the VACOLS.DECASS table # so we use the absence of this value to indicate that there is no case assignment and return no actions. if case_movement_blocked_for_distribution?(current_user) diff --git a/app/models/queue_tabs/on_hold_tasks_tab.rb b/app/models/queue_tabs/on_hold_tasks_tab.rb index 4442d2c61c2..575830daa14 100644 --- a/app/models/queue_tabs/on_hold_tasks_tab.rb +++ b/app/models/queue_tabs/on_hold_tasks_tab.rb @@ -40,7 +40,7 @@ def legacy_colocated_task_ids_assigned_by_assignee colocated_tasks = ColocatedTask.open.order(:created_at) .where(assigned_by: assignee, assigned_to_type: Organization.name, appeal_type: LegacyAppeal.name) .reject do |task| - ['JudgeAssignTask','JudgeDecisionReviewTask', 'AttorneyTask','AttorneyRewriteTask'].include? task&.parent&.type + %w[JudgeAssignTask JudgeDecisionReviewTask AttorneyTask AttorneyRewriteTask].include? task&.parent&.type end colocated_tasks.group_by(&:appeal_id).map { |_appeal_id, tasks| tasks.first.id } end diff --git a/app/models/task.rb b/app/models/task.rb index 93d4f653b93..e220c21cead 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -188,7 +188,7 @@ def verify_user_can_create!(user, parent) can_create = parent&.available_actions(user)&.map do |action| parent.build_action_hash(action, user) end&.any? do |action| - action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option.dig(:value) == name } + action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option[:value] == name } end can_assign_to_parent?(user, parent, can_create) @@ -198,7 +198,7 @@ def verify_user_can_create_legacy!(user, parent) can_create = parent&.available_actions(user, "SCM")&.map do |action| parent.build_action_hash(action, user) end&.any? do |action| - action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option.dig(:value) == name } + action.dig(:data, :type) == name || action.dig(:data, :options)&.any? { |option| option[:value] == name } end can_assign_to_parent?(user, parent, can_create) @@ -234,7 +234,8 @@ def any_recently_updated(*tasks_arrays) def create_from_params(params, user) parent_task = create_parent_task(params, user) params = modify_params_for_create(params) - if parent_task.appeal_type == "LegacyAppeal" && parent_task.type != "TranslationTask" && !parent_task.type.is_a?(ColocatedTask) + if parent_task.appeal_type == "LegacyAppeal" && parent_task.type != "TranslationTask" && + !parent_task.type.is_a?(ColocatedTask) special_case_for_legacy(parent_task, params, user) else # regular appeal child = create_child_task(parent_task, user, params) @@ -278,7 +279,6 @@ def special_case_for_legacy(parent_task, params, user) end end - def cancel_blocking_task_legacy(params, parent_task) parent_task.children.each { |current_task| search_for_blocking(params[:instructions], current_task) } @@ -303,9 +303,12 @@ def cancelled_task(task) end def search_for_blocking(instructions, current_task) - current_task.legacy_blocking? ? - current_task.cancel_descendants(instructions: "**#{COPY::LEGACY_APPEALS_VLJ_REASON_INSTRUCTIONS}**\n" + instructions[1]) : - current_task.children.each { |current_task| search_for_blocking(current_task) } + if current_task.legacy_blocking? + current_task.cancel_descendants(instructions: "**#{COPY::LEGACY_APPEALS_VLJ_REASON_INSTRUCTIONS}**\n" + + instructions[1]) + else + current_task.children.each { |task| search_for_blocking(task) } + end end def create_judge_assigned_task_for_legacy(params, parent_task) @@ -541,7 +544,7 @@ def calculated_placed_on_hold_at def calculated_on_hold_duration timed_hold_task = active_child_timed_hold_task - (timed_hold_task&.timer_end_time&.to_date &.- timed_hold_task&.timer_start_time&.to_date)&.to_i + (timed_hold_task&.timer_end_time&.to_date&.- timed_hold_task&.timer_start_time&.to_date)&.to_i end def calculated_last_change_duration @@ -624,7 +627,7 @@ def update_with_instructions(params) end def flattened_instructions(params) - [instructions, params.dig(:instructions).presence].flatten.compact + [instructions, params[:instructions].presence].flatten.compact end def append_instruction(instruction) diff --git a/app/models/tasks/hearing_task.rb b/app/models/tasks/hearing_task.rb index eb9ca6191e5..09acdca4328 100644 --- a/app/models/tasks/hearing_task.rb +++ b/app/models/tasks/hearing_task.rb @@ -53,25 +53,24 @@ def when_child_task_completed(child_task) super if appeal.is_a?(LegacyAppeal) if FeatureToggle.enable!(:vlj_legacy_appeal) - when_scm(appeal) + when_scm elsif appeal.tasks.open.where(type: HearingTask.name).empty? update_legacy_appeal_location end end end - def when_scm(appeal) - if appeal.tasks.open.where(type: HearingTask.name).empty? && - appeal.tasks.open.where(type: ScheduleHearingTask.name).empty? + def when_scm + if appeal.tasks.open.where(type: [HearingTask.name, ScheduleHearingTask.name]).empty? if !appeal.tasks.open.where(type: JudgeAssignTask.name).empty? - process_appeal_scm(appeal) + process_appeal_scm else update_legacy_appeal_location end end end - def process_appeal_scm(appeal) + def process_appeal_scm current_judge_id = appeal.tasks.find_by(type: "JudgeAssignTask").assigned_to_id current_user = User.find(current_judge_id) update_legacy_appeal_location_scm(current_user.vacols_uniq_id) diff --git a/app/workflows/das_deprecation/assign_task_to_attorney.rb b/app/workflows/das_deprecation/assign_task_to_attorney.rb index 116b55b7c20..dbf69f57fcf 100644 --- a/app/workflows/das_deprecation/assign_task_to_attorney.rb +++ b/app/workflows/das_deprecation/assign_task_to_attorney.rb @@ -22,6 +22,7 @@ def reassign_attorney_task(vacols_id, assigned_by, assigned_to) def should_perform_workflow?(appeal_id) return false if FeatureToggle.enabled?(:legacy_das_deprecation, user: RequestStore.store[:current_user]) + appeal = LegacyAppeal.find(appeal_id) !JudgeAssignTask.find_by(appeal: appeal).nil? end diff --git a/app/workflows/tasks_for_appeal.rb b/app/workflows/tasks_for_appeal.rb index 84f5f8e02f0..2983fd0ecd5 100644 --- a/app/workflows/tasks_for_appeal.rb +++ b/app/workflows/tasks_for_appeal.rb @@ -90,7 +90,12 @@ def legacy_appeal_tasks end def hide_legacy_tasks? - (!appeal.tasks.where(type: JudgeAssignTask.name).empty? || !appeal.tasks.where(type: AttorneyTask.name).empty? || !appeal.tasks.where(type: JudgeDecisionReviewTask.name).empty?) ? true : false + if !appeal.tasks.where(type: JudgeAssignTask.name).empty? || !appeal.tasks.where(type: AttorneyTask.name).empty? || + !appeal.tasks.where(type: JudgeDecisionReviewTask.name).empty? + true + else + false + end end def task_includes diff --git a/client/app/queue/AssignToView.jsx b/client/app/queue/AssignToView.jsx index b3776967da2..72072bafc37 100644 --- a/client/app/queue/AssignToView.jsx +++ b/client/app/queue/AssignToView.jsx @@ -1,3 +1,4 @@ +/* eslint-disable */ import * as React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; @@ -140,7 +141,8 @@ class AssignToView extends React.Component { const assignTaskSuccessMessage = { title: taskActionData(this.props).message_title ? sprintf(taskActionData(this.props).message_title, caseNameListItem(), - this.getAssignee(isTeamAssign ? 'Organization' : 'User')) : sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE, this.getAssignee(isTeamAssign ? 'Organization' : 'User')), + this.getAssignee(isTeamAssign ? 'Organization' : 'User')) : sprintf(COPY.ASSIGN_TASK_SUCCESS_MESSAGE_LEGACY_SUCCESS_TITLE, + this.getAssignee(isTeamAssign ? 'Organization' : 'User')), detail: taskActionData(this.props).message_detail || null }; @@ -480,7 +482,9 @@ AssignToView.propTypes = { availableActions: PropTypes.arrayOf(PropTypes.object), externalAppealId: PropTypes.string, type: PropTypes.string, + // eslint-disable-next-line max-lines appealType: PropTypes.string, + // eslint-disable-next-line max-lines assignedBy: PropTypes.string, assigneeName: PropTypes.string, isLegacy: PropTypes.bool diff --git a/client/app/queue/AttorneyTaskListView.jsx b/client/app/queue/AttorneyTaskListView.jsx index c5c130a8151..e8bc0917f53 100644 --- a/client/app/queue/AttorneyTaskListView.jsx +++ b/client/app/queue/AttorneyTaskListView.jsx @@ -53,7 +53,8 @@ class AttorneyTaskListView extends React.PureComponent { {error.detail} } {success && - {success.detail || (success.title.includes('You have successfully reassigned ') && COPY.ATTORNEY_QUEUE_TABLE_SUCCESS_MESSAGE_DETAIL)} + {success.detail || (success.title.includes('You have successfully reassigned ') && + COPY.ATTORNEY_QUEUE_TABLE_SUCCESS_MESSAGE_DETAIL)} } } {messages.success && - {messages.success.detail || (messages.success.title.includes('You have successfully reassigned ') && COPY.JUDGE_QUEUE_TABLE_SUCCESS_MESSAGE_DETAIL)} + {messages.success.detail || (messages.success.title.includes('You have successfully reassigned ') && + COPY.JUDGE_QUEUE_TABLE_SUCCESS_MESSAGE_DETAIL)} } ; diff --git a/client/app/queue/QueueApp.jsx b/client/app/queue/QueueApp.jsx index b42a5e263ba..85173fd7ccc 100644 --- a/client/app/queue/QueueApp.jsx +++ b/client/app/queue/QueueApp.jsx @@ -141,9 +141,11 @@ class QueueApp extends React.PureComponent { caseflowVeteranIds = veteranIdsParameter.split(','); } - return ; + return ; }; - + /* eslint-enable max-len */ viewForUserRole = () => { const { userRole } = this.props; @@ -162,6 +164,7 @@ class QueueApp extends React.PureComponent { ); + // eslint-disable-next-line react/prop-types routedTeamQueueList = (label) => ({ match }) => ( ( - + ); routedCompleteTaskContestedClaimModal = (props) => ( @@ -947,17 +953,20 @@ class QueueApp extends React.PureComponent { render={this.routedAssignToSingleTeam} /> @@ -1022,7 +1031,8 @@ class QueueApp extends React.PureComponent { render={this.routedReturnToCamo} /> @@ -1126,7 +1136,8 @@ class QueueApp extends React.PureComponent { render={this.routedCavcRemandReceived} /> @@ -1156,7 +1167,8 @@ class QueueApp extends React.PureComponent { /> instructionData) || []; - const isInstructionArray = (instructions.length === 0 ? [] : instructions); - const instructionType = Array.isArray(props.selectedTasks[0].instructions) ? isInstructionArray : []; + + // check if instruction is array + const instructionType = this.isInstructionArray(instructions, selectedTasks); this.state = { instructions: ((this.props.isModal && props.selectedTasks.length > 0 && @@ -67,6 +68,12 @@ export class AssignToAttorneyWidget extends React.PureComponent { } } + isInstructionArray = (instructions, selectedTasks) => { + const isArray = (instructions.length === 0 ? [] : instructions); + + return Array.isArray(selectedTasks[0].instructions) ? isArray : []; + } + componentDidMount = () => this.props.resetSuccessMessages?.(); validAssignee = () => { @@ -189,7 +196,8 @@ export class AssignToAttorneyWidget extends React.PureComponent { return this.props.showSuccessMessage({ title: sprintf(COPY.ASSIGN_WIDGET_SUCCESS, { verb: isReassign ? 'You have successfully reassigned' : 'You have successfully assigned', - numCases: selectedTasks.length === 1 && selectedTasks[0].appeal?.appellantFullName ? `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, + numCases: selectedTasks.length === 1 && selectedTasks[0].appeal?.appellantFullName ? + `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, casePlural: pluralize('cases', selectedTasks.length), // eslint-disable-next-line camelcase assignee: assignee.full_name diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx index fc5acbc64ca..4379974990c 100644 --- a/client/app/queue/components/TaskRows.jsx +++ b/client/app/queue/components/TaskRows.jsx @@ -357,7 +357,8 @@ class TaskRows extends React.PureComponent { return ( - {task.instructions[1] && !(task.type === 'AttorneyTask' || task.type === 'JudgeDecisionReviewTask' || task.type === 'AttorneyRewriteTask') && ( + {task.instructions[1] && !(task.type === 'AttorneyTask' || task.type === 'JudgeDecisionReviewTask' || + task.type === 'AttorneyRewriteTask') && (
    - {(task.instructions[0].includes('**Reason:**') || task.type === 'JudgeDecisionReviewTask') ? null : COPY.LEGACY_APPEALS_VLJ_DETAILS_INSTRUCTIONS} + {(task.instructions[0].includes('**Reason:**') || + task.type === 'JudgeDecisionReviewTask') ? null : COPY.LEGACY_APPEALS_VLJ_DETAILS_INSTRUCTIONS} {formatBreaks(task.instructions[0])}
    diff --git a/client/app/styles/_style_guide.scss b/client/app/styles/_style_guide.scss index 986217987d0..6ce95cf9c71 100644 --- a/client/app/styles/_style_guide.scss +++ b/client/app/styles/_style_guide.scss @@ -105,7 +105,7 @@ .blocked-advanced-h3 { margin-top: 35px; - margin-bottom: 0px; + margin-bottom: 0; } .sg-colors-swatches { diff --git a/client/test/app/queue/CaseDetailsView.test.js b/client/test/app/queue/CaseDetailsView.test.js index d802a23fc66..e91b5f6dcc9 100644 --- a/client/test/app/queue/CaseDetailsView.test.js +++ b/client/test/app/queue/CaseDetailsView.test.js @@ -1,6 +1,6 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; -import CaseDetailsView from "../../../app/queue/CaseDetailsView"; +import CaseDetailsView from '../../../app/queue/CaseDetailsView'; import { queueWrapper as Wrapper } from 'test/data/stores/queueStore'; import { amaAppeal, legacyAppeal, powerOfAttorney } from '../../data/appeals'; import COPY from '../../../COPY'; @@ -100,4 +100,4 @@ describe('NotificationsLink', () => { expect(link).toBeNull(); }); }); -}); \ No newline at end of file +}); diff --git a/client/test/app/queue/components/AssignToView.test.js b/client/test/app/queue/components/AssignToView.test.js index 20a0becfd6a..b5fe96c9691 100644 --- a/client/test/app/queue/components/AssignToView.test.js +++ b/client/test/app/queue/components/AssignToView.test.js @@ -10,7 +10,6 @@ import { createQueueReducer, getAppealId, getTaskId, - enterModalRadioOptions, enterTextFieldOptions, selectFromDropdown } from './modalUtils'; @@ -23,7 +22,6 @@ import { } from '../../../data/queue/taskActionModals/taskActionModalData'; import userEvent from '@testing-library/user-event'; - const renderAssignToView = (modalType, storeValues, taskType) => { const appealId = getAppealId(storeValues); const taskId = getTaskId(storeValues, taskType); @@ -49,12 +47,13 @@ const renderAssignToView = (modalType, storeValues, taskType) => { describe('Whenever BVA Intake returns an appeal to', () => { const taskType = 'PreDocketTask'; - const buttonText = COPY.MODAL_RETURN_BUTTON; + // const buttonText = COPY.MODAL_RETURN_BUTTON; + const buttonAssign = COPY.MODAL_ASSIGN_BUTTON; test('Submission button for BVA Intake to VHA CAMO has correct CSS class', () => { renderAssignToView(TASK_ACTIONS.BVA_INTAKE_RETURN_TO_CAMO.value, returnToOrgData, taskType); - const submissionButton = screen.getByText(buttonText).closest('button'); + const submissionButton = screen.getByText(buttonAssign).closest('button'); expect(submissionButton).toHaveClass('usa-button'); expect(submissionButton).not.toHaveClass('usa-button-secondary'); @@ -63,20 +62,20 @@ describe('Whenever BVA Intake returns an appeal to', () => { it('VHA CAMO', () => { renderAssignToView(TASK_ACTIONS.BVA_INTAKE_RETURN_TO_CAMO.value, returnToOrgData, taskType); - expect(screen.getByText(buttonText).closest('button')).toBeDisabled(); + expect(screen.getByText(buttonAssign).closest('button')).toBeDisabled(); enterTextFieldOptions( 'Provide instructions and context for this action', 'Here is the context that you have requested.' ); - expect(screen.getByText(buttonText).closest('button')).not.toBeDisabled(); + expect(screen.getByText(buttonAssign).closest('button')).not.toBeDisabled(); }); test('Submission button for BVA Intake to VHA CSP has correct CSS class', () => { renderAssignToView(TASK_ACTIONS.BVA_INTAKE_RETURN_TO_CAREGIVER.value, returnToOrgData, taskType); - const submissionButton = screen.getByText(buttonText).closest('button'); + const submissionButton = screen.getByText(buttonAssign).closest('button'); expect(submissionButton).toHaveClass('usa-button'); expect(submissionButton).not.toHaveClass('usa-button-secondary'); @@ -85,20 +84,20 @@ describe('Whenever BVA Intake returns an appeal to', () => { it('VHA Caregiver Support Program (CSP)', () => { renderAssignToView(TASK_ACTIONS.BVA_INTAKE_RETURN_TO_CAREGIVER.value, returnToOrgData, taskType); - expect(screen.getByText(buttonText).closest('button')).toBeDisabled(); + expect(screen.getByText(buttonAssign).closest('button')).toBeDisabled(); enterTextFieldOptions( 'Provide instructions and context for this action', 'Here is the context that you have requested.' ); - expect(screen.getByText(buttonText).closest('button')).not.toBeDisabled(); + expect(screen.getByText(buttonAssign).closest('button')).not.toBeDisabled(); }); test('Submission button for BVA Intake to EMO has correct CSS class', () => { renderAssignToView(TASK_ACTIONS.BVA_INTAKE_RETURN_TO_EMO.value, returnToOrgData, taskType); - const submissionButton = screen.getByText(buttonText).closest('button'); + const submissionButton = screen.getByText(buttonAssign).closest('button'); expect(submissionButton).toHaveClass('usa-button'); expect(submissionButton).not.toHaveClass('usa-button-secondary'); @@ -107,37 +106,37 @@ describe('Whenever BVA Intake returns an appeal to', () => { it('Education Service (EMO)', () => { renderAssignToView(TASK_ACTIONS.BVA_INTAKE_RETURN_TO_EMO.value, returnToOrgData, taskType); - expect(screen.getByText(buttonText).closest('button')).toBeDisabled(); + expect(screen.getByText(buttonAssign).closest('button')).toBeDisabled(); enterTextFieldOptions( 'Provide instructions and context for this action', 'Here is the context that you have requested.' ); - expect(screen.getByText(buttonText).closest('button')).not.toBeDisabled(); + expect(screen.getByText(buttonAssign).closest('button')).not.toBeDisabled(); }); }); describe('Whenever the EMO assigns an appeal to a Regional Processing Office', () => { const taskType = 'EducationDocumentSearchTask'; - const buttonText = COPY.MODAL_ASSIGN_BUTTON; + const buttonAssign = COPY.MODAL_ASSIGN_BUTTON; it('Button Disabled until a RPO is chosen from the dropdown', () => { renderAssignToView(TASK_ACTIONS.EMO_ASSIGN_TO_RPO.value, emoToBvaIntakeData, taskType); - expect(screen.getByText(buttonText).closest('button')).toBeDisabled(); + expect(screen.getByText(buttonAssign).closest('button')).toBeDisabled(); selectFromDropdown( - 'Assign to selector', + 'Assign To', 'Buffalo RPO' ); - expect(screen.getByText(buttonText).closest('button')).not.toBeDisabled(); + expect(screen.getByText(buttonAssign).closest('button')).not.toBeDisabled(); }); test('Submission button has correct CSS class', () => { renderAssignToView(TASK_ACTIONS.EMO_ASSIGN_TO_RPO.value, emoToBvaIntakeData, taskType); - const submissionButton = screen.getByText(buttonText).closest('button'); + const submissionButton = screen.getByText(buttonAssign).closest('button'); expect(submissionButton).toHaveClass('usa-button'); expect(submissionButton).not.toHaveClass('usa-button-secondary'); @@ -153,7 +152,7 @@ describe('Whenever VHA CAMO assigns an appeal to a Program Office', () => { expect(screen.getByText(buttonText).closest('button')).toBeDisabled(); selectFromDropdown( - 'Assign to selector', + 'Assign To', 'Prosthetics' ); diff --git a/lib/tasks/seed_legacy_appeals.rake b/lib/tasks/seed_legacy_appeals.rake index d22c627e9f9..5a83b11a646 100644 --- a/lib/tasks/seed_legacy_appeals.rake +++ b/lib/tasks/seed_legacy_appeals.rake @@ -2,6 +2,8 @@ # to create legacy appeals with MST/PACT issues, run "bundle exec rake 'db:generate_legacy_appeals[true]'"" # to create without, run "bundle exec rake db:generate_legacy_appeals" + +# rubocop:disable all namespace :db do desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them" task :generate_legacy_appeals, [:add_special_issues] => :environment do |_, args| @@ -140,3 +142,4 @@ namespace :db do end end end +# rubocop:enable all diff --git a/scripts/enable_features_dev.rb b/scripts/enable_features_dev.rb index 594d76f70f2..102c0fb462f 100644 --- a/scripts/enable_features_dev.rb +++ b/scripts/enable_features_dev.rb @@ -58,9 +58,9 @@ def call cavc_dashboard_workflow poa_auto_refresh interface_version_2 - cc_vacatur_visibility, - acd_disable_legacy_distributions, - acd_disable_nonpriority_distributions, + cc_vacatur_visibility + acd_disable_legacy_distributions + acd_disable_nonpriority_distributions acd_disable_legacy_lock_ready_appeals ] diff --git a/spec/feature/hearings/change_hearing_disposition_spec.rb b/spec/feature/hearings/change_hearing_disposition_spec.rb index 944ebc80482..803c0b7a1c5 100644 --- a/spec/feature/hearings/change_hearing_disposition_spec.rb +++ b/spec/feature/hearings/change_hearing_disposition_spec.rb @@ -3,7 +3,9 @@ RSpec.shared_examples "Change hearing disposition" do let(:current_full_name) { "Leonela Harbold" } let(:staff_record) { create(:staff) } - let(:hearing_admin_user) { create(:user, full_name: current_full_name, station_id: 101, vacols_uniq_id: staff_record.slogid) } + let(:hearing_admin_user) do + create(:user, full_name: current_full_name, station_id: 101, vacols_uniq_id: staff_record.slogid) + end let(:veteran_link_text) { "#{appeal.veteran_full_name} (#{appeal.veteran_file_number})" } let(:root_task) { create(:root_task, appeal: appeal) } let(:hearing_task) { create(:hearing_task, parent: root_task) } @@ -76,14 +78,14 @@ step "visit and verify that the new hearing disposition is in the hearing schedule daily docket" do User.authenticate!(user: hearing_user) - visit "/hearings/schedule/docket/" + hearing.hearing_day.id.to_s + visit "/hearings/schedule/docket/#{hearing.hearing_day.id}" expect(dropdown_selected_value(find(".dropdown-#{hearing.uuid}-disposition"))).to eq( Constants.HEARING_DISPOSITION_TYPE_TO_LABEL_MAP.held ) end step "visit and verify that the new hearing disposition is on the hearing details page" do - visit "hearings/" + hearing.external_id.to_s + "/details" + visit "hearings/#{hearing.external_id}/details" disposition_div = find("p", text: "DISPOSITION").first(:xpath, "ancestor::div") expect(disposition_div).to have_css("div", text: Constants.HEARING_DISPOSITION_TYPE_TO_LABEL_MAP.held) end @@ -374,7 +376,9 @@ context "there are other hearing admin and hearings management members" do let(:other_admin_full_name) { "Remika Hanisco" } let(:staff_record) { create(:staff) } - let!(:other_admin_user) { create(:user, full_name: other_admin_full_name, station_id: 101, vacols_uniq_id: staff_record.slogid) } + let!(:other_admin_user) do + create(:user, full_name: other_admin_full_name, station_id: 101, vacols_uniq_id: staff_record.slogid) + end let(:admin_full_names) { ["Bisar Helget", "Rose Hidrogo", "Rihab Hancin", "Abby Hudmon"] } let(:mgmt_full_names) { ["Claudia Heraty", "Nouf Heigl", "Hayley Houlahan", "Bahiya Haese"] } let(:assign_instructions_text) { "This is why I'm assigning this to you." } @@ -410,7 +414,8 @@ fill_in COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: assign_instructions_text click_on "Assign" - expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, other_admin_full_name)) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, + other_admin_full_name)) end step "the other user logs in and sees the task in their queue" do @@ -439,7 +444,8 @@ fill_in COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: assign_instructions_text click_on "Assign" - expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, current_full_name)) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, + current_full_name)) end step "the task in my personal queue" do diff --git a/spec/feature/queue/ama_queue_spec.rb b/spec/feature/queue/ama_queue_spec.rb index 3285739c771..b183e8be28c 100644 --- a/spec/feature/queue/ama_queue_spec.rb +++ b/spec/feature/queue/ama_queue_spec.rb @@ -274,7 +274,8 @@ def valid_document_id click_on COPY::MODAL_ASSIGN_BUTTON expect(page).to have_content( - format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeals[0].veteran.first_name + " " + appeals[0].veteran.last_name, user_name) + format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, + "#{appeals[0].veteran.first_name} #{appeals[0].veteran.last_name}", user_name) ) old_task = translation_task.reload.children.find { |task| task.assigned_to == other_user } expect(old_task.status).to eq(Constants.TASK_STATUSES.cancelled) @@ -748,7 +749,8 @@ def judge_assign_to_attorney click_on "Assign" # binding.pry # expect(page).to have_content("Task reassigned to #{judge_user2.full_name}") - expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, "Andrea Harless")) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, + "Andrea Harless")) end step "judge2 has the case in their queue" do User.authenticate!(user: judge_user2) diff --git a/spec/feature/queue/cavc_task_queue_spec.rb b/spec/feature/queue/cavc_task_queue_spec.rb index 0491c852dbd..f7c4947158e 100644 --- a/spec/feature/queue/cavc_task_queue_spec.rb +++ b/spec/feature/queue/cavc_task_queue_spec.rb @@ -579,13 +579,14 @@ expect(page).to have_content Constants.TASK_ACTIONS.REASSIGN_TO_PERSON.label find("div", class: "cf-select__option", text: Constants.TASK_ACTIONS.REASSIGN_TO_PERSON.label).click - within all(".cf-select")[1] do - find(".cf-select__control", text: COPY::ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER).click - find("div", class: "cf-select__option", text: org_nonadmin2.full_name).click - end + within all(".cf-select")[1] do + find(".cf-select__control", text: COPY::ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER).click + find("div", class: "cf-select__option", text: org_nonadmin2.full_name).click + end fill_in "taskInstructions", with: "Going fishing. Handing off to you." click_on "Assign" - expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, task.appeal.veteran_full_name, org_nonadmin2.full_name)) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, task.appeal.veteran_full_name, + org_nonadmin2.full_name)) end end end @@ -856,13 +857,14 @@ expect(timed_hold_task.parent.assigned_to).to eq org_nonadmin click_dropdown(text: Constants.TASK_ACTIONS.REASSIGN_TO_PERSON.label) - within all(".cf-select")[1] do - find(".cf-select__control", text: COPY::ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER).click - end + within all(".cf-select")[1] do + find(".cf-select__control", text: COPY::ASSIGN_WIDGET_USER_DROPDOWN_PLACEHOLDER).click + end find("div", class: "cf-select__option", text: org_nonadmin2.full_name).click fill_in "taskInstructions", with: "Reassigning to org_nonadmin3 to check that TimedHoldTask moves." click_on "Assign" - expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, task.appeal.veteran_full_name, org_nonadmin2.full_name)) + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, task.appeal.veteran_full_name, + org_nonadmin2.full_name)) # open timed_hold_task is moved to new parent task assigned to org_nonadmin2 expect(timed_hold_task.reload.parent.assigned_to).to eq org_nonadmin2 diff --git a/spec/feature/queue/judge_assignment_spec.rb b/spec/feature/queue/judge_assignment_spec.rb index 734e2683ea1..f159d44309d 100644 --- a/spec/feature/queue/judge_assignment_spec.rb +++ b/spec/feature/queue/judge_assignment_spec.rb @@ -263,7 +263,8 @@ appeal.reload.tasks.update_all(status: Constants.TASK_STATUSES.cancelled) click_on("Assign") - expect(page).to have_content("You have successfully assigned #{appeal.veteran_first_name} #{appeal.veteran_last_name}’s case to #{judge_two.full_name}") + expect(page).to have_content("You have successfully assigned #{appeal.veteran_first_name} " \ + "#{appeal.veteran_last_name}’s case to #{judge_two.full_name}") click_on("Switch views") click_on(format(COPY::JUDGE_ASSIGN_DROPDOWN_LINK_LABEL, judge_one.css_id)) @@ -342,7 +343,8 @@ fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") click_on("Assign") - expect(page).to have_content("You have successfully assigned #{appeal_one.veteran_first_name} #{appeal_one.veteran_last_name}'s case to #{judge_two.full_name}") + expect(page).to have_content("You have successfully assigned #{appeal_one.veteran_first_name} " \ + "#{appeal_one.veteran_last_name}'s case to #{judge_two.full_name}") end end @@ -359,7 +361,8 @@ fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") click_on("Assign") - expect(page).to have_content("You have successfully assigned #{appeal_one.veteran_first_name} #{appeal_one.veteran_last_name}'s case to #{judge_one.full_name}") + expect(page).to have_content("You have successfully assigned #{appeal_one.veteran_first_name} " \ + "#{appeal_one.veteran_last_name}'s case to #{judge_one.full_name}") end end diff --git a/spec/feature/queue/scm_judge_assignment_spec.rb b/spec/feature/queue/scm_judge_assignment_spec.rb index 0157299e51b..35650fc20c8 100644 --- a/spec/feature/queue/scm_judge_assignment_spec.rb +++ b/spec/feature/queue/scm_judge_assignment_spec.rb @@ -146,8 +146,8 @@ instructions = "#{judge_one.full_name} is on leave. Please take over this case" fill_in("taskInstructions", with: instructions) click_on("Assign") - expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, judge_two.full_name)) - + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, + judge_two.full_name)) visit "/queue/appeals/#{appeal.external_id}" expect(page).to have_content("ASSIGNED TO\n#{judge_two.css_id}") expect(page).to have_content("ASSIGNED BY\n#{assigner_name}") @@ -166,7 +166,8 @@ fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: instructions) click_on("Assign") - expect(page).to have_content("You have successfully assigned #{appeal.veteran_full_name}'s case to #{attorney_one.full_name}") + expect(page).to have_content("You have successfully assigned #{appeal.veteran_full_name}'s case to " \ + "#{attorney_one.full_name}") visit "/queue/appeals/#{appeal.external_id}" expect(page).to have_content("ASSIGNED TO\n#{attorney_one.css_id}") @@ -185,7 +186,8 @@ click_dropdown(prompt: "Select", text: attorney_two.full_name) end click_on("Assign") - expect(page).to have_content("You have successfully reassigned #{appeal.veteran_full_name}'s case to #{attorney_two.full_name}") + expect(page).to have_content("You have successfully reassigned #{appeal.veteran_full_name}'s case to " \ + "#{attorney_two.full_name}") visit "/queue/appeals/#{appeal.external_id}" active_tasks_section = page.find("#currently-active-tasks") @@ -242,7 +244,8 @@ end fill_in("taskInstructions", with: "#{judge_one.full_name} is on leave. Please take over this case") click_on("Assign") - expect(page).to have_content("You have successfully assigned #{legacy_appeal.veteran_full_name}’s case to #{judge_two.full_name}") + expect(page).to have_content("You have successfully assigned #{legacy_appeal.veteran_full_name}’s case to " \ + "#{judge_two.full_name}") visit "/queue/appeals/#{legacy_appeal.external_id}" expect(page).to have_content("ASSIGNED TO\n#{judge_two.vacols_uniq_id}") diff --git a/spec/feature/queue/special_case_movement_task_spec.rb b/spec/feature/queue/special_case_movement_task_spec.rb index 986e11cbf4a..552b0f2ed75 100644 --- a/spec/feature/queue/special_case_movement_task_spec.rb +++ b/spec/feature/queue/special_case_movement_task_spec.rb @@ -35,8 +35,7 @@ click_button("Assign") # expect(page).to have_content(COPY::ASSIGN_TASK_SUCCESS_MESSAGE % judge_user.full_name) - expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, - appeal.veteran_full_name, + expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, judge_user.full_name)) # Auth as judge user User.authenticate!(user: judge_user) diff --git a/spec/fixes/investigate_scm_cant_reassign_spec.rb b/spec/fixes/investigate_scm_cant_reassign_spec.rb index 3900d1841e1..192963b415f 100644 --- a/spec/fixes/investigate_scm_cant_reassign_spec.rb +++ b/spec/fixes/investigate_scm_cant_reassign_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require "helpers/sanitized_json_configuration.rb" -require "helpers/sanitized_json_importer.rb" +require "helpers/sanitized_json_configuration" +require "helpers/sanitized_json_importer" feature "CaseMovementTeam task actions" do let(:attorney_user) { create(:user, station_id: User::BOARD_STATION_ID, full_name: "Talam") } @@ -32,9 +32,9 @@ click_dropdown(prompt: "Select a user", text: "Other") # Clicking on "Other" and starting to type "TALAM" shows the attorney. - within all(".cf-select")[2] do - click_dropdown(prompt: "Select", text: attorney_user.full_name) - end + within all(".cf-select")[2] do + click_dropdown(prompt: "Select", text: attorney_user.full_name) + end fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "\nSCM user reassigning to different attorney") # Clicking Submit button shows an "Error assigning tasks" error banner in the modal diff --git a/spec/models/legacy_tasks/judge_legacy_task_spec.rb b/spec/models/legacy_tasks/judge_legacy_task_spec.rb index 3c154f6c12b..72adbbae61c 100644 --- a/spec/models/legacy_tasks/judge_legacy_task_spec.rb +++ b/spec/models/legacy_tasks/judge_legacy_task_spec.rb @@ -17,7 +17,7 @@ JudgeLegacyTask.from_vacols( case_assignment, LegacyAppeal.create(vacols_id: vacols_id, case_record: vacols_case), - judge, + judge ) end let(:case_assignment) do diff --git a/spec/models/post_send_initial_notification_letter_holding_task_spec.rb b/spec/models/post_send_initial_notification_letter_holding_task_spec.rb index eb968481bf0..b0689d35d89 100644 --- a/spec/models/post_send_initial_notification_letter_holding_task_spec.rb +++ b/spec/models/post_send_initial_notification_letter_holding_task_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative "./send_notification_shared_examples_spec.rb" +require_relative "./send_notification_shared_examples_spec" describe PostSendInitialNotificationLetterHoldingTask do let(:user) { create(:user) } diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb index 7618d222090..eb317bc138c 100644 --- a/spec/models/task_spec.rb +++ b/spec/models/task_spec.rb @@ -1329,7 +1329,9 @@ let!(:attorney) { create(:user) } let!(:appeal) { create(:appeal) } let!(:task) { create(:task, type: Task.name, appeal: appeal) } - let(:params) { { assigned_to: judge, assigned_to_id: judge.id, appeal: task.appeal, parent_id: task.id, type: Task.name } } + let(:params) do + { assigned_to: judge, assigned_to_id: judge.id, appeal: task.appeal, parent_id: task.id, type: Task.name } + end before do create(:staff, :judge_role, sdomainid: judge.css_id) diff --git a/spec/models/tasks/judge_task_spec.rb b/spec/models/tasks/judge_task_spec.rb index f7c0101b656..6e19b3b346e 100644 --- a/spec/models/tasks/judge_task_spec.rb +++ b/spec/models/tasks/judge_task_spec.rb @@ -294,7 +294,7 @@ it "merges instruction text" do subject - expect(jqr_task.reload.instructions).to eq([existing_instructions,new_instructions]) + expect(jqr_task.reload.instructions).to eq([existing_instructions, new_instructions]) end end diff --git a/spec/models/vacols/case_docket_spec.rb b/spec/models/vacols/case_docket_spec.rb index fcb6d3bda6b..549d5e4c30d 100644 --- a/spec/models/vacols/case_docket_spec.rb +++ b/spec/models/vacols/case_docket_spec.rb @@ -658,4 +658,4 @@ expect(nonpriority_ready_case.reload.bfcurloc).to eq(judge.vacols_uniq_id) end end -end \ No newline at end of file +end From 10af8e70722f48d386ee6257e204f264124192e1 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:03:36 -0400 Subject: [PATCH 202/203] Fixed instructions label for broken rspecs (#19669) --- spec/feature/hearings/change_hearing_disposition_spec.rb | 4 ++-- .../feature/hearings/schedule_veteran/build_hearsched_spec.rb | 2 +- spec/feature/queue/ama_queue_spec.rb | 4 ++-- spec/feature/queue/judge_assignment_spec.rb | 2 +- spec/feature/queue/scm_judge_assignment_spec.rb | 4 ++-- spec/fixes/investigate_scm_cant_reassign_spec.rb | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/feature/hearings/change_hearing_disposition_spec.rb b/spec/feature/hearings/change_hearing_disposition_spec.rb index 803c0b7a1c5..82593ddefb1 100644 --- a/spec/feature/hearings/change_hearing_disposition_spec.rb +++ b/spec/feature/hearings/change_hearing_disposition_spec.rb @@ -412,7 +412,7 @@ expect(choices).to include(*admin_full_names) expect(choices).to_not include(*mgmt_full_names) - fill_in COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: assign_instructions_text + fill_in COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: assign_instructions_text click_on "Assign" expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, other_admin_full_name)) @@ -442,7 +442,7 @@ step "assign the task to self" do click_dropdown(prompt: "Select an action", text: "Assign to person") - fill_in COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: assign_instructions_text + fill_in COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: assign_instructions_text click_on "Assign" expect(page).to have_content(format(COPY::REASSIGN_TASK_SUCCESS_MESSAGE_SCM, appeal.veteran_full_name, current_full_name)) diff --git a/spec/feature/hearings/schedule_veteran/build_hearsched_spec.rb b/spec/feature/hearings/schedule_veteran/build_hearsched_spec.rb index 69547f009af..4be53e3efc7 100644 --- a/spec/feature/hearings/schedule_veteran/build_hearsched_spec.rb +++ b/spec/feature/hearings/schedule_veteran/build_hearsched_spec.rb @@ -572,7 +572,7 @@ def format_hearing_day(hearing_day, detail_label = nil, total_slots = 0) end click_dropdown({ text: other_user.full_name }, find(".cf-modal-body")) - fill_in COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "Reassign" + fill_in COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: "Reassign" click_on "Assign" # Case should exist in other users' queue diff --git a/spec/feature/queue/ama_queue_spec.rb b/spec/feature/queue/ama_queue_spec.rb index b183e8be28c..05a031a208b 100644 --- a/spec/feature/queue/ama_queue_spec.rb +++ b/spec/feature/queue/ama_queue_spec.rb @@ -464,7 +464,7 @@ def judge_assign_to_attorney click_dropdown(prompt: "Select an action", text: "Assign to attorney") click_dropdown(prompt: "Select a user", text: attorney_user.full_name) - fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") + fill_in(COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: "note") click_on "Assign" expect(page).to have_content("You have successfully assigned Tom Brady's case to #{attorney_user.full_name}") @@ -785,7 +785,7 @@ def judge_assign_to_attorney within all(".cf-select")[1] do click_dropdown(prompt: "Select", text: attorney_user.full_name) end - fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") + fill_in(COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: "note") click_on "Assign" expect(page).to have_content("You have successfully assigned Tom Brady's case to #{attorney_user.full_name}") diff --git a/spec/feature/queue/judge_assignment_spec.rb b/spec/feature/queue/judge_assignment_spec.rb index dc1ffbe52a3..2e5f47a02b7 100644 --- a/spec/feature/queue/judge_assignment_spec.rb +++ b/spec/feature/queue/judge_assignment_spec.rb @@ -289,7 +289,7 @@ click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.label) click_dropdown(prompt: "Select a user", text: attorney_one.full_name) - fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") + fill_in(COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: "note") click_on("Assign") expect(page).to have_content("You have successfully assigned 1 case to #{attorney_one.full_name}") diff --git a/spec/feature/queue/scm_judge_assignment_spec.rb b/spec/feature/queue/scm_judge_assignment_spec.rb index 35650fc20c8..2929a4a1a21 100644 --- a/spec/feature/queue/scm_judge_assignment_spec.rb +++ b/spec/feature/queue/scm_judge_assignment_spec.rb @@ -163,7 +163,7 @@ click_dropdown(prompt: "Select", text: attorney_one.full_name) end instructions = "#{judge_one.full_name} is on leave. Please draft a decision for this case" - fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: instructions) + fill_in(COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: instructions) click_on("Assign") expect(page).to have_content("You have successfully assigned #{appeal.veteran_full_name}'s case to " \ @@ -262,7 +262,7 @@ end instructions = "#{judge_one.full_name} is on leave. Please draft a decision for this case" - fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: instructions) + fill_in(COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: instructions) click_on("Assign") expect(page).to have_content("You have successfully assigned 1 case to #{attorney_one.full_name}") diff --git a/spec/fixes/investigate_scm_cant_reassign_spec.rb b/spec/fixes/investigate_scm_cant_reassign_spec.rb index 192963b415f..df5406b9335 100644 --- a/spec/fixes/investigate_scm_cant_reassign_spec.rb +++ b/spec/fixes/investigate_scm_cant_reassign_spec.rb @@ -35,7 +35,7 @@ within all(".cf-select")[2] do click_dropdown(prompt: "Select", text: attorney_user.full_name) end - fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "\nSCM user reassigning to different attorney") + fill_in(COPY::PROVIDE_INSTRUCTIONS_AND_CONTEXT_LABEL, with: "\nSCM user reassigning to different attorney") # Clicking Submit button shows an "Error assigning tasks" error banner in the modal # (and an error message in the DevTools console). From 4e0b69728953801c54331389b251d8f081117e86 Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 6 Oct 2023 13:12:44 -0400 Subject: [PATCH 203/203] Calvin/feature/appeals 24914 master rspec fixes (#19670) * Fixed instructions label for broken rspecs * fix new rspec errors brought in from master --- spec/feature/queue/mail_task_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/feature/queue/mail_task_spec.rb b/spec/feature/queue/mail_task_spec.rb index d34986a8a46..4be61bfda15 100644 --- a/spec/feature/queue/mail_task_spec.rb +++ b/spec/feature/queue/mail_task_spec.rb @@ -223,7 +223,7 @@ end context "changing task type" do - it "submit button starts out disabled" do + it "assign button starts out disabled" do visit("queue/appeals/#{appeal.uuid}") within("tr", text: "TASK", match: :first) do click_dropdown(prompt: COPY::TASK_ACTION_DROPDOWN_BOX_LABEL, @@ -268,7 +268,7 @@ end context "assigning to new team" do - it "submit button starts out disabled" do + it "assign button starts out disabled" do visit("queue/appeals/#{appeal.uuid}") within("tr", text: "TASK", match: :first) do click_dropdown(prompt: COPY::TASK_ACTION_DROPDOWN_BOX_LABEL, @@ -276,7 +276,7 @@ match: :first) end modal = find(".cf-modal-body") - expect(modal).to have_button("Submit", disabled: true) + expect(modal).to have_button("Assign", disabled: true) end it "assigns to new team" do @@ -290,7 +290,7 @@ find(".cf-select__control", text: "Select a team", match: :first).click find(".cf-select__option", text: "BVA Intake").click fill_in("taskInstructions", with: "instructions") - click_button("Submit") + click_button("Assign") new_task = appeal.tasks.last visit(page) most_recent_task = find("tr", text: "TASK", match: :first) @@ -300,7 +300,7 @@ end context "assigning to person" do - it "submit button starts out disabled" do + it "assign button starts out disabled" do visit("queue/appeals/#{appeal.uuid}") within("tr", text: "TASK", match: :first) do click_dropdown(prompt: COPY::TASK_ACTION_DROPDOWN_BOX_LABEL, @@ -308,7 +308,7 @@ match: :first) end modal = find(".cf-modal-body") - expect(modal).to have_button("Submit", disabled: true) + expect(modal).to have_button("Assign", disabled: true) end it "assigns to person" do @@ -324,7 +324,7 @@ find(".cf-select__control", text: User.current_user.full_name).click find(".cf-select__option", text: new_user.full_name).click fill_in("taskInstructions", with: "instructions") - click_button("Submit") + click_button("Assign") new_task = appeal.tasks.last visit(page) most_recent_task = find("tr", text: "TASK", match: :first)