finished updating for US tons

This commit is contained in:
csawatzky 2026-03-06 10:24:12 -06:00
parent 9414e30cea
commit 62c2f6a63c
16 changed files with 180 additions and 211 deletions

View file

@ -239,21 +239,18 @@ export default function BinSettings(props: Props) {
if (!initForm.inventory.bushelsPerTonne) {
initForm.inventory.bushelsPerTonne = grain.bushelsPerTonne;
}
if (!initForm.inventory.bushelsPerTon) {
initForm.inventory.bushelsPerTon = grain.bushelsPerTon;
}
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
setBushelConversion(initForm.inventory.bushelsPerTonne)
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
setBushelConversion(initForm.inventory.bushelsPerTon)
setBushelConversion(initForm.inventory.bushelsPerTonne * 0.907)
}
if (initForm.inventory.customGrain){
setCustomGrain(initForm.inventory.customGrain)
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
setBushelConversion(initForm.inventory.customGrain.bushelsPerTonne)
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
setBushelConversion(initForm.inventory.customGrain.bushelsPerTon)
setBushelConversion(initForm.inventory.customGrain.bushelsPerTonne * 0.907)
}
}
//if the target temp is not set (older bins) make it the midpoint of the high and low temps assuming they are set otherwise make it 15
@ -310,13 +307,13 @@ export default function BinSettings(props: Props) {
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
weight = (gb/initForm.inventory.bushelsPerTonne).toFixed(2)
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
weight = (gb/initForm.inventory.bushelsPerTon).toFixed(2)
weight = (gb/(initForm.inventory.bushelsPerTonne * 0.907)).toFixed(2)
}
if(initForm.inventory.customGrain){
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
weight = (gb/initForm.inventory.customGrain.bushelsPerTonne).toFixed(2)
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
weight = (gb/initForm.inventory.customGrain.bushelsPerTon).toFixed(2)
weight = (gb/(initForm.inventory.customGrain.bushelsPerTonne * 0.907)).toFixed(2)
}
}
}
@ -927,7 +924,6 @@ export default function BinSettings(props: Props) {
...form.inventory,
grainType: pond.Grain.GRAIN_CUSTOM,
bushelsPerTonne: 0,
bushelsPerTon: 0
})
);
updateFormExtension("grainType", null);
@ -1186,14 +1182,13 @@ export default function BinSettings(props: Props) {
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
conversion = newGrainSettings.bushelsPerTonne
}else if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
conversion = newGrainSettings.bushelsPerTon
conversion = newGrainSettings.bushelsPerTonne * 0.907
}
updateForm(
"inventory",
pond.BinInventory.create({
...form.inventory,
bushelsPerTonne: newGrainSettings.bushelsPerTonne,
bushelsPerTon: newGrainSettings.bushelsPerTon
})
);
setBushelConversion(conversion)
@ -1220,7 +1215,6 @@ export default function BinSettings(props: Props) {
...form.inventory,
grainType: newGrainType,
bushelsPerTonne: GrainDescriber(newGrainType).bushelsPerTonne,
bushelsPerTon: GrainDescriber(newGrainType).bushelsPerTon
})
);
let conversion = 0