From 16ebf8db42f2ff35a1ee87dc2f4fbdac03546a60 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 3 Jul 2017 23:33:27 +0200 Subject: [PATCH] Adding roadmap for 2.7 --- roadmap/analyze.py | 58 +++++++++++++++++++++++---------------- roadmap/fetch.py | 9 ++++-- www/template_roadmap.html | 16 ++++++----- 3 files changed, 49 insertions(+), 34 deletions(-) diff --git a/roadmap/analyze.py b/roadmap/analyze.py index 710b71c..d595e34 100755 --- a/roadmap/analyze.py +++ b/roadmap/analyze.py @@ -3,6 +3,7 @@ import json import BeautifulSoup +roadmaps = { "2.6.x": 11, "2.7.x": 13 } status_filters = { "all": None, @@ -14,29 +15,33 @@ status_filters = { def parse_issues(): - soup = BeautifulSoup.BeautifulSoup(open("data/raw_roadmapissues.xml").read()) - issues = [] - for issue in soup.issues: - cleaned_issue = {} - cleaned_issue["id"] = issue.id.text - cleaned_issue["priority"] = issue.priority["name"] - cleaned_issue["status"] = issue.status["name"] - cleaned_issue["type"] = issue.tracker["name"] - cleaned_issue["subject"] = issue.subject.text - cleaned_issue["p"] = priority(cleaned_issue) - - issues.append(cleaned_issue) + for roadmap in sorted(roadmaps.keys()): + + soup = BeautifulSoup.BeautifulSoup(open("data/raw_"+roadmap+"_issues.xml").read()) + + for issue in soup.issues: + cleaned_issue = {} + cleaned_issue["id"] = issue.id.text + cleaned_issue["priority"] = issue.priority["name"] + cleaned_issue["status"] = issue.status["name"] + cleaned_issue["type"] = issue.tracker["name"] + cleaned_issue["subject"] = issue.subject.text + cleaned_issue["roadmap"] = roadmap + cleaned_issue["p"] = priority(cleaned_issue) + + issues.append(cleaned_issue) issues = sorted(issues, key=lambda x: x["p"], reverse=True ) return issues -def filtered_issues(issues, status_filter=None, type_filter=None): - - issues_filtered = issues +def filtered_issues(issues, roadmap, status_filter=None, type_filter=None): + + issues_filtered = [ issue for issue in issues if issue["roadmap"] == roadmap ] + if status_filter != None: issues_filtered = [ issue for issue in issues_filtered if issue["status"] in status_filter] @@ -69,7 +74,7 @@ def priority(issue): elif (issue["status"]): p += 10 - + p -= sorted(roadmaps.keys()).index(issue["roadmap"]) / 10 return p @@ -78,20 +83,25 @@ def main(): # Parse issues... issues = parse_issues() - # Build summary summary = {} + for roadmap in roadmaps: + summary[roadmap] = {} # First add issues by status - for status_name, status_filter in status_filters.items(): - summary[status_name] = filtered_issues(issues, status_filter) + for roadmap in roadmaps: + for status_name, status_filter in status_filters.items(): + summary[roadmap][status_name] = filtered_issues(issues, roadmap, status_filter) + + print summary # The compute percent - for status_name, status_filter in status_filters.items(): - if (status_name != "all"): - n = summary[status_name] - p = float("{0:.1f}".format(100 * n / summary["all"])) - summary[status_name] = (n,p) + for roadmap in roadmaps: + for status_name, status_filter in status_filters.items(): + if (status_name != "all"): + n = summary[roadmap][status_name] + p = float("{0:.1f}".format(100 * n / summary[roadmap]["all"])) + summary[roadmap][status_name] = (n,p) # (Meh) summary = { "summary": summary } diff --git a/roadmap/fetch.py b/roadmap/fetch.py index f377ef9..60303ef 100755 --- a/roadmap/fetch.py +++ b/roadmap/fetch.py @@ -3,12 +3,15 @@ import requests import json +roadmaps = { "2.6.x": 11, "2.7.x": 13 } + def get_roadmapissues(): - roadmapissues = requests.get("https://dev.yunohost.org/issues.xml?fixed_version_id=11&status_id=*&limit=100", verify=False) + for roadmap, id in roadmaps.items(): + issues = requests.get("https://dev.yunohost.org/issues.xml?fixed_version_id="+str(id)+"&status_id=*&limit=100", verify=False) - with open("data/raw_roadmapissues.xml", "w") as f: - f.write(roadmapissues.text) + with open("data/raw_"+roadmap+"_issues.xml", "w") as f: + f.write(issues.text) get_roadmapissues() diff --git a/www/template_roadmap.html b/www/template_roadmap.html index 095463e..67383b9 100644 --- a/www/template_roadmap.html +++ b/www/template_roadmap.html @@ -55,30 +55,32 @@

Yunohost Roadmap Dashboard

- -

2.6.x

- + + {% for roadmap, summary in data.summary.items() %} +

{{ roadmap }}

-
All ({{data.summary.all}} issues)
+
All ({{summary.all}} issues)
{{data.summary.done[0]}} done
+ {{summary.done[1]}}%">{{summary.done[0]}} done
{{data.summary.ongoing[0]}} + {{summary.ongoing[1]}}%">{{summary.ongoing[0]}} ongoing
{{data.summary.new[0]}} new
+ {{summary.new[1]}}%">{{summary.new[0]}} new
+ {% endfor %} +