Skip to content

fix(bug): Too much reliance on teams still #79

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
merged 3 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions src/static_site_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ class StaticSiteGenerator():

def __init__(self):
self.GENERATOR_DATA = {
'title': 'Version Two',
'title': 'Version2',
'github_user': "",
'team': "",
'project': "",
'tasks': []
}

def generate_site(self, data:list=None, teams:list[str]=None, output_file='./_site/index.html'):
def generate_site(self, data:list=None, projects:list[str]=None, output_file='./_site/index.html'):
logging.info("Generating Static Site")
env = Environment(loader=FileSystemLoader('templates'))
template = env.get_template('kaban_board.html')
Expand All @@ -24,8 +24,8 @@ def generate_site(self, data:list=None, teams:list[str]=None, output_file='./_si
self.github_uname = os.getenv("GITHUB_UNAME") if os.getenv("GITHUB_UNAME") else "Not logged in"
self.GENERATOR_DATA["github_user"] = self.github_uname

# Set the team(s)
self.GENERATOR_DATA["team"] = ' '.join(teams) if teams is not None else ""
# Set the project(s)
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"]})
Expand Down
22 changes: 11 additions & 11 deletions src/version2query.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ def get_all_projects(self, orgs:list[str]) -> list[dict]:
all_projects.extend(projects)
return all_projects

def filter_projects_by_team(self, project_list:list[dict], teams:list[str]) -> list[dict]:
def filter_projects_by_project_name(self, project_list:list[dict], project_names:list[str]) -> list[dict]:
"""Filter the project list by team names."""

filtered_projects:list[dict] = []
for team in teams:
matching_projects:list[dict] = [p for p in project_list if team.lower() in p["title"].lower()]
for pname in project_names:
matching_projects:list[dict] = [p for p in project_list if pname.lower() in p["title"].lower()]

filtered_projects.extend(matching_projects)
print(f"[green]Found {len(matching_projects)} matching projects for team '{team}'[/green]")
print(f"[green]Found {len(matching_projects)} matching projects for project '{pname}'[/green]")
return filtered_projects

def filter_items_by_user(self) -> None:
Expand Down Expand Up @@ -195,15 +195,15 @@ def process(self) -> bool:
print("[red]No projects found. Exiting...[/red]")
return False

# filter by team names
# filter by project names
filtered_projects = all_projects
if self.filters.include_teams is not None:
teams = self.filters.include_teams
filtered_projects_by_teams = self.filter_projects_by_team(all_projects, teams)
if not filtered_projects_by_teams:
print("[red]No projects found matching the team names. Exiting...[/red]")
if self.filters.include_projects is not None:
project_names = self.filters.include_projects
filtered_projects_by_project_name = self.filter_projects_by_project_name(all_projects, project_names)
if not filtered_projects_by_project_name:
print("[red]No projects found matching the project names. Exiting...[/red]")
return False
filtered_projects = filtered_projects_by_teams
filtered_projects = filtered_projects_by_project_name

if not self.fetch_project_items(filtered_projects):
print("[red]Failed to fetch project items. Exiting...[/red]")
Expand Down
2 changes: 1 addition & 1 deletion templates/kaban_board.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1 class="mb-3 text-center">{{ title }}</h1>
<div class="row mb-4 align-items-center">
<div class="col-md-8">
<p><strong>🧑‍💻 GitHub User:</strong> {{ github_user }}</p>
<p><strong>♣️ Team:</strong> {{ team }}</p>
<p><strong>♣️ Project(s):</strong> {{ project }}</p>
</div>
<!-- <div class="col-md-4">
<p><strong>Team:</strong> {{ team }}</p>
Expand Down
2 changes: 1 addition & 1 deletion version2.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def main():
with open(output_file, 'r') as f:
data = json.load(f)

ss_gen.generate_site(data=data, teams=filters["include_teams"])
ss_gen.generate_site(data=data, projects=filters["include_projects"])

if __name__ == "__main__":
main()