This commit is contained in:
Joseph Schorr 2014-03-05 16:28:00 -05:00
commit a1e7e69706
2 changed files with 7 additions and 13 deletions

View file

@ -1413,6 +1413,7 @@ def list_repository_builds(namespace_name, repository_name, limit,
.join(BuildTriggerService, JOIN_LEFT_OUTER) .join(BuildTriggerService, JOIN_LEFT_OUTER)
.where(Repository.name == repository_name, .where(Repository.name == repository_name,
Repository.namespace == namespace_name) Repository.namespace == namespace_name)
.order_by(RepositoryBuild.started.desc())
.limit(limit)) .limit(limit))
if not include_inactive: if not include_inactive:
@ -1423,17 +1424,10 @@ def list_repository_builds(namespace_name, repository_name, limit,
def get_recent_repository_build(namespace_name, repository_name): def get_recent_repository_build(namespace_name, repository_name):
query = (RepositoryBuild.select(RepositoryBuild) query = list_repository_builds(namespace_name, repository_name, 1)
.join(Repository) try:
.where(Repository.name == repository_name, return query.get()
Repository.namespace == namespace_name) except RepositoryBuild.DoesNotExist:
.order_by(RepositoryBuild.started.desc())
.limit(1))
results = list(query)
if results:
return results[0]
return None return None

View file

@ -26,7 +26,7 @@
<!-- Side tabs --> <!-- Side tabs -->
<div class="col-sm-2"> <div class="col-sm-2">
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li ng-class="currentBuild == build ? 'active' : ''" ng-repeat="build in builds | reverse"> <li ng-class="currentBuild == build ? 'active' : ''" ng-repeat="build in builds">
<a class="build-tab-link" href="javascript:void(0)" ng-click="setCurrentBuild(build.id, true)"> <a class="build-tab-link" href="javascript:void(0)" ng-click="setCurrentBuild(build.id, true)">
<span class="phase-icon" ng-class="build.phase"></span> <span class="phase-icon" ng-class="build.phase"></span>
<span>{{ build.display_name }}</span> <span>{{ build.display_name }}</span>