Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[GIT-221] fix(cycle): guard against no end_date when archiving cycle (#9200)

Rahul Cheryalac9b56cf8a5ae
diff --git a/apps/api/plane/api/views/cycle.py b/apps/api/plane/api/views/cycle.py
index 6274b94de8..a6f2df0f96 100644
--- a/apps/api/plane/api/views/cycle.py
+++ b/apps/api/plane/api/views/cycle.py
@@ -813,7 +813,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,
diff --git a/apps/api/plane/app/views/cycle/archive.py b/apps/api/plane/app/views/cycle/archive.py
index 772fcedea1..aaaf4c6803 100644
--- a/apps/api/plane/app/views/cycle/archive.py
+++ b/apps/api/plane/app/views/cycle/archive.py
@@ -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,