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

This commit is contained in:
Rahulcheryala
2026-06-03 16:19:57 +05:30
parent b1c78fe4c8
commit 628b910cf0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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,