Skip to content

Commit 5e534b7

Browse files
committed
Tested Matts idea we can simply remove this function
1 parent ce95447 commit 5e534b7

File tree

1 file changed

+2
-67
lines changed

1 file changed

+2
-67
lines changed

src/services/activityReports.js

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -299,62 +299,6 @@ export function activityReportByLegacyId(legacyId) {
299299
});
300300
}
301301

302-
export function populateRecipientInfo(activityRecipients) {
303-
return activityRecipients.map((recipient) => {
304-
if (recipient.grant) {
305-
const programsToAssign = (recipient.grant.programs || []).map((p) => p.programType);
306-
307-
// Program Types.
308-
const programTypes = programsToAssign && programsToAssign.length > 0
309-
? [...new Set(
310-
programsToAssign.filter((p) => (p))
311-
.map((p) => (p)).sort(),
312-
)] : [];
313-
314-
Object.defineProperty(
315-
recipient.grant,
316-
'programTypes',
317-
{
318-
value: programTypes,
319-
enumerable: true,
320-
},
321-
);
322-
323-
// Number with Program Types.
324-
const numberWithProgramTypes = `${recipient.grant.number} ${programTypes.length > 0 ? ` - ${programTypes.join(', ')}` : ''}`;
325-
326-
Object.defineProperty(
327-
recipient.grant,
328-
'numberWithProgramTypes',
329-
{
330-
value: numberWithProgramTypes,
331-
enumerable: true,
332-
},
333-
);
334-
335-
// Name.
336-
Object.defineProperty(
337-
recipient.grant,
338-
'name',
339-
{
340-
value: recipient.name,
341-
enumerable: true,
342-
},
343-
);
344-
345-
Object.defineProperty(
346-
recipient,
347-
'name',
348-
{
349-
value: recipient.name,
350-
enumerable: true,
351-
},
352-
);
353-
}
354-
return { ...recipient };
355-
});
356-
}
357-
358302
export async function activityReportAndRecipientsById(activityReportId) {
359303
const arId = parseInt(activityReportId, DECIMAL_BASE);
360304

@@ -392,10 +336,7 @@ export async function activityReportAndRecipientsById(activityReportId) {
392336
],
393337
});
394338

395-
// Populate Activity Recipient info.
396-
const updatedRecipients = populateRecipientInfo(recipients);
397-
398-
const activityRecipients = updatedRecipients.map((recipient) => {
339+
const activityRecipients = recipients.map((recipient) => {
399340
const name = recipient.otherEntity ? recipient.otherEntity.name : recipient.grant.name;
400341
const activityRecipientId = recipient.otherEntity
401342
? recipient.otherEntity.dataValues.id : recipient.grant.dataValues.id;
@@ -1294,13 +1235,7 @@ async function getDownloadableActivityReports(where, separate = true) {
12941235
};
12951236

12961237
// Get reports.
1297-
const reports = await batchQuery(query, 2000);
1298-
1299-
// Populate Activity Recipient info.
1300-
return reports.map((r) => {
1301-
const updatedRecipients = populateRecipientInfo(r.activityRecipients);
1302-
return { ...r, activityRecipients: updatedRecipients };
1303-
});
1238+
return batchQuery(query, 2000);
13041239
}
13051240

13061241
export async function getAllDownloadableActivityReports(

0 commit comments

Comments
 (0)