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)))