Skip to content

Commit

Permalink
refactor(backend): order environment revisions by ascending order
Browse files Browse the repository at this point in the history
  • Loading branch information
aybruhm committed Oct 16, 2024
1 parent 9ef726e commit 009779b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions agenta-backend/agenta_backend/services/db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from agenta_backend.models.db.postgres_engine import db_engine
from agenta_backend.services.json_importer_helper import get_json

from sqlalchemy import func, or_
from sqlalchemy.future import select
from sqlalchemy import func, or_, asc
from sqlalchemy.exc import NoResultFound
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import joinedload, aliased, load_only
Expand Down Expand Up @@ -1255,7 +1255,10 @@ async def fetch_environment_revisions_for_environment(
query = query.options(
joinedload(AppEnvironmentRevisionDB.modified_by.of_type(UserDB)).load_only(UserDB.username) # type: ignore
)
result = await session.execute(query)

result = await session.execute(
query.order_by(asc(AppEnvironmentRevisionDB.revision))
)
environment_revisions = result.scalars().all()
return environment_revisions

Expand Down

0 comments on commit 009779b

Please sign in to comment.