From 93a126ec4dbf4c7ab064d13e3198673840215a5d Mon Sep 17 00:00:00 2001 From: Roger Barker Date: Fri, 2 May 2025 06:21:33 -0700 Subject: [PATCH 1/3] Initial change -- ignores statuses that aren't present. Signed-off-by: Roger Barker --- src/static_site_generator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/static_site_generator.py b/src/static_site_generator.py index 0fb2026..a9783a6 100644 --- a/src/static_site_generator.py +++ b/src/static_site_generator.py @@ -30,8 +30,12 @@ def generate_site(self, data:list=None, projects:list[str]=None, output_file='./ self.GENERATOR_DATA["project"] = ' '.join(projects) if projects is not None else "" # Extract unique statuses from the tasks list - unique_statuses = sorted({task["status"] for task in self.GENERATOR_DATA["tasks"]}) - + statuses:list[str] = [] + for task in self.GENERATOR_DATA["tasks"]: + if "status" in task: + statuses.append(task["status"]) + unique_statuses:list[str] = sorted(set(statuses)) + # Add statuses to the data dictionary data_with_statuses = {**self.GENERATOR_DATA, "statuses": unique_statuses} From 4af776ef94582e35626e34cab2f9b929a8c629b8 Mon Sep 17 00:00:00 2001 From: Roger Barker Date: Fri, 2 May 2025 06:30:33 -0700 Subject: [PATCH 2/3] fix(bug): Update tasks to include always have status Signed-off-by: Roger Barker --- src/static_site_generator.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/static_site_generator.py b/src/static_site_generator.py index a9783a6..e0ddd91 100644 --- a/src/static_site_generator.py +++ b/src/static_site_generator.py @@ -8,7 +8,7 @@ class StaticSiteGenerator(): def __init__(self): - self.GENERATOR_DATA = { + self.GENERATOR_DATA:dict = { 'title': 'Version2', 'github_user': "", 'project': "", @@ -29,12 +29,15 @@ def generate_site(self, data:list=None, projects:list[str]=None, output_file='./ # Set the project(s) self.GENERATOR_DATA["project"] = ' '.join(projects) if projects is not None else "" - # Extract unique statuses from the tasks list - statuses:list[str] = [] + # Ensure all tasks have a status + statuses:set[str] = set() for task in self.GENERATOR_DATA["tasks"]: - if "status" in task: - statuses.append(task["status"]) - unique_statuses:list[str] = sorted(set(statuses)) + if "status" not in task: + task["status"] = "None" + statuses.add(task["status"]) + + # Extract unique statuses from the tasks list + unique_statuses:list[str] = sorted(statuses) # Add statuses to the data dictionary data_with_statuses = {**self.GENERATOR_DATA, "statuses": unique_statuses} From 8853dba65f667c7161ee0fd8795dee6ea0cbead8 Mon Sep 17 00:00:00 2001 From: Roger Barker Date: Fri, 2 May 2025 06:56:16 -0700 Subject: [PATCH 3/3] fix status Signed-off-by: Roger Barker --- src/static_site_generator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/static_site_generator.py b/src/static_site_generator.py index e0ddd91..e641019 100644 --- a/src/static_site_generator.py +++ b/src/static_site_generator.py @@ -33,7 +33,9 @@ def generate_site(self, data:list=None, projects:list[str]=None, output_file='./ statuses:set[str] = set() for task in self.GENERATOR_DATA["tasks"]: if "status" not in task: - task["status"] = "None" + task["status"] = "NONE" + else: + task["status"] = task["status"].upper() statuses.add(task["status"]) # Extract unique statuses from the tasks list