Skip to content

Commit

Permalink
Set irs report location jurisdiction ids manually when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
cKellyDesign committed Sep 20, 2019
1 parent 6a64820 commit f94a793
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/containers/pages/InterventionPlan/IRS/report/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,23 @@ class IrsReport extends React.Component<RouteComponentProps<RouteParams> & IrsRe
);

const planJurByIds = keyBy(planJurArr, j => j.jurisdiction_id);
const jurisdictionsArray = jurArr.map(
(j: AnyJurisdiction) => planJurByIds[j.jurisdiction_id] || j
);

const jurisdictionsArray: AnyJurisdiction[] = jurArr.map((j: AnyJurisdiction) => {
if (planJurByIds[j.jurisdiction_id]) {
const ID =
planJurByIds[j.jurisdiction_id].jurisdiction_id ||
(planJurByIds[j.jurisdiction_id] as any).id;
return {
...planJurByIds[j.jurisdiction_id],
jurisdiction_id: ID,
};
}
const id = j.jurisdiction_id || (j as any).id;
return {
...j,
jurisdiction_id: id,
};
});
fetchJurisdictionsActionCreator(jurisdictionsArray);

const jurisdictionsById = keyBy(jurisdictionsArray, j => j.jurisdiction_id);
Expand Down

0 comments on commit f94a793

Please sign in to comment.