Skip to content

Commit

Permalink
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/api/routers/participantsRouter.ts
Original file line number Diff line number Diff line change
@@ -106,13 +106,18 @@ export function createParticipantsRouter() {
const siteMap = new Map<number, SiteDTO>(sitesList.map((s) => [s.id, s]));

const allParticipantTypes = await ParticipantType.query();
const result = participants.map((p) => {
const currentSite = p?.siteId === undefined ? undefined : siteMap.get(p.siteId);
return {
...p,
types: mapClientTypeToParticipantType(currentSite?.clientTypes || [], allParticipantTypes),
};
});
const result = participants
.map((p) => {
const currentSite = p?.siteId === undefined ? undefined : siteMap.get(p.siteId);
return {
...p,
types: mapClientTypeToParticipantType(
currentSite?.clientTypes || [],
allParticipantTypes
),
};
})
.sort((a, b) => a.name.localeCompare(b.name));
return res.status(200).json(result);
});

0 comments on commit 8849d8b

Please sign in to comment.