Skip to content

Commit

Permalink
Modify fetch resources from single study to multi-study (#5038)
Browse files Browse the repository at this point in the history
* Modify fetch resources from single study to multi-study

* Switch usage of lodash to native map
  • Loading branch information
hweej authored Nov 5, 2024
1 parent 9ff20aa commit 1081908
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/pages/studyView/resources/FilesAndLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ class FilesLinksTableComponent extends LazyMobXTable<{
const RECORD_LIMIT = 500;

function getResourceDataOfEntireStudy(studyIds: string[]) {
// Only handle the first studyId for now. Can be expanded to make a call per
// studyId.
const studyId = studyIds[0];
const allResources = internalClient.getAllStudyResourceDataInStudyPatientSampleUsingGET(
{
// Fetch resource data for each studyId, then return combined results
const allResources = studyIds.map(studyId =>
internalClient.getAllStudyResourceDataInStudyPatientSampleUsingGET({
studyId: studyId,
projection: 'DETAILED',
}
})
);

return Promise.all(allResources).then(allResources =>
_(allResources)
.flatMap()
.value()
);
return allResources;
}

function getResourceDataOfPatients(studyClinicalData: {
Expand Down

0 comments on commit 1081908

Please sign in to comment.