Skip to content

fix(bug): Update tasks to always have status #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/static_site_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class StaticSiteGenerator():

def __init__(self):
self.GENERATOR_DATA = {
self.GENERATOR_DATA:dict = {
'title': 'Version2',
'github_user': "",
'project': "",
Expand All @@ -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}

Expand Down