forked from github/plane
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
This commit is contained in:
parent
993cf3faba
commit
fd96c54b43
@ -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(
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user