Skip to content

Commit

Permalink
[frontend] return intended number of recent builds
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Sep 28, 2016
1 parent 005215b commit 33a00aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions frontend/coprs_frontend/coprs/logic/builds_logic.py
Expand Up @@ -66,13 +66,11 @@ def get_recent_tasks(cls, user=None, limit=None):
.filter(models.BuildChroot.ended_on.isnot(None))\
.order_by(models.BuildChroot.ended_on.desc())\
.subquery()
)

query = query \
.order_by(models.Build.id.desc()) \
.limit(limit)
).order_by(models.Build.id.desc())

return query
# Workaround - otherwise it could take less records than `limit`even though there are more of them.
query = query.limit(limit if limit > 100 else 100)
return list(reversed(query.all()[:5]))

@classmethod
def get_build_importing_queue(cls):
Expand Down
2 changes: 1 addition & 1 deletion frontend/coprs_frontend/coprs/templates/_helpers.html
Expand Up @@ -271,7 +271,7 @@ <h3 class="panel-title"> Task Queue </h3>
<h3 class="panel-title"> Recent Builds - <a href="{{ url_for('recent_ns.all') }}">View All</a></h3>
</div>
<div class="list-group">
{% for build in builds |reverse %}
{% for build in builds %}
{% if build.copr.is_a_group_project %}
<a href="{{url_for("coprs_ns.group_copr_build", group_name = build.copr.group.name, coprname = build.copr.name, build_id = build.id)}}" class="list-group-item">
{% else %}
Expand Down

0 comments on commit 33a00aa

Please sign in to comment.