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 { } 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 //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 //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 temps = cloneDeep(cable.temperatures).reverse();
let emcs = cloneDeep(cable.grainMoistures).reverse(); //let emcs = cloneDeep(cable.grainMoistures).reverse();
let filteredNodes = cable.filteredNodes(true)
//only use the nodes up to the top node //only use the nodes up to the top node
let nodeTemps: number[] = []; let nodeTemps: number[] = [];
temps.forEach((temp, i) => { filteredNodes.temps.forEach((temp, i) => {
if (i < cable.topNode) { // 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); nodeTemps.push(temp);
tempCounts.total++; tempCounts.total++;
if (temp > bin.settings.highTemp) { if (temp > bin.settings.highTemp) {
@ -197,14 +197,14 @@ export default function BinStorageConditions(props: Props) {
} else { } else {
tempCounts.onTarget++; tempCounts.onTarget++;
} }
} // }
}); });
let nodeEMCs: number[] = []; let nodeEMCs: number[] = [];
emcs.forEach((emc, i) => { filteredNodes.moistures.forEach((emc, i) => {
if (bin.settings.inventory?.targetMoisture) { if (bin.settings.inventory?.targetMoisture) {
if (i < cable.topNode) { // if (i < cable.topNode) {
nodeEMCs.push(emc); nodeEMCs.push(emc);
emcCounts.total++; emcCounts.total++;
if ( if (
@ -222,7 +222,7 @@ export default function BinStorageConditions(props: Props) {
} else { } else {
emcCounts.onTarget++; emcCounts.onTarget++;
} }
} // }
} }
}); });
cableTempAvgs.push(avg(nodeTemps)); cableTempAvgs.push(avg(nodeTemps));
@ -260,7 +260,7 @@ export default function BinStorageConditions(props: Props) {
}; };
cables.forEach(cable => { cables.forEach(cable => {
let emcs = cloneDeep(cable.grainMoistures).reverse(); let emcs = cable.filteredNodes(true).moistures
//let nodeEMCs: number[] = []; //let nodeEMCs: number[] = [];
emcs.forEach((emc, i) => { emcs.forEach((emc, i) => {
@ -332,7 +332,7 @@ export default function BinStorageConditions(props: Props) {
total: 0 total: 0
}; };
cables.forEach(cable => { cables.forEach(cable => {
let temps = cloneDeep(cable.temperatures).reverse(); let temps = cable.filteredNodes(true).temps
let nodeTemps: number[] = []; let nodeTemps: number[] = [];
temps.forEach((temp, i) => { temps.forEach((temp, i) => {
if (i < cable.topNode) { if (i < cable.topNode) {

View file

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

View file

@ -119,7 +119,6 @@ export default function UpgradeDevice(props: Props) {
const percent = () => { const percent = () => {
let progress = Math.round((upgrade.status.offset / upgrade.status.size) * 100) let progress = Math.round((upgrade.status.offset / upgrade.status.size) * 100)
console.log(progress)
return progress; return progress;
}; };

View file

@ -89,6 +89,7 @@ export interface IBinAPIContext {
start: string, start: string,
end: string, end: string,
showErrors?: boolean, showErrors?: boolean,
allNodes?: boolean,
otherTeam?: string otherTeam?: string
) => Promise<AxiosResponse<pond.ListBinComponentsMeasurementsResponse>>; ) => Promise<AxiosResponse<pond.ListBinComponentsMeasurementsResponse>>;
updateBinPermissions: ( updateBinPermissions: (
@ -447,6 +448,7 @@ export default function BinProvider(props: PropsWithChildren<Props>) {
start: string, start: string,
end: string, end: string,
showErrors = false, showErrors = false,
allNodes = false,
otherTeam?: string otherTeam?: string
) => { ) => {
const view = otherTeam ? otherTeam : as const view = otherTeam ? otherTeam : as
@ -457,7 +459,8 @@ export default function BinProvider(props: PropsWithChildren<Props>) {
"&end=" + "&end=" +
end + end +
(view ? "&as=" + view : "") + (view ? "&as=" + view : "") +
(showErrors ? "&showErrors=true" : "&showErrors=false") (showErrors ? "&showErrors=true" : "&showErrors=false") +
(allNodes ? "&allNodes=true" : "&allNodes=false")
return new Promise<AxiosResponse<pond.ListBinComponentsMeasurementsResponse>>((resolve, reject) => { return new Promise<AxiosResponse<pond.ListBinComponentsMeasurementsResponse>>((resolve, reject) => {
get<pond.ListBinComponentsMeasurementsResponse>(pondURL(url)) get<pond.ListBinComponentsMeasurementsResponse>(pondURL(url))