Skip to content

Commit

Permalink
Merge pull request galaxyproject#16887 from jdavcs/dev_ts_fix_sort_order
Browse files Browse the repository at this point in the history
Fix bug in SA statement: desc() applied to column, not statement
  • Loading branch information
martenson authored Oct 19, 2023
2 parents 245b4dc + 9c8d18f commit 5134f2f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/tool_shed/util/repository_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,15 @@ def get_repositories(
if installable:
stmt1 = select(RepositoryMetadata.repository_id)
stmt = stmt.where(Repository.id.in_(stmt1))

if sort_key == "owner":
stmt = stmt.order_by(User.username)
sort_by = User.username
else:
stmt = stmt.order_by(Repository.name)
sort_by = Repository.name
if sort_order == "desc":
stmt = stmt.desc()
sort_by = sort_by.desc()
stmt = stmt.order_by(sort_by)

if page is not None:
page = int(page)
stmt = stmt.limit(per_page)
Expand Down

0 comments on commit 5134f2f

Please sign in to comment.