Добавлена нормализация данных

This commit is contained in:
goodmice 2021-11-15 12:52:02 +05:00
parent 909ed39faf
commit 95cfc93048

View File

@ -7,6 +7,7 @@ import LoaderPortal from '../../components/LoaderPortal'
import { Flex } from '../../components/Grid'
import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker'
import { ArchiveDisplay, cutData } from './ArchiveDisplay'
import { normalizeData, sortByDate } from '../TelemetryView'
const DATA_COUNT = 2048 // Колличество точек на подгрузку графика
const ADDITIVE_PAGES = 2 // Дополнительные данные для графиков
@ -103,8 +104,8 @@ export default function Archive({idWell}) {
if (data) {
data.forEach(elm => elm.date = new Date(elm.date))
setDataSaub((prevDataSaub) => {
const newData = [...prevDataSaub, ...data]
newData.sort((a, b) => a.date > b.date ? 1 : -1)
const newData = [...prevDataSaub, ...normalizeData(data)]
newData.sort(sortByDate)
return cutData(newData, loadedStartDate, loadedEndDate)
})
}