diff --git a/argilla-server/CHANGELOG.md b/argilla-server/CHANGELOG.md index 9c385b82a2..d12224e627 100644 --- a/argilla-server/CHANGELOG.md +++ b/argilla-server/CHANGELOG.md @@ -16,6 +16,10 @@ These are the section headers that we use: ## [Unreleased]() +### Fixed + +- Fixed error so now `_touch_dataset_last_activity_at` function is not updating dataset's `updated_at` column. ([#5656](https://github.com/argilla-io/argilla/pull/5656)) + ## [2.4.0](https://github.com/argilla-io/argilla/compare/v2.3.1...v2.4.0) ### Added diff --git a/argilla-server/src/argilla_server/contexts/datasets.py b/argilla-server/src/argilla_server/contexts/datasets.py index 131904307b..b31aafe3b4 100644 --- a/argilla-server/src/argilla_server/contexts/datasets.py +++ b/argilla-server/src/argilla_server/contexts/datasets.py @@ -100,7 +100,12 @@ async def _touch_dataset_last_activity_at(db: AsyncSession, dataset: Dataset) -> None: await db.execute( - sqlalchemy.update(Dataset).where(Dataset.id == dataset.id).values(last_activity_at=datetime.utcnow()) + sqlalchemy.update(Dataset) + .where(Dataset.id == dataset.id) + .values( + last_activity_at=datetime.utcnow(), + updated_at=Dataset.__table__.c.updated_at, + ) ) diff --git a/argilla-server/tests/unit/api/handlers/v1/test_responses.py b/argilla-server/tests/unit/api/handlers/v1/test_responses.py index ceddf5201d..547e6faef4 100644 --- a/argilla-server/tests/unit/api/handlers/v1/test_responses.py +++ b/argilla-server/tests/unit/api/handlers/v1/test_responses.py @@ -102,6 +102,7 @@ async def test_update_response( "updated_at": datetime.fromisoformat(resp_body["updated_at"]).isoformat(), } + await db.refresh(dataset) assert dataset.last_activity_at > dataset_previous_last_activity_at assert dataset.updated_at == dataset_previous_updated_at @@ -421,6 +422,7 @@ async def test_delete_response( assert resp.status_code == 200 assert (await db.execute(select(func.count(Response.id)))).scalar() == 0 + await db.refresh(dataset) assert dataset.last_activity_at > dataset_previous_last_activity_at assert dataset.updated_at == dataset_previous_updated_at