From: Tom Powell Date: Tue, 28 May 2019 04:53:47 +0000 (-0700) Subject: Include last successful build date on runners page X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=43f61d7fa29f7a477091ec30cf4c3f58cc720282;p=GitLab%2Fstricted-build%2Flineage_builder.git Include last successful build date on runners page --- diff --git a/ui/app.py b/ui/app.py index 60b450b..ba5ef19 100644 --- a/ui/app.py +++ b/ui/app.py @@ -141,7 +141,17 @@ def web_stats(): @app.route("/runners/") def web_runners(): - runners = models.Runner.get().all() + #select * from runner join (select * from build where build_status = "success" order by build_date) as builds on builds.build_runner_id = runner.runner_id group by build_runner_id; + subquery = models.Build.query.filter(models.Build.build_status == "success").order_by(models.Build.build_date).subquery() + runners = models.Runner.query.outerjoin( + subquery, subquery.c.build_runner_id == models.Runner.runner_id + ).with_entities( + models.Runner.runner_id, + models.Runner.runner_name, + models.Runner.runner_sponsor, + models.Runner.runner_sponsor_url, + subquery.c.build_date + ).group_by(models.Runner.runner_id).all() return render_template('runners.html', runners=runners) @app.route('/api/v1/builds') diff --git a/ui/templates/runners.html b/ui/templates/runners.html index 262d201..9a91fc7 100644 --- a/ui/templates/runners.html +++ b/ui/templates/runners.html @@ -8,11 +8,13 @@ Name Sponsor + Last Success {% for runner in runners %} {{runner.runner_name}} {% if runner.runner_sponsor_url %}{% endif %}{{runner.runner_sponsor}}{% if runner.runner_sponsor_url %}{% endif %} + {{runner.build_date}} {% endfor %}