From 337986f88fd701ba5a6d0a9e19f55445be1e5cbc Mon Sep 17 00:00:00 2001 From: csawatzky Date: Tue, 30 Sep 2025 15:35:42 -0600 Subject: [PATCH] fix issue where the storage conditions emc sections was using the 0's from temp only cables and throwing them off --- src/bin/BinStorageConditions.tsx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/bin/BinStorageConditions.tsx b/src/bin/BinStorageConditions.tsx index 0f4daac..8feda5b 100644 --- a/src/bin/BinStorageConditions.tsx +++ b/src/bin/BinStorageConditions.tsx @@ -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,35 +200,36 @@ export default function BinStorageConditions(props: Props) { // } }); - let nodeEMCs: number[] = []; - - filteredNodes.moistures.forEach((emc, i) => { + 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); + nodeEMCs.push(emc); emcCounts.total++; if ( emc > bin.settings.inventory.targetMoisture + - bin.settings.inventory.moistureTargetDeviation + bin.settings.inventory.moistureTargetDeviation ) { emcCounts.above++; } else if ( emc < bin.settings.inventory.targetMoisture - - bin.settings.inventory.moistureTargetDeviation + bin.settings.inventory.moistureTargetDeviation ) { emcCounts.below++; } else { emcCounts.onTarget++; } - // } - } - }); + } + }); + console.log(nodeEMCs) + cableEMCAvgs.push(avg(nodeEMCs)); + } cableTempAvgs.push(avg(nodeTemps)); - cableEMCAvgs.push(avg(nodeEMCs)); } }); + console.log(cableEMCAvgs) if (cableTempAvgs.length > 0) { setAverageTemp(avg(cableTempAvgs)); }