mirror of
https://github.com/makeplane/plane.git
synced 2026-06-13 19:19:54 +00:00
[GIT-221] fix(cycle): guard against no end_date when archiving cycle
This commit is contained in:
@@ -763,7 +763,7 @@ class CycleArchiveUnarchiveAPIEndpoint(BaseAPIView):
|
||||
Only cycles that have ended can be archived.
|
||||
"""
|
||||
cycle = Cycle.objects.get(pk=cycle_id, project_id=project_id, workspace__slug=slug)
|
||||
if cycle.end_date >= timezone.now():
|
||||
if cycle.end_date is None or cycle.end_date >= timezone.now():
|
||||
return Response(
|
||||
{"error": "Only completed cycles can be archived"},
|
||||
status=status.HTTP_400_BAD_REQUEST,
|
||||
|
||||
@@ -587,7 +587,7 @@ class CycleArchiveUnarchiveEndpoint(BaseAPIView):
|
||||
def post(self, request, slug, project_id, cycle_id):
|
||||
cycle = Cycle.objects.get(pk=cycle_id, project_id=project_id, workspace__slug=slug)
|
||||
|
||||
if cycle.end_date >= timezone.now():
|
||||
if cycle.end_date is None or cycle.end_date >= timezone.now():
|
||||
return Response(
|
||||
{"error": "Only completed cycles can be archived"},
|
||||
status=status.HTTP_400_BAD_REQUEST,
|
||||
|
||||
Reference in New Issue
Block a user