From f94a793c744dfd4c539709b8b715287adbb34f60 Mon Sep 17 00:00:00 2001 From: cKellyDesign Date: Fri, 20 Sep 2019 13:10:16 -0700 Subject: [PATCH] Set irs report location jurisdiction ids manually when necessary --- .../InterventionPlan/IRS/report/index.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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);