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

@ -446,14 +446,14 @@ export default function BinCard(props: Props) {
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
return (
bin.grainTonnes().toLocaleString() +
bin.grainInventory().toLocaleString() +
" mT " +
bin.fillPercent() +
"%"
);
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1) {
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
return (
bin.grainTons().toLocaleString() +
bin.grainInventory().toLocaleString() +
" t " +
bin.fillPercent() +
"%"

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

View file

@ -202,8 +202,8 @@ export default function BinTransactions(props: Props){
let tonneWeight = bushels / grainTransaction.bushelsPerTonne
return tonneWeight + " mT"
}
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainTransaction.bushelsPerTon > 1){
let tonneWeight = bushels / grainTransaction.bushelsPerTon
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainTransaction.bushelsPerTonne > 1){
let tonneWeight = bushels / (grainTransaction.bushelsPerTonne * 0.907)
return tonneWeight + " t"
}
return bushels + " bushels"

View file

@ -497,8 +497,8 @@ export default function BinVisualizer(props: Props) {
} else {
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
return Math.round((val / bin.bushelsPerTonne()) * 100) / 100;
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1) {
return Math.round((val / bin.bushelsPerTon()) * 100) / 100;
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
return Math.round((val / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
}
}
return val;
@ -515,7 +515,7 @@ export default function BinVisualizer(props: Props) {
}
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
return "mT (" + bin.fillPercent() + "%)";
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1) {
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
return "t (" + bin.fillPercent() + "%)";
} else {
return " / " + capacity.toLocaleString() + " bu";
@ -1332,10 +1332,10 @@ export default function BinVisualizer(props: Props) {
}
}
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1) {
diffDisplay = diffDisplay / bin.bushelsPerTon();
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
diffDisplay = diffDisplay / (bin.bushelsPerTonne()*0.907);
if (pendingDisplay) {
pendingDisplay = pendingDisplay / bin.bushelsPerTon();
pendingDisplay = pendingDisplay / (bin.bushelsPerTonne()*0.907);
}
}
@ -1999,7 +1999,6 @@ export default function BinVisualizer(props: Props) {
b.settings.inventory.grainType = grainType;
b.settings.inventory.customTypeName = customTypeName;
b.settings.inventory.bushelsPerTonne = GrainDescriber(grainType).bushelsPerTonne
b.settings.inventory.bushelsPerTon = GrainDescriber(grainType).bushelsPerTon
// b.settings.inventory.bushelsPerTonne = isNaN(parseFloat(bushPerTonne))
// ? 0
// : parseFloat(bushPerTonne);

View file

@ -73,7 +73,7 @@ export default function BinLevelOverTime(props: Props) {
cap = cap / bin.bushelsPerTonne();
}
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
cap = cap / bin.bushelsPerTon();
cap = cap / (bin.bushelsPerTonne()*0.907);
}
setCapacity(cap);
binAPI
@ -92,8 +92,8 @@ export default function BinLevelOverTime(props: Props) {
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
}
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1){
grainDisplay = Math.round((bushels / bin.bushelsPerTon()) * 100) / 100;
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
}
let newData: InventoryAt = {
timestamp: moment(hist.timestamp).valueOf(),
@ -124,8 +124,8 @@ export default function BinLevelOverTime(props: Props) {
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
}
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1){
grainDisplay = Math.round((bushels / bin.bushelsPerTon()) * 100) / 100;
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
}
data.push({
value: fertilizerBin
@ -160,7 +160,7 @@ export default function BinLevelOverTime(props: Props) {
cap = cap / bin.bushelsPerTonne();
}
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
cap = cap / bin.bushelsPerTon();
cap = cap / (bin.bushelsPerTonne()*0.907);
}
setCapacity(cap);
let autoBarData: BarData[] = [];
@ -183,8 +183,8 @@ export default function BinLevelOverTime(props: Props) {
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
grainDisplay = Math.round((grainDisplay / bin.bushelsPerTonne()) * 100) / 100;
}
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1){
grainDisplay = Math.round((grainDisplay / bin.bushelsPerTon()) * 100) / 100;
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
grainDisplay = Math.round((grainDisplay / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
}
autoBarData.push({
value: grainDisplay,
@ -202,8 +202,8 @@ export default function BinLevelOverTime(props: Props) {
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
}
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1){
grainDisplay = Math.round((bushels / bin.bushelsPerTon()) * 100) / 100;
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
}
autoBarData.push({
value: fertilizerBin