diff --git a/components/renku_data_services/namespace/db.py b/components/renku_data_services/namespace/db.py index 154adea31..3e386aa80 100644 --- a/components/renku_data_services/namespace/db.py +++ b/components/renku_data_services/namespace/db.py @@ -90,6 +90,8 @@ async def get_groups( groups_orm = result.scalars().all() stmt_count = select(func.count()).select_from(schemas.GroupORM) + if direct_member: + stmt_count = stmt_count.where(schemas.GroupORM.id.in_(group_ids)) result = await session.execute(stmt_count) n_total_elements = result.scalar() or 0 return [g.dump() for g in groups_orm], n_total_elements