fix the amt issue for modal also

This commit is contained in:
phyzical
2022-04-02 20:17:30 +08:00
parent a8689cb28b
commit 10fafd39f3
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -260,7 +260,7 @@ export function BulkPurchase(corp: ICorporation, warehouse: Warehouse, material:
if (isNaN(amt) || amt < 0) { if (isNaN(amt) || amt < 0) {
throw new Error(`Invalid input amount`); throw new Error(`Invalid input amount`);
} }
if (amt >= maxAmount) { if (amt > maxAmount) {
throw new Error(`You do not have enough warehouse size to fit this purchase`); throw new Error(`You do not have enough warehouse size to fit this purchase`);
} }
const cost = amt * material.bCost; const cost = amt * material.bCost;
@@ -36,7 +36,7 @@ function BulkPurchaseSection(props: IBPProps): React.ReactElement {
const matSize = MaterialSizes[props.mat.name]; const matSize = MaterialSizes[props.mat.name];
const maxAmount = (props.warehouse.size - props.warehouse.sizeUsed) / matSize; const maxAmount = (props.warehouse.size - props.warehouse.sizeUsed) / matSize;
if (parsedAmt * matSize > maxAmount) { if (parsedAmt > maxAmount) {
setDisabled(true); setDisabled(true);
return ( return (
<> <>