From 37ac8a14bcba668c23f496de187dcb12cc0d6f14 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Mon, 14 Mar 2022 10:35:47 +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=D0=B0=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D1=81=D1=82=D0=BE=D0=BB=D0=B1=D1=86=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D1=81=D0=BE=D0=B4=D0=B5=D1=80=D0=B6=D0=B8?= =?UTF-8?q?=D0=BC=D0=BE=D0=BC=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Analytics/Statistics.jsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/pages/Analytics/Statistics.jsx b/src/pages/Analytics/Statistics.jsx index 329d919..f52a77e 100644 --- a/src/pages/Analytics/Statistics.jsx +++ b/src/pages/Analytics/Statistics.jsx @@ -90,21 +90,30 @@ export const Statistics = memo(({ idWell }) => { async () => { const types = await WellOperationService.getSectionTypes(idWell) setSectionTypes(Object.entries(types)) + }, + setIsPageLoading, + `Не удалось получить типы секции`, + `Получение списка возможных секций`, + ), [idWell]) + + useEffect(() => invokeWebApiWrapperAsync( + async () => { + const filteredSections = avgData?.length > 0 ? sectionTypes.filter(([id, _]) => avgData.some((row) => `section_${id}` in row)) : sectionTypes + setAvgColumns([ ...defaultColumns, - ...Object.entries(types).map(([id, name]) => makeSectionColumn(name, `section_${id}`)), + ...filteredSections.map(([id, name]) => makeSectionColumn(name, `section_${id}`)), ]) setCmpColumns([ ...defaultColumns, - ...Object.entries(types).map(([id, name]) => makeSectionColumn(name, `section_${id}`, { + ...filteredSections.map(([id, name]) => makeSectionColumn(name, `section_${id}`, { speedRender: cmpSpeedRender(`section_${id}`) })) ]) }, setIsPageLoading, - `Не удалось получить типы секции`, - `Получение списка возможных секций`, - ), [idWell, cmpSpeedRender]) + 'Не удалось установить необходимые столбцы' + ), [sectionTypes, avgData, cmpSpeedRender]) useEffect(() => invokeWebApiWrapperAsync( async () => {