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(
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
const dates = await TelemetryDataSaubService.getDataDatesRange(idWell)
|
let dates = await TelemetryDataSaubService.getDataDatesRange(idWell)
|
||||||
const startDate = dates && Math.max(dates.from, +dates.to - chartInterval)
|
dates = {
|
||||||
setDateLimit(dates ?? { from: 0, to: 0 })
|
from: new Date(dates?.from ?? 0),
|
||||||
setStartDate(new Date(startDate || (Date.now() - chartInterval)))
|
to: new Date(dates?.to ?? 0)
|
||||||
|
}
|
||||||
|
setDateLimit(dates)
|
||||||
|
setStartDate(new Date(Math.max(dates.from, +dates.to - chartInterval)))
|
||||||
},
|
},
|
||||||
setShowLoader,
|
setShowLoader,
|
||||||
`Не удалось загрузить диапозон телеметрии для скважины "${idWell}"`
|
`Не удалось загрузить диапозон телеметрии для скважины "${idWell}"`
|
||||||
@ -125,7 +128,7 @@ export default function Archive({idWell}) {
|
|||||||
if (loadingInterval <= 0) return
|
if (loadingInterval <= 0) return
|
||||||
invokeWebApiWrapperAsync(
|
invokeWebApiWrapperAsync(
|
||||||
async () => {
|
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 loadedStartDate = new Date(Math.max(+newLoaded.start, +startDate - chartInterval * ADDITIVE_PAGES))
|
||||||
const loadedEndDate = new Date(Math.min(+newLoaded.end, +startDate + chartInterval * (ADDITIVE_PAGES + 1)))
|
const loadedEndDate = new Date(Math.min(+newLoaded.end, +startDate + chartInterval * (ADDITIVE_PAGES + 1)))
|
||||||
|
Loading…
Reference in New Issue
Block a user