update the bin storage condition to use the filtered nodes function to take into account excluded nodes

This commit is contained in:
csawatzky 2025-07-31 14:40:55 -06:00
parent 7dbeb19d8d
commit 03ab16614d
4 changed files with 16 additions and 13 deletions

View file

@ -181,13 +181,13 @@ export default function BinStorageConditions(props: Props) {
} else {
//with the way the measurements are stored the node closest to the device (highest on the cable) is the first position of the array
//so we will need to flip the array so that node 1 is the beginning of the array
let temps = cloneDeep(cable.temperatures).reverse();
let emcs = cloneDeep(cable.grainMoistures).reverse();
//let temps = cloneDeep(cable.temperatures).reverse();
//let emcs = cloneDeep(cable.grainMoistures).reverse();
let filteredNodes = cable.filteredNodes(true)
//only use the nodes up to the top node
let nodeTemps: number[] = [];
temps.forEach((temp, i) => {
if (i < cable.topNode) {
filteredNodes.temps.forEach((temp, i) => {
// if (i < cable.topNode) { //no longer need to check if it is below the top node as the filteredNodes function does it already and only returns active nodes
nodeTemps.push(temp);
tempCounts.total++;
if (temp > bin.settings.highTemp) {
@ -197,14 +197,14 @@ export default function BinStorageConditions(props: Props) {
} else {
tempCounts.onTarget++;
}
}
// }
});
let nodeEMCs: number[] = [];
emcs.forEach((emc, i) => {
filteredNodes.moistures.forEach((emc, i) => {
if (bin.settings.inventory?.targetMoisture) {
if (i < cable.topNode) {
// if (i < cable.topNode) {
nodeEMCs.push(emc);
emcCounts.total++;
if (
@ -222,7 +222,7 @@ export default function BinStorageConditions(props: Props) {
} else {
emcCounts.onTarget++;
}
}
// }
}
});
cableTempAvgs.push(avg(nodeTemps));
@ -260,7 +260,7 @@ export default function BinStorageConditions(props: Props) {
};
cables.forEach(cable => {
let emcs = cloneDeep(cable.grainMoistures).reverse();
let emcs = cable.filteredNodes(true).moistures
//let nodeEMCs: number[] = [];
emcs.forEach((emc, i) => {
@ -332,7 +332,7 @@ export default function BinStorageConditions(props: Props) {
total: 0
};
cables.forEach(cable => {
let temps = cloneDeep(cable.temperatures).reverse();
let temps = cable.filteredNodes(true).temps
let nodeTemps: number[] = [];
temps.forEach((temp, i) => {
if (i < cable.topNode) {

View file

@ -143,6 +143,7 @@ export default function BinGraphs(props: Props) {
startDate.toISOString(),
endDate.toISOString(),
showErrors,
showErrors,
as
)
.then(resp => {