Fix MySQL issue and enable sorting by description

This commit is contained in:
Joseph Schorr 2014-01-13 15:27:05 -05:00
parent a53a0a44a9
commit 8a492a9d56
2 changed files with 6 additions and 5 deletions

View file

@ -514,7 +514,7 @@ def get_visible_repository_internal(username=None, include_public=True, limit=No
return []
query = (Repository
.select(Repository, Visibility)
.select() # Note: We need to leave this blank for the get_count case. Otherwise, MySQL/RDS complains.
.distinct()
.join(Visibility)
.switch(Repository)
@ -563,8 +563,7 @@ def get_visible_repository_internal(username=None, include_public=True, limit=No
where_clause = new_clause
if sort:
# TODO: Add the sorting clause here.
pass
query = query.order_by(Repository.description.desc())
if page:
query = query.paginate(page, limit)

View file

@ -99,11 +99,13 @@ function RepoListCtrl($scope, Restangular, UserService, ApiService) {
'sort': true,
'limit': 10,
'page': $scope.page,
'count': true
'count': $scope.page == 1
};
$scope.public_repositories = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
$scope.publicPageCount = Math.ceil(resp.count / 10);
if (resp.count) {
$scope.publicPageCount = Math.ceil(resp.count / 10);
}
return resp.repositories;
});
};