@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')
<tr>
<th scope="col">Name</th>
<th scope="col">Sponsor</th>
+ <th scope="col">Last Success</th>
</tr>
{% for runner in runners %}
<tr>
<td><a href="/runners/{{runner.runner_name}}">{{runner.runner_name}}</a></td>
<td>{% if runner.runner_sponsor_url %}<a href="{{runner.runner_sponsor_url}}">{% endif %}{{runner.runner_sponsor}}{% if runner.runner_sponsor_url %}</a>{% endif %}</td>
+ <td>{{runner.build_date}}</td>
</tr>
{% endfor %}
</table>