mirror of
https://github.com/makeplane/plane.git
synced 2025-12-29 00:24:56 +01:00
[WEB-1637] fix: validating estimate points in switch and making the switch request once every validation is successful (#434)
* fix: validating and showing proper alert estimate point has to be taken greater than 0 in create and update * fix: validating estimate points in switch and making the switch request once every validation is successfull
This commit is contained in:
@@ -84,28 +84,18 @@ export const EstimatePointSwitchRoot: FC<TEstimatePointSwitchRoot> = observer((p
|
||||
handleEstimatePointError(estimatePoint.key, "", "", "Please fill this estimate point field");
|
||||
}
|
||||
});
|
||||
if (isNonEmptyPoints.length === estimatePoints?.length) {
|
||||
isValid = true;
|
||||
} else {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
// validate if fields are repeated
|
||||
const repeatedValues: string[] = [];
|
||||
estimatePoints?.map((estimatePoint) => {
|
||||
if (estimatePoint.value && estimatePoint.value != "") {
|
||||
if (repeatedValues.includes(estimatePoint.value)) {
|
||||
if (repeatedValues.includes(estimatePoint.value.trim())) {
|
||||
handleEstimatePointError(estimatePoint.key, "", "", "Estimate point value cannot be repeated");
|
||||
} else {
|
||||
repeatedValues.push(estimatePoint.value);
|
||||
repeatedValues.push(estimatePoint.value.trim());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (repeatedValues.length === estimatePoints?.length) {
|
||||
isValid = true;
|
||||
} else {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
// validate if fields are valid in points and time required number values and categories required string values
|
||||
const estimatePointArray: string[] = [];
|
||||
@@ -134,7 +124,12 @@ export const EstimatePointSwitchRoot: FC<TEstimatePointSwitchRoot> = observer((p
|
||||
}
|
||||
});
|
||||
}
|
||||
if (estimatePointArray.length === estimatePoints?.length) {
|
||||
|
||||
if (
|
||||
isNonEmptyPoints.length === estimatePoints?.length &&
|
||||
repeatedValues.length === estimatePoints?.length &&
|
||||
estimatePointArray.length === estimatePoints?.length
|
||||
) {
|
||||
isValid = true;
|
||||
} else {
|
||||
isValid = false;
|
||||
|
||||
Reference in New Issue
Block a user