From d3d723cadd1564634ed953b0a761cba17c0570fd Mon Sep 17 00:00:00 2001 From: guru_sainath Date: Tue, 18 Jun 2024 13:31:23 +0530 Subject: [PATCH] [WEB-1632] fix: validating and showing proper alert estimate point has to be taken greater than 0 in create and update (#4850) * fix: validating and showing proper alert estimate point has to be taken greater than 0 in create and update * fix: updating the number point validation --- web/core/components/estimates/points/create.tsx | 10 ++++++++-- web/core/components/estimates/points/update.tsx | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/web/core/components/estimates/points/create.tsx b/web/core/components/estimates/points/create.tsx index 4a0967aa0..981714b5f 100644 --- a/web/core/components/estimates/points/create.tsx +++ b/web/core/components/estimates/points/create.tsx @@ -82,8 +82,14 @@ export const EstimatePointCreate: FC = observer((props) => if (!isRepeated) { if (currentEstimateType && [(EEstimateSystem.TIME, EEstimateSystem.POINTS)].includes(currentEstimateType)) { - if (estimateInputValue && Number(estimateInputValue) && Number(estimateInputValue) >= 0) { - isEstimateValid = true; + if (estimateInputValue && !isNaN(Number(estimateInputValue))) { + if (Number(estimateInputValue) <= 0) { + handleEstimatePointError && + handleEstimatePointError(estimateInputValue, "Estimate point should be greater than 0."); + return; + } else { + isEstimateValid = true; + } } } else if (currentEstimateType && currentEstimateType === EEstimateSystem.CATEGORIES) { if (estimateInputValue && estimateInputValue.length > 0 && isNaN(Number(estimateInputValue))) { diff --git a/web/core/components/estimates/points/update.tsx b/web/core/components/estimates/points/update.tsx index 4194f4b2d..c6d28ba10 100644 --- a/web/core/components/estimates/points/update.tsx +++ b/web/core/components/estimates/points/update.tsx @@ -87,8 +87,14 @@ export const EstimatePointUpdate: FC = observer((props) => if (!isRepeated) { if (currentEstimateType && [(EEstimateSystem.TIME, EEstimateSystem.POINTS)].includes(currentEstimateType)) { - if (estimateInputValue && Number(estimateInputValue) && Number(estimateInputValue) >= 0) { - isEstimateValid = true; + if (estimateInputValue && !isNaN(Number(estimateInputValue))) { + if (Number(estimateInputValue) <= 0) { + handleEstimatePointError && + handleEstimatePointError(estimateInputValue, "Estimate point should be greater than 0."); + return; + } else { + isEstimateValid = true; + } } } else if (currentEstimateType && currentEstimateType === EEstimateSystem.CATEGORIES) { if (estimateInputValue && estimateInputValue.length > 0 && isNaN(Number(estimateInputValue))) {