Skip to content

Commit

Permalink
Merge branch 'main' into slider-radio-judge
Browse files Browse the repository at this point in the history
  • Loading branch information
xnscdev authored Apr 17, 2024
2 parents 619b364 + a068d11 commit 77528a0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
9 changes: 6 additions & 3 deletions components/Organizer/ApplicantsTab/ApplicantsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,13 @@ export const ApplicantsTab = () => {
visible={isAppModalOpen}
onOk={handleAppCloseModal}
onCancel={handleAppCloseModal}>
{selectedApplicant &&
Object.entries(selectedApplicant.application!)
{selectedApplicant?.application ? (
Object.entries(selectedApplicant.application)
.filter(([field, _]) => field in APPLICATION_KEY_MAP)
.map(createSingleApplicantEntry)}
.map(createSingleApplicantEntry)
) : (
<p>Application details are not available.</p>
)}
</Modal>
)}
{isCheckinModalOpen && (
Expand Down
16 changes: 15 additions & 1 deletion components/judges/TeamSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ function withCheckMark(value: string) {
</Row>
);
}

const optionComparator = (input: string, option: string) => {
let searchPosition = 0;
const cin = input.toLowerCase();
const opt = option.toLowerCase();
for (let i = 0; i < opt.length; ++i) {
if (opt[i] === cin[searchPosition]) ++searchPosition;
else break;
}
return searchPosition === input.length;
};

export default function TeamSelect(props: TeamSelectProps) {
const { teamsData, currentTeamID, handleChange } = props;
const { data: session } = useSession();
Expand All @@ -34,10 +46,12 @@ export default function TeamSelect(props: TeamSelectProps) {
Team:
</strong>
<Select
showSearch
value={currentTeamID ? currentTeamID : 'Select a team'}
style={{ width: 300, maxWidth: '60vw' }}
onChange={handleChange}
allowClear>
allowClear
filterOption={(input, option) => optionComparator(input, String(option?.children))}>
{session?.userType === 'JUDGE' && (
<OptGroup label="My Teams">
{teamsData
Expand Down
12 changes: 10 additions & 2 deletions components/judges/schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps
title: 'Project',
dataIndex: 'project',
key: 'project',
width: '30%',
width: '25%',
render: ({ name, link }: { name: string; link: URL }) => (
<>
<td>{name}</td>
Expand All @@ -223,7 +223,7 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps
title: 'Team Members',
dataIndex: 'teamMembers',
key: 'teamMembers',
width: '30%',
width: '25%',
render: (members: User[]) => members.map(member => <Tag key={member.id}>{member.name}</Tag>),
},
{
Expand All @@ -244,6 +244,13 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps
</Button>
),
},
{
title: 'Judgement State',
dataIndex: 'scores',
key: 'scores',
width: '10%',
render: (scores: []) => <Tag>{scores.length ? 'Judged' : 'Without Judgement'}</Tag>,
},
];
const dataSource = data.slice(showPast ? 0 : cutoffIndex).map(item => {
return {
Expand All @@ -253,6 +260,7 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps
teamMembers: item.team.members,
judge: item.judge,
teamId: item.team._id,
scores: item.team.scores,
};
});

Expand Down

0 comments on commit 77528a0

Please sign in to comment.