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:
csawatzky 2025-09-30 15:35:42 -06:00
parent 898646f434
commit 337986f88f

View file

@ -21,7 +21,7 @@ import { Bin, Component } from "models";
import { GrainCable } from "models/GrainCable";
import { UnitMeasurement } from "models/UnitMeasurement";
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 React, { useEffect, useState } from "react";
import { avg, getTemperatureUnit } from "utils";
@ -200,11 +200,10 @@ export default function BinStorageConditions(props: Props) {
// }
});
if(cable.subType() !== quack.GrainCableSubtype.GRAIN_CABLE_SUBTYPE_OPI_TEMP){
let nodeEMCs: number[] = [];
filteredNodes.moistures.forEach((emc, i) => {
if (bin.settings.inventory?.targetMoisture) {
// if (i < cable.topNode) {
nodeEMCs.push(emc);
emcCounts.total++;
if (
@ -222,13 +221,15 @@ export default function BinStorageConditions(props: Props) {
} else {
emcCounts.onTarget++;
}
// }
}
});
cableTempAvgs.push(avg(nodeTemps));
console.log(nodeEMCs)
cableEMCAvgs.push(avg(nodeEMCs));
}
cableTempAvgs.push(avg(nodeTemps));
}
});
console.log(cableEMCAvgs)
if (cableTempAvgs.length > 0) {
setAverageTemp(avg(cableTempAvgs));
}