Skip to content

Commit

Permalink
Reverts Caseflow Dispatch Validating (#15081)
Browse files Browse the repository at this point in the history
Connects #14714
Reverts #14047

### Description
No longer requires a selection of Special Issues in Caseflow Dispatch

### Acceptance Criteria
- [ ] Code compiles correctly
- [ ] Caseflow Dispatch can complete without selecting a Special Issue

### Testing Plan
#### FeatureToggle On
1. Feature toggle!
```ruby
> FeatureToggle.enable!(:special_issues_revamp)
> FeatureToggle.enable!(:special_issues_revamp_dispatch)
```
2. Log in as FAKE USER
3. Go to `/dispatch` and hit `Establish New Claim`
4. Hit "Route Claim" while no special issues are selected
5. Confirm success
6. Hit back & select a special issue and hit "Route Claim"
7. confirm success!
  • Loading branch information
lomky authored Sep 1, 2020
1 parent dbe2928 commit 4b6aa72
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 181 deletions.
12 changes: 7 additions & 5 deletions app/models/legacy_appeal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
# Legacy appeals have VACOLS and BGS as dependencies.

class LegacyAppeal < CaseflowRecord
# Reverting changes that supported new contentions in Caseflow Dispatch. See #14714
self.ignored_columns = %w[burn_pit
military_sexual_trauma
blue_water
us_court_of_appeals_for_veterans_claims
no_special_issues]

include AppealConcern
include AssociatedVacolsModel
include BgsService
Expand Down Expand Up @@ -110,9 +117,6 @@ def advanced_on_docket?
# Note: If any of the names here are changed, they must also be changed in SpecialIssues.js 'specialIssue` value
# rubocop:disable Metrics/LineLength
SPECIAL_ISSUES = {
blue_water: "Blue Water",
burn_pit: "Burn Pit",
us_court_of_appeals_for_veterans_claims: "US Court of Appeals for Veterans Claims (CAVC)",
contaminated_water_at_camp_lejeune: "Contaminated Water at Camp LeJeune",
dic_death_or_accrued_benefits_united_states: "DIC - death, or accrued benefits - United States",
education_gi_bill_dependents_educational_assistance_scholars: "Education - GI Bill, dependents educational assistance, scholarship, transfer of entitlement",
Expand All @@ -124,10 +128,8 @@ def advanced_on_docket?
incarcerated_veterans: "Incarcerated Veterans",
insurance: "Insurance",
manlincon_compliance: "Manlincon Compliance",
military_sexual_trauma: "Military Sexual Trauma (MST)",
mustard_gas: "Mustard Gas",
national_cemetery_administration: "National Cemetery Administration",
no_special_issues: "No Special Issues",
nonrating_issue: "Non-rating issue",
pension_united_states: "Pension - United States",
private_attorney_or_agent: "Private Attorney or Agent",
Expand Down
5 changes: 1 addition & 4 deletions app/views/dispatch/establish_claims/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
userDisplayName: current_user.display_name,
dropdownUrls: dropdown_urls,
feedbackUrl: feedback_url,
buildDate: build_date,
featureToggles: {
specialIssuesRevamp: FeatureToggle.enabled?(:special_issues_revamp_dispatch, user: current_user)
}
buildDate: build_date
}) %>
<% end %>
7 changes: 2 additions & 5 deletions client/app/constants/SpecialIssueEnabler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { SPECIAL_ISSUES, NEW_SPECIAL_ISSUES } from './SpecialIssues';
import { SPECIAL_ISSUES, AMA_SPECIAL_ISSUES } from './SpecialIssues';

// NEW_SPECIAL_ISSUES was added to SpecialIssues.jsx in 2020-Spring. Currently listed separately from the main list in
// order to be locked to the FeatureToggle :special_issues_revamp here. As a part of removing the feature toggle,
// merge those arrays and refactor away this file.
export const enabledSpecialIssues = isFeatureToggled => isFeatureToggled ? SPECIAL_ISSUES.concat(NEW_SPECIAL_ISSUES) : SPECIAL_ISSUES
export const enabledSpecialIssues = wantsAmaIssues => wantsAmaIssues ? SPECIAL_ISSUES.concat(AMA_SPECIAL_ISSUES) : SPECIAL_ISSUES
6 changes: 2 additions & 4 deletions client/app/constants/SpecialIssues.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,8 @@ export const SPECIAL_ISSUES = [
}
];

