Skip to content

Commit

Permalink
Merge pull request #73 from ItKlubBozoLagan/dev
Browse files Browse the repository at this point in the history
Add edu email domain in contest participants page
  • Loading branch information
Antony1060 authored Nov 11, 2024
2 parents 5a5ab70 + 97c613d commit 661a64d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,25 @@ OrganisationMemberHandler.get("/", async (req, res) => {
id: eqIn(...organisationMembers.map((organisationMember) => organisationMember.user_id)),
});

const eduUsers = await Database.selectFrom("edu_users", "*", {
id: eqIn(...organisationMembers.map((organisationMember) => organisationMember.user_id)),
});

return respond(
res,
StatusCodes.OK,
organisationMembers.map(
(it, _, __, user = users.find((user) => user.id === it.user_id)!) => ({
(
it,
_,
__,
user = users.find((user) => user.id === it.user_id)!,
eduUser = eduUsers.find((user) => user.id === it.user_id)
) => ({
...it,
...R.pick(user, ["full_name"]),
email_domain: user.email.split("@").at(-1),
edu_mail_domain: eduUser?.email.split("@").at(-1),
})
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ const MemberBox: FC<MemberBoxProperties> = ({ member, admin }) => {
</Breadcrumb>
)}
<DomainBreadcrumb email={member.email_domain} />
{member.edu_mail_domain &&
member.email_domain.trim().toLowerCase() !==
member.edu_mail_domain.trim().toLowerCase() && (
<DomainBreadcrumb email={member.edu_mail_domain} />
)}
<RankBreadcrumb specificElo={member.elo} />
{member.full_name}
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/models/src/ContestMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export type ContestMember = ContestMemberV2;
export type ContestMemberWithInfo = ContestMember & {
full_name: string;
email_domain: string;
edu_mail_domain?: string;
elo: number;
};

0 comments on commit 661a64d

Please sign in to comment.