mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
52617baf0e
* dv: seperating constants for ce and ee * dev: update estimate constants * dev: updated estimate structure for ce and ee
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
// plane web constants
|
|
import { EEstimateSystem } from "@/plane-web/constants/estimates";
|
|
|
|
export const isEstimatePointValuesRepeated = (
|
|
estimatePoints: string[],
|
|
estimateType: EEstimateSystem,
|
|
newEstimatePoint?: string | undefined
|
|
) => {
|
|
const currentEstimatePoints = estimatePoints.map((estimatePoint) => estimatePoint.trim());
|
|
let isRepeated = false;
|
|
|
|
if (newEstimatePoint === undefined) {
|
|
if (estimateType === EEstimateSystem.CATEGORIES) {
|
|
const points = new Set(currentEstimatePoints);
|
|
if (points.size != currentEstimatePoints.length) isRepeated = true;
|
|
} else if ([EEstimateSystem.POINTS, EEstimateSystem.TIME].includes(estimateType)) {
|
|
currentEstimatePoints.map((point) => {
|
|
if (Number(point) === Number(newEstimatePoint)) isRepeated = true;
|
|
});
|
|
}
|
|
} else {
|
|
if (estimateType === EEstimateSystem.CATEGORIES) {
|
|
currentEstimatePoints.map((point) => {
|
|
if (point === newEstimatePoint.trim()) isRepeated = true;
|
|
});
|
|
} else if ([EEstimateSystem.POINTS, EEstimateSystem.TIME].includes(estimateType)) {
|
|
currentEstimatePoints.map((point) => {
|
|
if (Number(point) === Number(newEstimatePoint.trim())) isRepeated = true;
|
|
});
|
|
}
|
|
}
|
|
|
|
return isRepeated;
|
|
};
|