fix for when there are no changes to the mode over the set period of time

This commit is contained in:
csawatzky 2025-08-18 16:55:49 -06:00
parent 44f227c3e9
commit cf0d493f40

View file

@ -109,9 +109,9 @@ export default function BinLevelOverTime(props: Props) {
}) })
} }
}); });
let currentTime = moment().valueOf();
if (data.length === 0) { if (data.length === 0) {
let bushels = bin.bushels(); let bushels = bin.bushels();
let currentTime = moment().valueOf();
data.push({ data.push({
value: fertilizerBin value: fertilizerBin
? Math.round(bushels * 35.239) ? Math.round(bushels * 35.239)
@ -121,6 +121,13 @@ export default function BinLevelOverTime(props: Props) {
timestamp: currentTime timestamp: currentTime
}); });
} }
if(modeData.length === 0){
modeData.push({
timestamp: currentTime,
value: 1,
fill: getFill(bin.settings.mode)
})
}
setInventoryData(data); setInventoryData(data);
setModeData(modeData) setModeData(modeData)
}) })
@ -206,6 +213,13 @@ export default function BinLevelOverTime(props: Props) {
}) })
} }
}) })
if(modeData.length === 0){
modeData.push({
timestamp: moment().valueOf(),
value: 1,
fill: getFill(bin.settings.mode)
})
}
setModeData(modeData) setModeData(modeData)
}) })
.catch(err => { .catch(err => {