mirror of
https://github.com/YunoHost/tartiflette.git
synced 2024-09-03 20:06:08 +02:00
Display correct number of active PRs
This commit is contained in:
parent
a0dd6dabfd
commit
b02e6e0ea0
3 changed files with 25 additions and 10 deletions
17
analyze.py
17
analyze.py
|
@ -5,6 +5,12 @@ import datetime
|
||||||
|
|
||||||
prs = {}
|
prs = {}
|
||||||
|
|
||||||
|
def get_teams():
|
||||||
|
|
||||||
|
with open("repos.json", "r") as f:
|
||||||
|
return json.loads(f.read()).keys()
|
||||||
|
|
||||||
|
|
||||||
def get_repos():
|
def get_repos():
|
||||||
|
|
||||||
repos_by_name = {}
|
repos_by_name = {}
|
||||||
|
@ -87,10 +93,17 @@ def main():
|
||||||
prs_sorted = sorted(prs.keys(), key=lambda x: (prs[x]["priority"],
|
prs_sorted = sorted(prs.keys(), key=lambda x: (prs[x]["priority"],
|
||||||
prs[x]["createdDaysAgo"]), reverse=True )
|
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:
|
for name in prs_sorted:
|
||||||
summary.append(prs[name])
|
summary["prs"].append(prs[name])
|
||||||
|
|
||||||
with open("summary.json", "w") as f:
|
with open("summary.json", "w") as f:
|
||||||
f.write(json.dumps(summary))
|
f.write(json.dumps(summary))
|
||||||
|
|
|
@ -30,14 +30,14 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# Fetch the list of all reports, sorted in reverse-chronological order
|
# 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
|
# Generate the output using the template
|
||||||
|
|
||||||
template = open(template_path, "r").read()
|
template = open(template_path, "r").read()
|
||||||
t = Template(template)
|
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)
|
open(output_path, "w").write(result)
|
||||||
|
|
||||||
|
|
|
@ -72,11 +72,13 @@
|
||||||
<div class="col-md-offset-3 col-md-6">
|
<div class="col-md-offset-3 col-md-6">
|
||||||
<div class="bs-component">
|
<div class="bs-component">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<li class="active"><a href="#">All <span class="badge">1664</span></a></li>
|
<li class="active">
|
||||||
<li><a href="#">Core <span class="badge">42</span></a></li>
|
<a href="#">All <span class="badge">{{ data.teams.all }}</span></a>
|
||||||
<li><a href="#">Apps <span class="badge">42</span></a/li>
|
</li>
|
||||||
<li><a href="#">Infra / dist<span class="badge">42</span></a></li>
|
<li><a href="#">Core <span class="badge">{{ data.teams.core }}</span></a></li>
|
||||||
<li><a href="#">Doc / i18n<span class="badge">42</span></a></li>
|
<li><a href="#">Apps <span class="badge">{{ data.teams.apps }}</span></a/li>
|
||||||
|
<li><a href="#">Infra / dist<span class="badge">{{ data.teams.infra }}</span></a></li>
|
||||||
|
<li><a href="#">Doc / i18n<span class="badge">{{ data.teams.doc }}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -96,7 +98,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for pr in data %}
|
{% for pr in data.prs %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><center><a class="btn
|
<td><center><a class="btn
|
||||||
{% if pr.priority >= 100 %}btn-warning{% else %}
|
{% if pr.priority >= 100 %}btn-warning{% else %}
|
||||||
|
|
Loading…
Reference in a new issue