From 0aeef4281172cfe2d0e0df188513b819275d1741 Mon Sep 17 00:00:00 2001 From: goodmice Date: Mon, 28 Nov 2022 05:18:16 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B1=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20map=20=D0=B8=20flat=20=D0=B7=D0=B0=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=D0=B0=20=D0=BD=D0=B0=20flatMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Well/Measure/View.jsx | 4 ++-- src/pages/Well/Telemetry/TelemetryView/dataset.js | 4 ++-- src/pages/Well/WellOperations/Tvd/TLChart.jsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/Well/Measure/View.jsx b/src/pages/Well/Measure/View.jsx index 5f1b24d..59cbca7 100644 --- a/src/pages/Well/Measure/View.jsx +++ b/src/pages/Well/Measure/View.jsx @@ -10,7 +10,7 @@ export const View = memo(({ columns, item }) => !item || !columns?.length ? ( ) : ( - {columns.map((cols, i) => { + {columns.flatMap((cols, i) => { const columnPosition = 1 + i * 2 return cols.map((column, j) => ( @@ -46,6 +46,6 @@ export const View = memo(({ columns, item }) => !item || !columns?.length ? ( )) - }).flat()} + })} )) diff --git a/src/pages/Well/Telemetry/TelemetryView/dataset.js b/src/pages/Well/Telemetry/TelemetryView/dataset.js index 4e90c09..9ff5273 100644 --- a/src/pages/Well/Telemetry/TelemetryView/dataset.js +++ b/src/pages/Well/Telemetry/TelemetryView/dataset.js @@ -33,7 +33,7 @@ export const calcFlowData = (dataSaub, flowChart) => { if (depth > maxDepth) maxDepth = depth return { date: new Date(row.date), depth: row.wellDepth } }) - const out = flowChart.map((flow) => { + const out = flowChart.flatMap((flow) => { if (flow.depthStart > maxDepth || flow.depthEnd < minDepth) return [] const out = [] let i = 0, j = 0 @@ -50,7 +50,7 @@ export const calcFlowData = (dataSaub, flowChart) => { }) } return out - }).flat() + }) return out } diff --git a/src/pages/Well/WellOperations/Tvd/TLChart.jsx b/src/pages/Well/WellOperations/Tvd/TLChart.jsx index e34ba61..c2f3a7b 100644 --- a/src/pages/Well/WellOperations/Tvd/TLChart.jsx +++ b/src/pages/Well/WellOperations/Tvd/TLChart.jsx @@ -81,7 +81,7 @@ export const TLChart = memo(({ invokeWebApiWrapperAsync( async () => { const { operations } = await DetectedOperationService.get(well.id) - setData(operations.map((raw) => { + setData(operations.flatMap((raw) => { const startTime = moment(raw.dateStart) const endTime = moment(raw.dateEnd) return splitByDate(startTime, endTime).map((dt) => ({ @@ -89,7 +89,7 @@ export const TLChart = memo(({ startTime: dt.startTime, endTime: dt.endTime, })) - }).flat()) + })) }, setIsLoading, `Не удалось загрузить список операций`,