Skip to content

Commit

Permalink
[WEB-1632] fix: validating and showing proper alert estimate point ha…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
gurusainath committed Jun 18, 2024
1 parent 6828d33 commit d3d723c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions web/core/components/estimates/points/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ export const EstimatePointCreate: FC<TEstimatePointCreate> = 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))) {
Expand Down
10 changes: 8 additions & 2 deletions web/core/components/estimates/points/update.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ export const EstimatePointUpdate: FC<TEstimatePointUpdate> = 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))) {
Expand Down

0 comments on commit d3d723c

Please sign in to comment.