Skip to content

Commit 4af776e

Browse files
committed
fix(bug): Update tasks to include always have status
Signed-off-by: Roger Barker <roger.barker@swirldslabs.com>
1 parent 93a126e commit 4af776e

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/static_site_generator.py

Lines changed: 9 additions & 6 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,12 +29,15 @@ 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-
# Extract unique statuses from the tasks list
33-
statuses:list[str] = []
32+
# Ensure all tasks have a status
33+
statuses:set[str] = set()
3434
for task in self.GENERATOR_DATA["tasks"]:
35-
if "status" in task:
36-
statuses.append(task["status"])
37-
unique_statuses:list[str] = sorted(set(statuses))
35+
if "status" not in task:
36+
task["status"] = "None"
37+
statuses.add(task["status"])
38+
39+
# Extract unique statuses from the tasks list
40+
unique_statuses:list[str] = sorted(statuses)
3841

3942
# Add statuses to the data dictionary
4043
data_with_statuses = {**self.GENERATOR_DATA, "statuses": unique_statuses}

0 commit comments

Comments
 (0)