From 191fc6eab84533f198618cb3e53e2a5a1e0bf590 Mon Sep 17 00:00:00 2001 From: Joan Reyero Date: Tue, 15 Aug 2023 11:45:38 +0100 Subject: [PATCH 1/8] Activity count > 0 --- .../config/saved-views/views/all-organizations.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/modules/organization/config/saved-views/views/all-organizations.ts b/frontend/src/modules/organization/config/saved-views/views/all-organizations.ts index f93dc6b9b4..5483b325e5 100644 --- a/frontend/src/modules/organization/config/saved-views/views/all-organizations.ts +++ b/frontend/src/modules/organization/config/saved-views/views/all-organizations.ts @@ -12,6 +12,10 @@ const allOrganizations: SavedView = { }, settings: { teamOrganization: 'exclude', + noOfActivities: { + operator: 'gt', + value: 0, + }, }, }, }; From 9264a583b75898055394bb26328f701d40bbb14a Mon Sep 17 00:00:00 2001 From: Joan Reyero Date: Tue, 15 Aug 2023 13:20:27 +0100 Subject: [PATCH 2/8] Description --- .../organization/components/list/organization-list-table.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/modules/organization/components/list/organization-list-table.vue b/frontend/src/modules/organization/components/list/organization-list-table.vue index ce2d3b54d5..8a579e93c6 100644 --- a/frontend/src/modules/organization/components/list/organization-list-table.vue +++ b/frontend/src/modules/organization/components/list/organization-list-table.vue @@ -135,7 +135,7 @@ v-if="scope.row.headline" class="text-sm h-full flex items-center text-gray-900" > - {{ scope.row.headline }} + {{ scope.row.headline || scope.row.description }} Date: Tue, 15 Aug 2023 15:01:48 +0100 Subject: [PATCH 3/8] Test organizations --- .../repositories/organizationRepository.ts | 28 +++++++++++-------- .../saved-views/views/all-organizations.ts | 4 --- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/backend/src/database/repositories/organizationRepository.ts b/backend/src/database/repositories/organizationRepository.ts index 11824b9228..32f7742a0d 100644 --- a/backend/src/database/repositories/organizationRepository.ts +++ b/backend/src/database/repositories/organizationRepository.ts @@ -375,11 +375,10 @@ class OrganizationRepository { ` WITH activity_counts AS ( - SELECT mo."organizationId", COUNT(a.id) AS "activityCount" - FROM "memberOrganizations" mo - LEFT JOIN activities a ON a."memberId" = mo."memberId" - WHERE mo."organizationId" = :id - GROUP BY mo."organizationId" + SELECT "organizationId", COUNT(id) AS "activityCount" + FROM activities + WHERE "organizationId" = :id + GROUP BY "organizationId" ), member_counts AS ( SELECT "organizationId", COUNT(DISTINCT "memberId") AS "memberCount" @@ -388,12 +387,11 @@ class OrganizationRepository { GROUP BY "organizationId" ), active_on AS ( - SELECT mo."organizationId", ARRAY_AGG(DISTINCT platform) AS "activeOn" - FROM "memberOrganizations" mo - JOIN activities a ON a."memberId" = mo."memberId" - WHERE mo."organizationId" = :id - GROUP BY mo."organizationId" - ), + SELECT "organizationId", ARRAY_AGG(DISTINCT platform) AS "activeOn" + FROM activities + WHERE "organizationId" = :id + GROUP BY "organizationId" + ), identities AS ( SELECT "organizationId", ARRAY_AGG(DISTINCT platform) AS "identities" FROM "memberOrganizations" mo @@ -600,6 +598,14 @@ class OrganizationRepository { const translator = FieldTranslatorFactory.getTranslator(OpenSearchIndex.ORGANIZATIONS) + if (filter.and) { + filter.and.push({ + activityCount: { + gt: 0 + } + }) + } + const parsed = OpensearchQueryParser.parse( { filter, limit, offset, orderBy }, OpenSearchIndex.ORGANIZATIONS, diff --git a/frontend/src/modules/organization/config/saved-views/views/all-organizations.ts b/frontend/src/modules/organization/config/saved-views/views/all-organizations.ts index 5483b325e5..f93dc6b9b4 100644 --- a/frontend/src/modules/organization/config/saved-views/views/all-organizations.ts +++ b/frontend/src/modules/organization/config/saved-views/views/all-organizations.ts @@ -12,10 +12,6 @@ const allOrganizations: SavedView = { }, settings: { teamOrganization: 'exclude', - noOfActivities: { - operator: 'gt', - value: 0, - }, }, }, }; From e63bd75791f36cbf2e135f9d26e4a34b97259603 Mon Sep 17 00:00:00 2001 From: Joan Reyero Date: Tue, 15 Aug 2023 15:27:39 +0100 Subject: [PATCH 4/8] Remove sorts --- .../organization/components/list/organization-list-table.vue | 5 ----- 1 file changed, 5 deletions(-) diff --git a/frontend/src/modules/organization/components/list/organization-list-table.vue b/frontend/src/modules/organization/components/list/organization-list-table.vue index 8a579e93c6..eadab84d10 100644 --- a/frontend/src/modules/organization/components/list/organization-list-table.vue +++ b/frontend/src/modules/organization/components/list/organization-list-table.vue @@ -120,7 +120,6 @@ label="Headline" prop="headline" width="300" - sortable >