From 62e697065308fb93d2752d545bee359d4da1463e Mon Sep 17 00:00:00 2001 From: goodmice Date: Thu, 28 Apr 2022 11:18:39 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=81=D1=82=D0=BE=D0=BB=D0=B1=D0=B5=D1=86=20=D0=B4?= =?UTF-8?q?=D0=BB=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D0=9D=D0=9F=D0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/WellOperations/Tvd/AdditionalTables.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/WellOperations/Tvd/AdditionalTables.jsx b/src/pages/WellOperations/Tvd/AdditionalTables.jsx index 1889b63..d9fd228 100755 --- a/src/pages/WellOperations/Tvd/AdditionalTables.jsx +++ b/src/pages/WellOperations/Tvd/AdditionalTables.jsx @@ -1,5 +1,5 @@ import { Descriptions } from 'antd' -import { memo, useEffect, useState } from 'react' +import { memo, useEffect, useMemo, useState } from 'react' import { makeNumericRender } from '@components/Table' import { invokeWebApiWrapperAsync } from '@components/factory' @@ -21,6 +21,8 @@ const printDate = (date) => formatDate(date) ?? '-' export const AdditionalTables = memo(({ operations, xLabel, setIsLoading }) => { const [additionalData, setAdditionalData] = useState({}) + const nptSum = useMemo(() => operations.fact?.reduce((out, row) => out + (row?.durationHours ?? 0), 0), [operations.fact]) + useEffect(() => invokeWebApiWrapperAsync( async () => { const [factStartDate, factEndDate] = calcEndDate(operations.fact) @@ -49,6 +51,7 @@ export const AdditionalTables = memo(({ operations, xLabel, setIsLoading }) => { {printDate(additionalData.endDate)} {numericRender(additionalData.lag)} + {numericRender(nptSum)}