From 10fafd39f35033e4ef5f7bb9efd3b2aa4f437574 Mon Sep 17 00:00:00 2001 From: phyzical Date: Sat, 2 Apr 2022 20:17:30 +0800 Subject: [PATCH] fix the amt issue for modal also --- src/Corporation/Actions.ts | 2 +- src/Corporation/ui/modals/PurchaseMaterialModal.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index 591892659..ab331a7b3 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -260,7 +260,7 @@ export function BulkPurchase(corp: ICorporation, warehouse: Warehouse, material: if (isNaN(amt) || amt < 0) { 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`); } const cost = amt * material.bCost; diff --git a/src/Corporation/ui/modals/PurchaseMaterialModal.tsx b/src/Corporation/ui/modals/PurchaseMaterialModal.tsx index d0f674ff5..2cd9dd1ea 100644 --- a/src/Corporation/ui/modals/PurchaseMaterialModal.tsx +++ b/src/Corporation/ui/modals/PurchaseMaterialModal.tsx @@ -36,7 +36,7 @@ function BulkPurchaseSection(props: IBPProps): React.ReactElement { const matSize = MaterialSizes[props.mat.name]; const maxAmount = (props.warehouse.size - props.warehouse.sizeUsed) / matSize; - if (parsedAmt * matSize > maxAmount) { + if (parsedAmt > maxAmount) { setDisabled(true); return ( <>