mirror of
https://github.com/YunoHost/tartiflette.git
synced 2024-09-03 20:06:08 +02:00
Add app list state and levels history graphs
This commit is contained in:
parent
a3d15a0838
commit
5c5eb2c840
4 changed files with 40 additions and 1 deletions
|
@ -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():
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
<a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="arm")}}">Stable vs. ARM</a>
|
||||
<a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="testing")}}">Stable vs. Testing</a>
|
||||
<a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="stretch")}}">Stable vs. Stretch</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{ url_for('main.applist_history')}}">Apps list history graph</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue