diff --git a/analyze.py b/analyze.py index 2857e02..e8efb72 100755 --- a/analyze.py +++ b/analyze.py @@ -5,6 +5,12 @@ import datetime prs = {} +def get_teams(): + + with open("repos.json", "r") as f: + return json.loads(f.read()).keys() + + def get_repos(): repos_by_name = {} @@ -87,10 +93,17 @@ def main(): prs_sorted = sorted(prs.keys(), key=lambda x: (prs[x]["priority"], prs[x]["createdDaysAgo"]), reverse=True ) - summary = [] + summary = {} + + summary["teams"] = {} + summary["teams"]["all"] = len([pr for pr in prs.values() if pr["priority"] >= -50]) + for team in get_teams(): + summary["teams"][team] = len([pr for pr in prs.values() + if team in pr["teams"] and pr["priority"] >= -50]) + summary["prs"] = [] for name in prs_sorted: - summary.append(prs[name]) + summary["prs"].append(prs[name]) with open("summary.json", "w") as f: f.write(json.dumps(summary)) diff --git a/publish.py b/publish.py index 5ddd0ff..820ba03 100755 --- a/publish.py +++ b/publish.py @@ -30,14 +30,14 @@ if __name__ == '__main__': # Fetch the list of all reports, sorted in reverse-chronological order - pr_list = json.load(open(summary_path)) + summary = json.load(open(summary_path)) # Generate the output using the template template = open(template_path, "r").read() t = Template(template) - result = t.render(data=pr_list, convert=shell_to_html, shell_css=shell_css) + result = t.render(data=summary, convert=shell_to_html, shell_css=shell_css) open(output_path, "w").write(result) diff --git a/www/template.html b/www/template.html index 7a4784f..e1e223d 100644 --- a/www/template.html +++ b/www/template.html @@ -72,11 +72,13 @@
@@ -96,7 +98,7 @@ - {% for pr in data %} + {% for pr in data.prs %}