Skip to content

Commit

Permalink
refactor: changed the order to descendant for get_deployments query
Browse files Browse the repository at this point in the history
  • Loading branch information
SteBaum committed Jul 26, 2024
1 parent de8296e commit 8de63fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tdp/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def get_deployments(
self._check_session()
return (
self.session.query(DeploymentModel)
.order_by(DeploymentModel.id)
.order_by(desc(DeploymentModel.id))
.limit(limit)
.offset(offset)
)
4 changes: 2 additions & 2 deletions tests/unit/test_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ def test_get_deployments(db_engine):
with Dao(db_engine) as dao:
assert assert_equal_values_in_model(
list(dao.get_deployments())[0],
DeploymentModel(id=1, state=DeploymentStateEnum.SUCCESS),
DeploymentModel(id=2, state=DeploymentStateEnum.PLANNED),
)
assert assert_equal_values_in_model(
list(dao.get_deployments())[1],
DeploymentModel(id=2, state=DeploymentStateEnum.PLANNED),
DeploymentModel(id=1, state=DeploymentStateEnum.SUCCESS),
)


Expand Down

0 comments on commit 8de63fa

Please sign in to comment.