From 9a5c97a5993b37637556d04c5f4a46c926d3fa78 Mon Sep 17 00:00:00 2001 From: Abderrahmane Smimite Date: Mon, 7 Oct 2024 12:09:07 +0200 Subject: [PATCH] adjustment to support just ETA --- backend/core/views.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/backend/core/views.py b/backend/core/views.py index f512e11a3..daebfe7c9 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -867,20 +867,25 @@ def get_timeline_info(self, request): entries = [] colorMap = {} for ac in AppliedControl.objects.all(): - if ac.start_date and ac.eta: - startDate = convert_date_to_timestamp(ac.start_date) + startDate = None + endDate = None + if ac.eta: endDate = convert_date_to_timestamp(ac.eta) - entries.append( - { - "startDate": startDate, - "endDate": endDate, - "name": ac.name, - "description": ac.description - if ac.description - else "(no description)", - "domain": ac.folder.name, - } - ) + if ac.start_date: + startDate = convert_date_to_timestamp(ac.start_date) + else: + startDate = endDate + entries.append( + { + "startDate": startDate, + "endDate": endDate, + "name": ac.name, + "description": ac.description + if ac.description + else "(no description)", + "domain": ac.folder.name, + } + ) for domain in Folder.objects.all(): colorMap[domain.name] = gen_random_html_color() return Response({"entries": entries, "colorMap": colorMap})