diff --git a/app/app.py b/app/app.py index 4a84f0a..ba3b8ab 100644 --- a/app/app.py +++ b/app/app.py @@ -2,6 +2,7 @@ from flask import render_template, make_response, Blueprint from .models.pr import PullRequest from .models.appci import App, AppCI, AppCIBranch from .settings import SITE_ROOT +import json main = Blueprint('main', __name__, url_prefix=SITE_ROOT) @@ -21,6 +22,10 @@ def sort_test_results(results): def index(): return render_template('index.html') +@main.route('/applist_history') +def applist_history(): + data = json.loads(open("./app/scripts/appListsHistory/count_history.json").read()) + return render_template('applist_history.html', data=data) @main.route('/pullrequests') def pullrequests(): diff --git a/app/scripts/appListsHistory/script.py b/app/scripts/appListsHistory/script.py index 5eff8ac..d1fcd68 100644 --- a/app/scripts/appListsHistory/script.py +++ b/app/scripts/appListsHistory/script.py @@ -125,5 +125,36 @@ def make_rss_feed(): fg.atom_file('atom.xml') +def make_count_summary(): + + states = ["official", "working", "inprogress", "notworking"] + history = [] + + per_state = { state: [] for state in states } + per_level = { "level-%s"%i: [] for i in range(0,8) } + + for d in time_points_until_today: + + print("Analyzing %s ..." % d.strftime("%y-%m-%d")) + + # Load corresponding json + j = json.loads(open("./.work/merged_lists.json.%s" % d.strftime("%y-%m-%d")).read()) + d_label = d.strftime("%b %d %Y") + + summary = {} + summary["date"] = d_label + for state in states: + summary[state] = len([ k for k, infos in j.items() if infos["state"] == state ]) + + for level in range(0,8): + summary["level-%s"%level] = len([ k for k, infos in j.items() \ + if infos["state"] in ["working", "official"] \ + and infos.get("level", None) == level ]) + + history.append(summary) + + json.dump(history, open('count_history.json', 'w')) + #get_lists_history() make_rss_feed() +#make_count_summary() diff --git a/app/templates/base.html b/app/templates/base.html index 50b9a9a..bdac03f 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -40,6 +40,8 @@ Stable vs. ARM Stable vs. Testing Stable vs. Stretch +
+ Apps list history graph diff --git a/manage.py b/manage.py index fa295a4..548c194 100755 --- a/manage.py +++ b/manage.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from flask_script import Manager, Shell, Command +from flask_script import Manager, Shell, Command, Server from app import db, create_app app = create_app() @@ -13,6 +13,7 @@ def main(): manager.add_command('init', Init(db)) manager.add_command('update-appci', Update(db, "appci")) manager.add_command('update-pr', Update(db, "pr")) + manager.add_command("runserver", Server()) manager.run()