Skip to content

Commit b423ba1

Browse files
authored
fix(bug): Update tasks to always have status (#83)
Signed-off-by: Roger Barker <roger.barker@swirldslabs.com>
1 parent 2e36b60 commit b423ba1

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/static_site_generator.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class StaticSiteGenerator():
99

1010
def __init__(self):
11-
self.GENERATOR_DATA = {
11+
self.GENERATOR_DATA:dict = {
1212
'title': 'Version2',
1313
'github_user': "",
1414
'project': "",
@@ -29,9 +29,18 @@ def generate_site(self, data:list=None, projects:list[str]=None, output_file='./
2929
# Set the project(s)
3030
self.GENERATOR_DATA["project"] = ' '.join(projects) if projects is not None else ""
3131

32+
# Ensure all tasks have a status
33+
statuses:set[str] = set()
34+
for task in self.GENERATOR_DATA["tasks"]:
35+
if "status" not in task:
36+
task["status"] = "NONE"
37+
else:
38+
task["status"] = task["status"].upper()
39+
statuses.add(task["status"])
40+
3241
# Extract unique statuses from the tasks list
33-
unique_statuses = sorted({task["status"] for task in self.GENERATOR_DATA["tasks"]})
34-
42+
unique_statuses:list[str] = sorted(statuses)
43+
3544
# Add statuses to the data dictionary
3645
data_with_statuses = {**self.GENERATOR_DATA, "statuses": unique_statuses}
3746

0 commit comments

Comments
 (0)