From c2a2568f72c2a767e8ec284e879b956b59b7b2f1 Mon Sep 17 00:00:00 2001 From: goodmice Date: Tue, 23 Nov 2021 16:13:57 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B4=D0=B8=D0=B0=D0=BF=D0=B0=D0=B7=D0=BE=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B4=D0=B0=D1=82=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Archive/index.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pages/Archive/index.jsx b/src/pages/Archive/index.jsx index 4bac585..e39a1c6 100644 --- a/src/pages/Archive/index.jsx +++ b/src/pages/Archive/index.jsx @@ -105,10 +105,13 @@ export default function Archive({idWell}) { useEffect(() => invokeWebApiWrapperAsync( async () => { - const dates = await TelemetryDataSaubService.getDataDatesRange(idWell) - const startDate = dates && Math.max(dates.from, +dates.to - chartInterval) - setDateLimit(dates ?? { from: 0, to: 0 }) - setStartDate(new Date(startDate || (Date.now() - chartInterval))) + let dates = await TelemetryDataSaubService.getDataDatesRange(idWell) + dates = { + from: new Date(dates?.from ?? 0), + to: new Date(dates?.to ?? 0) + } + setDateLimit(dates) + setStartDate(new Date(Math.max(dates.from, +dates.to - chartInterval))) }, setShowLoader, `Не удалось загрузить диапозон телеметрии для скважины "${idWell}"` @@ -125,7 +128,7 @@ export default function Archive({idWell}) { if (loadingInterval <= 0) return invokeWebApiWrapperAsync( async () => { - const data = await TelemetryDataSaubService.getData(idWell, loadingStartDate.toISOString(), loadingInterval, parseInt(DATA_COUNT * loadingInterval / chartInterval)) + const data = await TelemetryDataSaubService.getData(idWell, loadingStartDate.toISOString(), loadingInterval, DATA_COUNT) const loadedStartDate = new Date(Math.max(+newLoaded.start, +startDate - chartInterval * ADDITIVE_PAGES)) const loadedEndDate = new Date(Math.min(+newLoaded.end, +startDate + chartInterval * (ADDITIVE_PAGES + 1)))