// Special Issues added in 2020-Spring. Currently separate from the above in order to be
// locked to the FeatureToggle :special_issues_revamp in SpecialIssueEnabler. As a part of
// removing the feature toggle these can be cleanly merged into the above array. Reference PR #13781
export const NEW_SPECIAL_ISSUES = [
// Special Issues added in 2020-Spring for AMA appeals use only
export const AMA_SPECIAL_ISSUES = [
{
display: 'Burn Pit',
queueDisplay: 'Burn Pit',
Expand Down
24 changes: 8 additions & 16 deletions client/app/containers/EstablishClaimPage/EstablishClaim.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ export class EstablishClaim extends React.Component {
}

containsRoutedSpecialIssues = () => {
return specialIssueFilters(this.props.featureToggles?.specialIssuesRevamp).routedSpecialIssues().
return specialIssueFilters().routedSpecialIssues().
some((issue) => {
return this.props.specialIssues[issue.specialIssue];
});
};

containsRoutedOrRegionalOfficeSpecialIssues = () => {
return specialIssueFilters(this.props.featureToggles?.specialIssuesRevamp).routedOrRegionalSpecialIssues().
return specialIssueFilters().routedOrRegionalSpecialIssues().
some((issue) => {
return this.props.specialIssues[issue.specialIssue || issue];
});
Expand Down Expand Up @@ -243,8 +243,7 @@ export class EstablishClaim extends React.Component {
getRoutingType = () => {
let stationOfJurisdiction = getStationOfJurisdiction(
this.props.specialIssues,
this.props.task.appeal.station_key,
this.props.featureToggles?.specialIssuesRevamp
this.props.task.appeal.station_key
);

return stationOfJurisdiction === '397' ? 'ARC' : 'Routed';
Expand Down Expand Up @@ -410,8 +409,7 @@ export class EstablishClaim extends React.Component {
claim.date = this.formattedDecisionDate();
claim.stationOfJurisdiction = getStationOfJurisdiction(
this.props.specialIssues,
this.props.task.appeal.station_key,
this.props.featureToggles?.specialIssuesRevamp
this.props.task.appeal.station_key
);

// We have to add in the claimLabel separately, since it is derived from
Expand All @@ -432,7 +430,7 @@ export class EstablishClaim extends React.Component {
return;
}

specialIssueFilters(this.props.featureToggles?.specialIssuesRevamp).unhandledSpecialIssues().
specialIssueFilters().unhandledSpecialIssues().
forEach((issue) => {
if (this.props.specialIssues[issue.specialIssue]) {
this.setState({
Expand All @@ -455,7 +453,7 @@ export class EstablishClaim extends React.Component {
return true;
}

specialIssueFilters(this.props.featureToggles?.specialIssuesRevamp).unhandledSpecialIssues().
specialIssueFilters().unhandledSpecialIssues().
forEach((issue) => {
if (this.props.specialIssues[issue.specialIssue]) {
willCreateEndProduct = false;
Expand All @@ -481,7 +479,6 @@ export class EstablishClaim extends React.Component {
pdfLink={pdfLink}
pdfjsLink={pdfjsLink}
task={this.props.task}
specialIssuesRevamp={this.props.featureToggles?.specialIssuesRevamp}
/>
)}
{this.isAssociatePage() && (
Expand Down Expand Up @@ -511,11 +508,9 @@ export class EstablishClaim extends React.Component {
regionalOfficeKey={this.props.task.appeal.regional_office_key}
regionalOfficeCities={this.props.regionalOfficeCities}
stationKey={this.props.task.appeal.station_key}
specialIssuesRevamp={this.props.featureToggles?.specialIssuesRevamp}
stationOfJurisdiction={getStationOfJurisdiction(
this.props.specialIssues,
this.props.task.appeal.station_key,
this.props.featureToggles?.specialIssuesRevamp
this.props.task.appeal.station_key
)}
/>
)}
Expand All @@ -531,7 +526,6 @@ export class EstablishClaim extends React.Component {
showNotePageAlert={this.state.showNotePageAlert}
displayVacolsNote={decisionType !== FULL_GRANT}
displayVbmsNote={this.containsRoutedOrRegionalOfficeSpecialIssues()}
specialIssuesRevamp={this.props.featureToggles?.specialIssuesRevamp}
/>
)}
{this.isEmailPage() && (
Expand All @@ -552,7 +546,6 @@ export class EstablishClaim extends React.Component {
backToDecisionReviewText={BACK_TO_DECISION_REVIEW_TEXT}
specialIssuesRegionalOffice={this.state.specialIssuesRegionalOffice}
taskId={this.props.task.id}
specialIssuesRevamp={this.props.featureToggles?.specialIssuesRevamp}
/>
)}
<CancelModal
Expand Down Expand Up @@ -580,8 +573,7 @@ EstablishClaim.propTypes = {
submitDecisionPageFailure: PropTypes.func,
beginPerformEstablishClaim: PropTypes.func,
performEstablishClaimSuccess: PropTypes.func,
performEstablishClaimFailure: PropTypes.func,
featureToggles: PropTypes.object
performEstablishClaimFailure: PropTypes.func
};

const mapStateToProps = (state) => ({
Expand Down
70 changes: 10 additions & 60 deletions client/app/containers/EstablishClaimPage/EstablishClaimDecision.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { connect } from 'react-redux';
import * as Constants from '../../establishClaim/constants';
import moment from 'moment';
import { LOGO_COLORS } from '../../constants/AppConstants';
import COPY from '../../../COPY';

export class EstablishClaimDecision extends React.Component {
constructor(props) {
Expand All @@ -27,26 +26,10 @@ export class EstablishClaimDecision extends React.Component {
endProductButtonText = 'Route claim';
}
this.state = {
endProductButtonText,
allIssuesDisabled: props.specialIssues.noSpecialIssues
endProductButtonText
};
}

specialIssuesChange = (checked, event) => {
const specialIssueId = event.target.id;

if (specialIssueId === 'noSpecialIssues') {
this.setState({ allIssuesDisabled: checked });
if (checked) {
// dispatch a clearing of all Special Issues
this.props.clearSpecialIssues();
}
}

// dispatch the update for the box checked
this.props.handleSpecialIssueFieldChange(specialIssueId, checked);
}

onTabSelected = (tabNumber) => {
this.setState({
endProductButtonText: `Route claim for Decision ${tabNumber + 1}`
Expand All @@ -57,36 +40,19 @@ export class EstablishClaimDecision extends React.Component {
return this.props.task.appeal.decisions.length > 1;
}

validate = () => {
const {
specialIssuesRevamp,
specialIssues,
handleSubmit,
showSpecialIssueError
} = this.props;

if (specialIssuesRevamp && Object.values(specialIssues).every((isChecked) => !isChecked)) {
showSpecialIssueError();

return;
}

return handleSubmit();
}

render() {
let {
loading,
decisionType,
handleSubmit,
handleToggleCancelTaskModal,
handleSpecialIssueFieldChange,
pdfLink,
pdfjsLink,
specialIssues,
task,
specialIssuesError
task
} = this.props;

const { allIssuesDisabled } = this.state;
let issueColumns = [
{
header: 'Program',
Expand Down Expand Up @@ -238,24 +204,16 @@ export class EstablishClaimDecision extends React.Component {
<b>Select Special Issues</b>
</label>
</legend>
{specialIssuesError &&
<Alert
title={COPY.SPECIAL_ISSUES_NONE_CHOSEN_TITLE}
message={COPY.SPECIAL_ISSUES_NONE_CHOSEN_DETAIL}
type="error"
/>
}
<div className="cf-multiple-columns">
{enabledSpecialIssues(this.props.specialIssuesRevamp).map((issue, index) => {
{enabledSpecialIssues().map((issue, index) => {
return (
<Checkbox
id={issue.specialIssue}
label={issue.node || issue.display}
name={issue.specialIssue}
onChange={this.specialIssuesChange}
onChange={handleSpecialIssueFieldChange(issue.specialIssue)}
key={index}
value={specialIssues[issue.specialIssue]}
disabled={Boolean(issue.specialIssue !== 'noSpecialIssues' && allIssuesDisabled)}
/>
);
})}
Expand All @@ -272,7 +230,7 @@ export class EstablishClaimDecision extends React.Component {
<Button
app="dispatch"
name={this.state.endProductButtonText}
onClick={this.validate}
onClick={handleSubmit}
loading={loading}
/>
</div>
Expand All @@ -283,43 +241,35 @@ export class EstablishClaimDecision extends React.Component {
}

EstablishClaimDecision.propTypes = {
clearSpecialIssues: PropTypes.func,
decisionType: PropTypes.string.isRequired,
handleSpecialIssueFieldChange: PropTypes.func,
handleSubmit: PropTypes.func.isRequired,
handleToggleCancelTaskModal: PropTypes.func.isRequired,
loading: PropTypes.bool,
pdfLink: PropTypes.string.isRequired,
pdfjsLink: PropTypes.string.isRequired,
showSpecialIssueError: PropTypes.func,
specialIssues: PropTypes.object.isRequired,
specialIssuesChange: PropTypes.func,
specialIssuesError: PropTypes.bool,
specialIssuesRevamp: PropTypes.bool,
task: PropTypes.object.isRequired
};

const mapStateToProps = (state) => ({
specialIssues: state.specialIssues,
specialIssuesError: state.establishClaim.error
specialIssues: state.specialIssues
});

const mapDispatchToProps = (dispatch) => ({
clearSpecialIssues: () => dispatch({ type: Constants.CLEAR_SPECIAL_ISSUES }),
handleToggleCancelTaskModal: () => {
dispatch({ type: Constants.TOGGLE_CANCEL_TASK_MODAL });
},
handleSpecialIssueFieldChange: (specialIssue, value) => {
dispatch({ type: Constants.CLEAR_SPECIAL_ISSUE_ERROR });
handleSpecialIssueFieldChange: (specialIssue) => (value) => {
dispatch({
type: Constants.CHANGE_SPECIAL_ISSUE,
payload: {
specialIssue,
value
}
});
},
showSpecialIssueError: () => dispatch({ type: Constants.SHOW_SPECIAL_ISSUE_ERROR })
}
});

const ConnectedEstablishClaimDecision = connect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class EstablishClaimEmail extends BaseForm {

let specialIssuesStatus = this.props.specialIssues;

const selectedSpecialIssue = enabledSpecialIssues(this.props.specialIssuesRevamp).map((issue) => {
const selectedSpecialIssue = enabledSpecialIssues().map((issue) => {
if (specialIssuesStatus[issue.specialIssue]) {
return issue.display;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export class EstablishClaimForm extends React.Component {
return formattedStationOfJurisdiction(
this.props.stationOfJurisdiction,
this.props.regionalOfficeKey,
this.props.regionalOfficeCities,
this.props.specialIssuesRevamp
this.props.regionalOfficeCities
);
}

Expand Down Expand Up @@ -128,7 +127,6 @@ EstablishClaimForm.propTypes = {
regionalOfficeKey: PropTypes.string.isRequired,
regionalOfficeCities: PropTypes.object.isRequired,
stationOfJurisdiction: PropTypes.object.isRequired,
specialIssuesRevamp: PropTypes.bool.isRequired,
loading: PropTypes.bool.isRequired
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class EstablishClaimNote extends BaseForm {

selectedSpecialIssues() {
return _.reduce(
enabledSpecialIssues(this.props.specialIssuesRevamp),
enabledSpecialIssues(),
(result, issue) => {
if (this.props.specialIssues[issue.specialIssue]) {
result.push(issue.display);
Expand Down
3 changes: 0 additions & 3 deletions client/app/establishClaim/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// actions
export const CHANGE_SPECIAL_ISSUE = 'CHANGE_SPECIAL_ISSUE';
export const CLEAR_SPECIAL_ISSUES = 'CLEAR_SPECIAL_ISSUES';
export const SHOW_SPECIAL_ISSUE_ERROR = 'SHOW_SPECIAL_ISSUE_ERROR';
export const CLEAR_SPECIAL_ISSUE_ERROR = 'CLEAR_SPECIAL_ISSUE_ERROR';
export const CHANGE_ESTABLISH_CLAIM_FIELD = 'CHANGE_ESTABLISH_CLAIM_FIELD';
export const TOGGLE_CANCEL_TASK_MODAL = 'TOGGLE_CANCEL_TASK_MODAL';
export const TRIGGER_LOADING = 'TRIGGER_LOADING';
Expand Down
Loading

0 comments on commit 4b6aa72

Please sign in to comment.