Skip to content

Commit

Permalink
fix: skip duplicates reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru committed May 2, 2024
1 parent f727abb commit 696c20f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const standardGeoJson = (geometry: Array<number> | { longitude: number, latitude
export const geometryType = (formValuesKey: Object) =>
Object.values(FEATURETYPE).find(geometryKey => geometryKey === formValuesKey);

export const getPossibleTetFeatureTypeKey = (serverValues: Object) =>
export const getPossibleTetFeatureTypeKey = (serverValues: Object = {}) =>
Object.keys(serverValues).find(key => key.startsWith('FEATURETYPE_'));

export const buildGeometryProp = (key: string, serverValues: Object) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const RelationshipTrackedEntityInstancePlain =
renderDuplicatesDialogActions={renderDuplicatesDialogActions}
renderDuplicatesCardActions={renderDuplicatesCardActions}
ExistingUniqueValueDialogActions={ExistingUniqueValueDialogActions}
orgUnit={{ id: orgUnitId }}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const RelationshipTrackedEntityInstancePlain =
renderDuplicatesDialogActions={renderDuplicatesDialogActions}
renderDuplicatesCardActions={renderDuplicatesCardActions}
ExistingUniqueValueDialogActions={ExistingUniqueValueDialogActions}
orgUnit={{ id: orgUnitId }}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const actionTypes = {
DUPLICATES_REVIEW: 'PossibleDuplicatesReview',
DUPLICATES_REVIEW_RETRIEVAL_SUCCESS: 'PossibleDuplicatesReviewRetrievalSuccess',
DUPLICATES_REVIEW_RETRIEVAL_FAILED: 'PossibleDuplicatesReviewRetrievalFailed',
DUPLICATES_REVIEW_SKIPPED: 'PossibleDuplicatesReview.Skipped',
DUPLICATES_REVIEW_CHANGE_PAGE: 'PossibleDuplicatesChangePage',
DUPLICATES_RESET: 'PossibleDuplicatesReset',
};
Expand All @@ -30,6 +31,9 @@ export const reviewDuplicates = ({
export const duplicatesForReviewRetrievalSuccess = (teis: Array<Object>, currentPage: number) =>
actionCreator(actionTypes.DUPLICATES_REVIEW_RETRIEVAL_SUCCESS)({ teis, currentPage });

export const duplicatesReviewSkipped = () =>
actionCreator(actionTypes.DUPLICATES_REVIEW_SKIPPED)();

export const duplicatesForReviewRetrievalFailed = () =>
actionCreator(actionTypes.DUPLICATES_REVIEW_RETRIEVAL_FAILED)();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
actionTypes,
duplicatesForReviewRetrievalSuccess,
duplicatesForReviewRetrievalFailed,
duplicatesReviewSkipped,
} from './possibleDuplicatesDialog.actions';
import {
scopeTypes, getScopeFromScopeId, EventProgram, TrackerProgram, TrackedEntityType, dataElementTypes,
Expand Down Expand Up @@ -70,6 +71,10 @@ export const loadSearchGroupDuplicatesForReviewEpic = (
})
.filter(f => f);

if (filters.length === 0) {
return Promise.resolve(duplicatesReviewSkipped());
}

const contextParam = scopeType === scopeTypes.TRACKER_PROGRAM ? { program: selectedScopeId } : { trackedEntityType: selectedScopeId };
const queryArgs = {
ouMode: 'ACCESSIBLE',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export const possibleDuplicatesDesc = createReducerDescription({
loadError: false,
currentPage: action.payload.currentPage,
}),
[searchGroupDuplicateActionTypes.DUPLICATES_REVIEW_SKIPPED]: state => ({
...state,
isLoading: false,
isUpdating: false,
loadError: false,
}),
[searchGroupDuplicateActionTypes.DUPLICATES_REVIEW_RETRIEVAL_FAILED]: state => ({
...state,
isLoading: false,
Expand Down

0 comments on commit 696c20f

Please sign in to comment.