added function to the bin model to get the bushels from either the settings or the status based on the inventory control and replaced the instances in the bin card and visualizer where it was getting it from the settings with the function

This commit is contained in:
csawatzky 2025-04-30 17:01:55 -06:00
parent acbd49b907
commit b197f34f33
5 changed files with 132 additions and 109 deletions

View file

@ -419,16 +419,12 @@ export default function BinCard(props: Props) {
Math.round(current * 35.239).toLocaleString() +
"/" +
Math.round(capacity * 35.239).toLocaleString() +
(lidarBushels ? "(" + Math.round(lidarBushels * 35.239).toLocaleString() + " est)" : "") +
" L"
);
}
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT && bin.bushelsPerTonne() > 1) {
return (
bin.grainTonnes().toLocaleString() +
(lidarBushels
? "(" + Math.round(lidarBushels / bin.bushelsPerTonne()).toLocaleString() + " est)"
: "") +
" mT " +
bin.fillPercent() +
"%"
@ -438,7 +434,6 @@ export default function BinCard(props: Props) {
current.toLocaleString() +
"/" +
capacity.toLocaleString() +
(lidarBushels ? "(" + lidarBushels.toLocaleString() + " est)" : "") +
" bu"
);
};
@ -469,10 +464,10 @@ export default function BinCard(props: Props) {
const info = () => {
const inv = bin.settings.inventory;
let bushelAmount = inv?.grainBushels;
let bushelAmount = bin.bushels();
let bushelCapacity = bin.settings.specs?.bushelCapacity;
const empty =
!inv || inv.empty || !bushelCapacity || bushelCapacity <= 0 || inv.grainBushels <= 0;
!inv || inv.empty || !bushelCapacity || bushelCapacity <= 0 || bushelAmount <= 0;
return (
<Box width={1} marginTop={0}>
<Typography align="center" color="textSecondary" noWrap style={{ fontSize: "0.65rem" }}>