From 3101b95213a56cc28c264131af3b5b6c13876dec Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 14 May 2019 17:00:38 +0000 Subject: [PATCH] First version of testing PR dashboard --- app/app.py | 16 +++++++++ app/templates/base.html | 1 + app/templates/testings.html | 67 +++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 app/templates/testings.html diff --git a/app/app.py b/app/app.py index 83e11e1..efe448c 100644 --- a/app/app.py +++ b/app/app.py @@ -1,3 +1,4 @@ +from datetime import datetime from flask import render_template, make_response, Blueprint from .models.pr import PullRequest from .models.applists import App @@ -181,3 +182,18 @@ def app_maintainer_dash(maintainer=None): return render_template("maintainer.html", maintainers=maintainers, apps=apps, maintainer=maintainer) +@main.route('/testings') +def testings(): + + apps = App.query.filter(App.testing_pr!=None).all() + + def daysAgo(date): + return (datetime.now() - date).days + + for app in apps: + app.testing_pr["created_ago"] = daysAgo(app.testing_pr["created_at"]) + app.testing_pr["updated_ago"] = daysAgo(app.testing_pr["updated_at"]) + + apps = sorted(apps, key=lambda app: (-app.testing_pr["created_ago"], -app.testing_pr["updated_ago"], app.name.lower())) + + return render_template("testings.html", apps=apps) diff --git a/app/templates/base.html b/app/templates/base.html index 2312c40..f0e1eb1 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -45,6 +45,7 @@