From af76dad0b229bf7f3f48b7f61268c59087d3e97a Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Tue, 31 Aug 2021 13:50:13 +0500 Subject: [PATCH] Added null check for ClusterSections table --- src/pages/Cluster/ClusterSections.jsx | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/pages/Cluster/ClusterSections.jsx b/src/pages/Cluster/ClusterSections.jsx index 7847b33..69241c7 100644 --- a/src/pages/Cluster/ClusterSections.jsx +++ b/src/pages/Cluster/ClusterSections.jsx @@ -157,28 +157,28 @@ export default function ClusterSections({ clusterData }) { id: well.id, caption: well.caption, sectionType: section.caption, - sectionWellDepthPlan: section.plan.wellDepthEnd, - sectionWellDepthFact: section.fact.wellDepthEnd, + sectionWellDepthPlan: section.plan?.wellDepthEnd, + sectionWellDepthFact: section.fact?.wellDepthEnd, sectionBuildDaysPlan: ( - (new Date(section.plan.end) - new Date(section.plan.start)) / + (new Date(section.plan?.end) - new Date(section.plan?.start)) / (1000 * 60 * 60 * 24) ).toFixed(2), sectionBuildDaysFact: ( - (new Date(section.fact.end) - new Date(section.fact.start)) / + (new Date(section.fact?.end) - new Date(section.fact?.start)) / (1000 * 60 * 60 * 24) ).toFixed(2), - sectionRateOfPenetrationPlan: section.plan.rop.toFixed(2), - sectionRateOfPenetrationFact: section.fact.rop.toFixed(2), - sectionRouteSpeedPlan: section.plan.routeSpeed.toFixed(2), - sectionRouteSpeedFact: section.fact.routeSpeed.toFixed(2), - sectionBhaDownSpeedPlan: section.plan.bhaDownSpeed.toFixed(2), - sectionBhaDownSpeedFact: section.fact.bhaDownSpeed.toFixed(2), - sectionBhaUpSpeedPlan: section.plan.bhaUpSpeed.toFixed(2), - sectionBhaUpSpeedFact: section.fact.bhaUpSpeed.toFixed(2), - sectionCasingDownSpeedPlan: section.plan.casingDownSpeed.toFixed(2), - sectionCasingDownSpeedFact: section.fact.casingDownSpeed.toFixed(2), - nonProductiveTimePlan: section.plan.nonProductiveHours.toFixed(2), - nonProductiveTimeFact: section.fact.nonProductiveHours.toFixed(2), + sectionRateOfPenetrationPlan: section.plan?.rop.toFixed(2), + sectionRateOfPenetrationFact: section.fact?.rop.toFixed(2), + sectionRouteSpeedPlan: section.plan?.routeSpeed.toFixed(2), + sectionRouteSpeedFact: section.fact?.routeSpeed.toFixed(2), + sectionBhaDownSpeedPlan: section.plan?.bhaDownSpeed.toFixed(2), + sectionBhaDownSpeedFact: section.fact?.bhaDownSpeed.toFixed(2), + sectionBhaUpSpeedPlan: section.plan?.bhaUpSpeed.toFixed(2), + sectionBhaUpSpeedFact: section.fact?.bhaUpSpeed.toFixed(2), + sectionCasingDownSpeedPlan: section.plan?.casingDownSpeed.toFixed(2), + sectionCasingDownSpeedFact: section.fact?.casingDownSpeed.toFixed(2), + nonProductiveTimePlan: section.plan?.nonProductiveHours.toFixed(2), + nonProductiveTimeFact: section.fact?.nonProductiveHours.toFixed(2), companies: well.companies, };