Skip to content

Commit

Permalink
Sort the assets by creation time in the version endpoint, just like /…
Browse files Browse the repository at this point in the history
…assets

We made the asset list in the GET version endpoint more useful recently
by including the asset-id. But that list is not being sorted by creation
time, unlike the list provided by /assets, so the assets are somewhat
randomly ordered.

So, add the change to sort the asset list of the GET version endpoint by
creation time. This ensures that the default asset is always first, etc.
  • Loading branch information
danscales committed Oct 24, 2024
1 parent 8157344 commit 9ba09ad
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/routes/datasets/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ async def _version_response(
.where(ORMAsset.dataset == dataset)
.where(ORMAsset.version == version)
.where(ORMAsset.status == AssetStatus.saved)
.order_by(ORMAsset.created_on)
.gino.all()
)
data = Version.from_orm(data).dict(by_alias=True)
Expand Down

0 comments on commit 9ba09ad

Please sign in to comment.