Skip to content

Commit

Permalink
Merge pull request #2124 from Agenta-AI/feature/age-1060-bug-history-…
Browse files Browse the repository at this point in the history
…of-environment-messy

[Bug Fix]: Filter environment revisions by ascending order
  • Loading branch information
mmabrouk authored Oct 16, 2024
2 parents 9ef726e + d5004c0 commit 66e1e5b
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.created_at))
)
environment_revisions = result.scalars().all()
return environment_revisions

Expand Down

0 comments on commit 66e1e5b

Please sign in to comment.