From fd96c54b43beb2b3d4e00fd0eb7c4401e43a1f5b Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Fri, 5 May 2023 15:13:22 +0530 Subject: [PATCH] fix: cycle date check endpoint for updation (#1006) * fix: cycle date check endpoint for updation * dev: update the cycle date check endpoint to exclude current cycle when updating --- apiserver/plane/api/views/cycle.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apiserver/plane/api/views/cycle.py b/apiserver/plane/api/views/cycle.py index 36c54c54c..f61a93487 100644 --- a/apiserver/plane/api/views/cycle.py +++ b/apiserver/plane/api/views/cycle.py @@ -414,10 +414,11 @@ class CycleDateCheckEndpoint(BaseAPIView): try: start_date = request.data.get("start_date", False) end_date = request.data.get("end_date", False) + cycle_id = request.data.get("cycle_id", False) if not start_date or not end_date: return Response( - {"error": "Start date and end date both are required"}, + {"error": "Start date and end date are required"}, status=status.HTTP_400_BAD_REQUEST, ) @@ -429,6 +430,11 @@ class CycleDateCheckEndpoint(BaseAPIView): project_id=project_id, ) + if cycle_id: + cycles = cycles.filter( + ~Q(pk=cycle_id), + ) + if cycles.exists(): return Response( {