Skip to content

Commit 1081908

Browse files
authored
Modify fetch resources from single study to multi-study (#5038)
* Modify fetch resources from single study to multi-study * Switch usage of lodash to native map
1 parent 9ff20aa commit 1081908

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/pages/studyView/resources/FilesAndLinks.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,19 @@ class FilesLinksTableComponent extends LazyMobXTable<{
3434
const RECORD_LIMIT = 500;
3535

3636
function getResourceDataOfEntireStudy(studyIds: string[]) {
37-
// Only handle the first studyId for now. Can be expanded to make a call per
38-
// studyId.
39-
const studyId = studyIds[0];
40-
const allResources = internalClient.getAllStudyResourceDataInStudyPatientSampleUsingGET(
41-
{
37+
// Fetch resource data for each studyId, then return combined results
38+
const allResources = studyIds.map(studyId =>
39+
internalClient.getAllStudyResourceDataInStudyPatientSampleUsingGET({
4240
studyId: studyId,
4341
projection: 'DETAILED',
44-
}
42+
})
43+
);
44+
45+
return Promise.all(allResources).then(allResources =>
46+
_(allResources)
47+
.flatMap()
48+
.value()
4549
);
46-
return allResources;
4750
}
4851

4952
function getResourceDataOfPatients(studyClinicalData: {

0 commit comments

Comments
 (0)