forked from ddrilling/asb_cloud_front
сортировка по дате теперь используется из фабрики
This commit is contained in:
parent
95cfc93048
commit
c5c134071f
@ -55,7 +55,7 @@ export const ArchiveDisplay = ({data, startDate, interval, onWheel}) => {
|
||||
style={{ width: '15vw' }}
|
||||
data={chartData}
|
||||
lineGroup={group}
|
||||
interval={interval / 1000}
|
||||
interval={Math.round(interval / 1000)}
|
||||
headerHeight={'50px'}
|
||||
yStart={startDate}
|
||||
/>
|
||||
|
@ -7,7 +7,8 @@ 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'
|
||||
import { normalizeData } from '../TelemetryView'
|
||||
import { makeDateSorter } from '../../components/Table'
|
||||
|
||||
const DATA_COUNT = 2048 // Колличество точек на подгрузку графика
|
||||
const ADDITIVE_PAGES = 2 // Дополнительные данные для графиков
|
||||
@ -105,7 +106,7 @@ export default function Archive({idWell}) {
|
||||
data.forEach(elm => elm.date = new Date(elm.date))
|
||||
setDataSaub((prevDataSaub) => {
|
||||
const newData = [...prevDataSaub, ...normalizeData(data)]
|
||||
newData.sort(sortByDate)
|
||||
newData.sort(makeDateSorter('date'))
|
||||
return cutData(newData, loadedStartDate, loadedEndDate)
|
||||
})
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import SpinPicDisabled from '../../images/SpinDisabled.png'
|
||||
import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker'
|
||||
|
||||
import '../../styles/message.css'
|
||||
import { makeDateSorter } from '../../components/Table'
|
||||
|
||||
const { Option } = Select
|
||||
|
||||
@ -290,7 +291,6 @@ const getIndexOfDrillingBy = (dataSaub) => {
|
||||
return order[idFeedRegulator] ?? -1
|
||||
}
|
||||
|
||||
export const sortByDate = (a, b) => a.date > b.date ? 1 : -1
|
||||
export const normalizeData = (data) => data?.map(item => ({
|
||||
...item,
|
||||
rotorSpeed: item.rotorSpeed < 1 ? 0 : item.rotorSpeed,
|
||||
@ -309,7 +309,7 @@ export default function TelemetryView({ idWell }) {
|
||||
const handleDataSaub = (data) => {
|
||||
if (data) {
|
||||
const dataSaub = normalizeData(data)
|
||||
dataSaub.sort(sortByDate)
|
||||
dataSaub.sort(makeDateSorter('date'))
|
||||
setDataSaub(dataSaub)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user