forked from ddrilling/asb_cloud_front
Обработка диапазона дат исправлена
This commit is contained in:
parent
10ea38c246
commit
c2a2568f72
@ -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)))
|
||||
|
Loading…
Reference in New Issue
Block a user