Skip to content

Commit

Permalink
fixing delete data source issue. fix issue with displaying same pair …
Browse files Browse the repository at this point in the history
…twice
  • Loading branch information
ashaban committed Oct 25, 2023
1 parent 14c16c8 commit 040d5b1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gofr-backend/lib/routes/dataSources.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ function destroyPartition(partitionName, partitionID) {
resolve();
}).catch((err) => {
logger.error(err);
if(resource === 'Basic') {
return resolve()
}
reject();
});
}).catch((err) => {
Expand Down Expand Up @@ -197,7 +200,15 @@ function getSourcePair({ userID, dhis2OrgId }) {
const sourcesRes = resources.filter(entry => entry.resource.meta.profile.includes('http://gofr.org/fhir/StructureDefinition/gofr-datasource'));
const usersRes = resources.filter(entry => entry.resource.meta.profile.includes('http://gofr.org/fhir/StructureDefinition/gofr-person-user'));
const promises = [];
let ids = []
for (const pairRes of pairsRes) {
let found = ids.find((id) => {
return pairRes.resource.id === id
})
if(found) {
continue
}
ids.push(pairRes.resource.id)
const pairDetails = pairRes.resource.extension && pairRes.resource.extension.find(ext => ext.url === 'http://gofr.org/fhir/StructureDefinition/datasourcepair');
promises.push(new Promise((resolve, reject) => {
const src1Ext = pairDetails.extension.find(ext => ext.url === 'http://gofr.org/fhir/StructureDefinition/source1');
Expand Down

0 comments on commit 040d5b1

Please sign in to comment.