diff --git a/src/static_site_generator.py b/src/static_site_generator.py index 0fb2026..e641019 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,9 +29,18 @@ 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 "" + # Ensure all tasks have a status + statuses:set[str] = set() + for task in self.GENERATOR_DATA["tasks"]: + if "status" not in task: + task["status"] = "NONE" + else: + task["status"] = task["status"].upper() + statuses.add(task["status"]) + # Extract unique statuses from the tasks list - unique_statuses = sorted({task["status"] for task in self.GENERATOR_DATA["tasks"]}) - + unique_statuses:list[str] = sorted(statuses) + # Add statuses to the data dictionary data_with_statuses = {**self.GENERATOR_DATA, "statuses": unique_statuses}