From da0c70e6a87616755f5f2a89913b3bb7d7f562fe Mon Sep 17 00:00:00 2001 From: "Antonio F. Trstenjak" Date: Mon, 11 Nov 2024 13:59:48 +0100 Subject: [PATCH] Add email domain in contest participants page --- apps/backend/src/routes/contest/ContestHandler.ts | 5 +++-- .../contest/participants/ContestParticipantsPage.tsx | 2 +- packages/models/src/ContestMember.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/backend/src/routes/contest/ContestHandler.ts b/apps/backend/src/routes/contest/ContestHandler.ts index f5fa4bb8..555dc1a9 100644 --- a/apps/backend/src/routes/contest/ContestHandler.ts +++ b/apps/backend/src/routes/contest/ContestHandler.ts @@ -460,12 +460,13 @@ ContestHandler.get("/:contest_id/leaderboard", async (req, res) => { res, StatusCodes.OK, contestMembers - .map((it) => ({ + .map((it, _, __, user = users.find((user) => user.id === it.user_id)!) => ({ ...it, - ...R.pick(users.find((user) => user.id === it.user_id)!, ["full_name"]), + ...R.pick(user, ["full_name"]), ...R.pick(organisationMembers.find((member) => member.user_id === it.user_id)!, [ "elo", ]), + email_domain: user.email.split("@").at(-1), })) .map((it) => ({ ...it, score: it.score ?? {} })) ); diff --git a/apps/frontend/src/pages/management/contest/participants/ContestParticipantsPage.tsx b/apps/frontend/src/pages/management/contest/participants/ContestParticipantsPage.tsx index b449d2e5..f20ae6ef 100644 --- a/apps/frontend/src/pages/management/contest/participants/ContestParticipantsPage.tsx +++ b/apps/frontend/src/pages/management/contest/participants/ContestParticipantsPage.tsx @@ -97,7 +97,7 @@ const MemberBox: FC = ({ member, admin }) => { {t("account.breadcrumbs.creator")} )} - + {member.full_name} diff --git a/packages/models/src/ContestMember.ts b/packages/models/src/ContestMember.ts index 79eb3504..c84647c0 100644 --- a/packages/models/src/ContestMember.ts +++ b/packages/models/src/ContestMember.ts @@ -18,6 +18,6 @@ export type ContestMember = ContestMemberV2; export type ContestMemberWithInfo = ContestMember & { full_name: string; - email: string; + email_domain: string; elo: number; };