fix issue where the storage conditions emc sections was using the 0's from temp only cables and throwing them off
This commit is contained in:
parent
898646f434
commit
337986f88f
1 changed files with 13 additions and 12 deletions
|
|
@ -21,7 +21,7 @@ import { Bin, Component } from "models";
|
||||||
import { GrainCable } from "models/GrainCable";
|
import { GrainCable } from "models/GrainCable";
|
||||||
import { UnitMeasurement } from "models/UnitMeasurement";
|
import { UnitMeasurement } from "models/UnitMeasurement";
|
||||||
import Co2Icon from "products/CommonIcons/co2Icon";
|
import Co2Icon from "products/CommonIcons/co2Icon";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond, quack } from "protobuf-ts/pond";
|
||||||
import { useBinAPI, useGlobalState, useSnackbar } from "providers";
|
import { useBinAPI, useGlobalState, useSnackbar } from "providers";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { avg, getTemperatureUnit } from "utils";
|
import { avg, getTemperatureUnit } from "utils";
|
||||||
|
|
@ -200,35 +200,36 @@ export default function BinStorageConditions(props: Props) {
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
let nodeEMCs: number[] = [];
|
if(cable.subType() !== quack.GrainCableSubtype.GRAIN_CABLE_SUBTYPE_OPI_TEMP){
|
||||||
|
let nodeEMCs: number[] = [];
|
||||||
filteredNodes.moistures.forEach((emc, i) => {
|
filteredNodes.moistures.forEach((emc, i) => {
|
||||||
if (bin.settings.inventory?.targetMoisture) {
|
if (bin.settings.inventory?.targetMoisture) {
|
||||||
// if (i < cable.topNode) {
|
nodeEMCs.push(emc);
|
||||||
nodeEMCs.push(emc);
|
|
||||||
emcCounts.total++;
|
emcCounts.total++;
|
||||||
if (
|
if (
|
||||||
emc >
|
emc >
|
||||||
bin.settings.inventory.targetMoisture +
|
bin.settings.inventory.targetMoisture +
|
||||||
bin.settings.inventory.moistureTargetDeviation
|
bin.settings.inventory.moistureTargetDeviation
|
||||||
) {
|
) {
|
||||||
emcCounts.above++;
|
emcCounts.above++;
|
||||||
} else if (
|
} else if (
|
||||||
emc <
|
emc <
|
||||||
bin.settings.inventory.targetMoisture -
|
bin.settings.inventory.targetMoisture -
|
||||||
bin.settings.inventory.moistureTargetDeviation
|
bin.settings.inventory.moistureTargetDeviation
|
||||||
) {
|
) {
|
||||||
emcCounts.below++;
|
emcCounts.below++;
|
||||||
} else {
|
} else {
|
||||||
emcCounts.onTarget++;
|
emcCounts.onTarget++;
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
}
|
});
|
||||||
});
|
console.log(nodeEMCs)
|
||||||
|
cableEMCAvgs.push(avg(nodeEMCs));
|
||||||
|
}
|
||||||
cableTempAvgs.push(avg(nodeTemps));
|
cableTempAvgs.push(avg(nodeTemps));
|
||||||
cableEMCAvgs.push(avg(nodeEMCs));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log(cableEMCAvgs)
|
||||||
if (cableTempAvgs.length > 0) {
|
if (cableTempAvgs.length > 0) {
|
||||||
setAverageTemp(avg(cableTempAvgs));
|
setAverageTemp(avg(cableTempAvgs));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue