diff --git a/src/containers/pages/InterventionPlan/IRS/report/index.tsx b/src/containers/pages/InterventionPlan/IRS/report/index.tsx index 0ba043c6c2..1084b84098 100644 --- a/src/containers/pages/InterventionPlan/IRS/report/index.tsx +++ b/src/containers/pages/InterventionPlan/IRS/report/index.tsx @@ -192,10 +192,23 @@ class IrsReport extends React.Component & 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);