Skip to content

Commit

Permalink
Reassign Case page Task(s) not displaying
Browse files Browse the repository at this point in the history
  • Loading branch information
piedram committed Aug 9, 2023
1 parent f1dbd03 commit 93e8271
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
17 changes: 7 additions & 10 deletions client/app/queue/BlockedAdvanceToJudgeView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, getAllHiaringChildren } from './selectors';

import QueueFlowPage from './components/QueueFlowPage';
import SearchableDropdown from '../components/SearchableDropdown';
Expand Down Expand Up @@ -254,12 +254,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 <React.Fragment>
{this.warningModal()}
Expand All @@ -277,7 +273,7 @@ class BlockedAdvanceToJudgeView extends React.Component {
</div>
<div {...bottomMarginStyling}>{COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_SUBTITLE}</div>
<h3>{COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_TASKS_HEADER}</h3>
{(!appeal.isLegacyAppeal) && <ul>{blockingTasks.map((blockingTask) => this.blockingTaskListItem(blockingTask))}</ul>}
<ul>{blockingTasks.map((blockingTask) => this.blockingTaskListItem(blockingTask))}</ul>
<h3>{COPY.BLOCKED_SPECIAL_CASE_MOVEMENT_PAGE_REASONING_HEADER}</h3>
<RadioField
required
Expand Down Expand Up @@ -317,8 +313,8 @@ BlockedAdvanceToJudgeView.propTypes = {
history: PropTypes.object,
onReceiveAmaTasks: PropTypes.func,
requestSave: PropTypes.func,
rootTask: PropTypes.object,
resetSuccessMessages: PropTypes.func,
currentChildren: PropTypes.array,
allHearingTasks: PropTypes.array,
task: PropTypes.shape({
instructions: PropTypes.string,
Expand All @@ -335,7 +331,8 @@ const mapStateToProps = (state, ownProps) => {
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: getAllHiaringChildren(state, ownProps)
};
};

Expand Down
28 changes: 28 additions & 0 deletions client/app/queue/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,34 @@ export const getAttorneyTasksForJudgeTask = createSelector(
}
);

export const getAllHiaringChildren = 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],
Expand Down

0 comments on commit 93e8271

Please sign in to comment.