From 9b0cd40448d9be2b97cb698cc56ac08577075454 Mon Sep 17 00:00:00 2001 From: Tony Valle Date: Wed, 23 Aug 2023 15:41:22 +0200 Subject: [PATCH 1/2] fix: remove orgUnit param if ouMode = ACCESSIBLE, CAPTURE or ALL --- .../PossibleDuplicatesDialog/possibleDuplicatesDialog.epics.js | 2 -- .../capture-core/components/TeiSearch/epics/teiSearch.epics.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core_modules/capture-core/components/PossibleDuplicatesDialog/possibleDuplicatesDialog.epics.js b/src/core_modules/capture-core/components/PossibleDuplicatesDialog/possibleDuplicatesDialog.epics.js index 515eee121d..78098fa714 100644 --- a/src/core_modules/capture-core/components/PossibleDuplicatesDialog/possibleDuplicatesDialog.epics.js +++ b/src/core_modules/capture-core/components/PossibleDuplicatesDialog/possibleDuplicatesDialog.epics.js @@ -47,7 +47,6 @@ export const loadSearchGroupDuplicatesForReviewEpic = ( payload: { page, pageSize, - orgUnitId, selectedScopeId, scopeType, dataEntryId, @@ -73,7 +72,6 @@ export const loadSearchGroupDuplicatesForReviewEpic = ( const contextParam = scopeType === scopeTypes.TRACKER_PROGRAM ? { program: selectedScopeId } : { trackedEntityType: selectedScopeId }; const queryArgs = { - ou: orgUnitId, ouMode: 'ACCESSIBLE', pageSize, page, diff --git a/src/core_modules/capture-core/components/TeiSearch/epics/teiSearch.epics.js b/src/core_modules/capture-core/components/TeiSearch/epics/teiSearch.epics.js index fd38591735..16b87ef4ff 100644 --- a/src/core_modules/capture-core/components/TeiSearch/epics/teiSearch.epics.js +++ b/src/core_modules/capture-core/components/TeiSearch/epics/teiSearch.epics.js @@ -34,7 +34,7 @@ import { getSearchFormId } from '../getSearchFormId'; import type { QuerySingleResource } from '../../../utils/api/api.types'; const getOuQueryArgs = (orgUnit: ?Object, orgUnitScope: string) => - (orgUnitScope !== 'ACCESSIBLE' ? + (orgUnitScope !== 'ACCESSIBLE' || 'CAPTURE' || 'ALL' ? { ou: orgUnit && orgUnit.id, ouMode: orgUnitScope } : { ouMode: orgUnitScope }); From 8ea6206e7535eb3e12451034bd4728d6b457b941 Mon Sep 17 00:00:00 2001 From: Tony Valle Date: Thu, 24 Aug 2023 13:32:56 +0200 Subject: [PATCH 2/2] fix: incorrect expression --- .../components/TeiSearch/epics/teiSearch.epics.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core_modules/capture-core/components/TeiSearch/epics/teiSearch.epics.js b/src/core_modules/capture-core/components/TeiSearch/epics/teiSearch.epics.js index 16b87ef4ff..dfb4c92533 100644 --- a/src/core_modules/capture-core/components/TeiSearch/epics/teiSearch.epics.js +++ b/src/core_modules/capture-core/components/TeiSearch/epics/teiSearch.epics.js @@ -34,9 +34,9 @@ import { getSearchFormId } from '../getSearchFormId'; import type { QuerySingleResource } from '../../../utils/api/api.types'; const getOuQueryArgs = (orgUnit: ?Object, orgUnitScope: string) => - (orgUnitScope !== 'ACCESSIBLE' || 'CAPTURE' || 'ALL' ? - { ou: orgUnit && orgUnit.id, ouMode: orgUnitScope } : - { ouMode: orgUnitScope }); + (['ACCESSIBLE', 'CAPTURE', 'ALL'].includes(orgUnitScope) ? + { ouMode: orgUnitScope } : + { ou: orgUnit && orgUnit.id, ouMode: orgUnitScope }); const getContextQueryArgs = (programId: ?string, trackedEntityTypeId: string) => (programId ? { program: programId } : { trackedEntityType: trackedEntityTypeId });