forked from ddrilling/asb_cloud_front
hotfix. CF2-75, CF2-76. Логика исправлена
This commit is contained in:
parent
4c24bdf226
commit
f0fde92af0
@ -179,14 +179,22 @@ export default function TelemetryView({idWell}) {
|
|||||||
|
|
||||||
const options = timePeriodCollection.map((line) => <Option key={line.value}>{line.label}</Option>)
|
const options = timePeriodCollection.map((line) => <Option key={line.value}>{line.label}</Option>)
|
||||||
|
|
||||||
const handleData = (state) => (data) => {
|
const handleDataSaub = (data) => {
|
||||||
if (data && state) {
|
if (data) {
|
||||||
data.forEach((_, idx) => {
|
data.forEach((_, idx) => {
|
||||||
if (data[idx].rotorSpeed < 1)
|
if (data[idx].rotorSpeed < 1)
|
||||||
data[idx].rotorSpeed = 0;
|
data[idx].rotorSpeed = 0;
|
||||||
|
if (data[idx].rotorTorque < 1)
|
||||||
|
data[idx].rotorTorque = 0;
|
||||||
data[idx].blockSpeed = Math.abs(data[idx].blockSpeed)
|
data[idx].blockSpeed = Math.abs(data[idx].blockSpeed)
|
||||||
})
|
})
|
||||||
state(data)
|
setDataSaub(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDataSpin = (data) => {
|
||||||
|
if (data) {
|
||||||
|
setDataSpin(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,14 +203,14 @@ export default function TelemetryView({idWell}) {
|
|||||||
async () => {
|
async () => {
|
||||||
const dataSaub = await TelemetryDataSaubService.getData(idWell, null, chartInterval)
|
const dataSaub = await TelemetryDataSaubService.getData(idWell, null, chartInterval)
|
||||||
const dataSpin = await TelemetryDataSpinService.getData(idWell, null, chartInterval)
|
const dataSpin = await TelemetryDataSpinService.getData(idWell, null, chartInterval)
|
||||||
handleData(setDataSaub)(dataSaub)
|
handleDataSaub(dataSaub)
|
||||||
handleData(setDataSpin)(dataSpin)
|
handleDataSpin(dataSpin)
|
||||||
},
|
},
|
||||||
setShowLoader,
|
setShowLoader,
|
||||||
`Не удалось получить данные по скважине "${idWell}"`,
|
`Не удалось получить данные по скважине "${idWell}"`,
|
||||||
)
|
)
|
||||||
const unsubscribeSaub = Subscribe('hubs/telemetry', 'ReceiveDataSaub', `well_${idWell}`, handleData(setDataSaub))
|
const unsubscribeSaub = Subscribe('hubs/telemetry', 'ReceiveDataSaub', `well_${idWell}`, handleDataSaub)
|
||||||
const unsubscribeSpin = Subscribe('hubs/telemetry', 'ReceiveDataSpin', `well_${idWell}`, handleData(setDataSpin))
|
const unsubscribeSpin = Subscribe('hubs/telemetry', 'ReceiveDataSpin', `well_${idWell}`, handleDataSpin)
|
||||||
return () => {
|
return () => {
|
||||||
unsubscribeSaub()
|
unsubscribeSaub()
|
||||||
unsubscribeSpin()
|
unsubscribeSpin()
|
||||||
|
Loading…
Reference in New Issue
Block a user