Skip to content

Commit

Permalink
Fixed alg. used to retrieve latest available licence
Browse files Browse the repository at this point in the history
  • Loading branch information
keul committed Sep 25, 2024
1 parent f3bf646 commit e8e2e0d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cads_catalogue_api_service/vocabularies.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def query_licence(
cads_catalogue.database.Licence.title,
cads_catalogue.database.Licence.md_filename,
cads_catalogue.database.Licence.download_filename,
sa.func.max(cads_catalogue.database.Licence.revision).label("revision"),
cads_catalogue.database.Licence.revision,
cads_catalogue.database.Licence.scope,
cads_catalogue.database.Licence.portal,
)
Expand All @@ -99,11 +99,12 @@ def query_licence(
cads_catalogue.database.Licence.title,
cads_catalogue.database.Licence.md_filename,
cads_catalogue.database.Licence.download_filename,
cads_catalogue.database.Licence.revision,
cads_catalogue.database.Licence.scope,
cads_catalogue.database.Licence.portal,
)
.order_by(cads_catalogue.database.Licence.title)
.one()
.order_by(sa.desc("revision"))
.first()
)
except sa.exc.NoResultFound as exc:
raise fastapi.HTTPException(
Expand Down

0 comments on commit e8e2e0d

Please sign in to comment.