Skip to content

Panel judging opt in#343

Open
ReehalS wants to merge 7 commits intomainfrom
panel-judging-opt-in
Open

Panel judging opt in#343
ReehalS wants to merge 7 commits intomainfrom
panel-judging-opt-in

Conversation

@ReehalS
Copy link
Member

@ReehalS ReehalS commented Sep 30, 2025

I'm fairly sure this works.
I've tested it on the mock data I have from old testing with only tech team as judges and it seemed to work for panel creation (I temporarily removed the limits on how many panels a judge can be on).
Have also added a dropdown to the Admin page for judges to allow changing of panel judging opt in.

I did have to make the 'domain' optional on panels, since the "Best Hack for Social Good" does not have a domain, do not know how this didn't break the panel judging before... but it is something to keep in mind if we run into problems later.
Have not checked the judge check in form part yet.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements a panel judging opt-in feature that allows judges to explicitly choose whether they want to participate in judging panels. The PR addresses a database validation issue where the "Best Hack for Social Good" track doesn't have an associated domain, which was breaking panel creation.

Changes:

  • Added opted_into_panels boolean field to users collection for judges to opt into panel assignments
  • Modified panels schema to make the domain field optional (allowing empty strings for tracks without domains)
  • Updated judge check-in flow and admin interface to allow judges to opt in/out of panel judging

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
migrations/20250930042214-add-opted-into-panels-to-users.mjs Adds opted_into_panels field to users collection validator and sets default value to false for existing users
migrations/20250930045209-fix-panels-domain-validation.mjs Updates panels validator to make domain field optional, allowing empty strings for tracks without domains
app/_types/user.ts Adds optional opted_into_panels boolean field to User interface
app/_types/panel.ts Changes domain field from required to optional in Panel interface
app/(pages)/judges/_components/AuthForms/CheckInForm.tsx Adds checkbox for panel opt-in during judge check-in
app/(pages)/admin/_components/Judges/JudgeForm.tsx Adds dropdown to admin form for managing judge panel opt-in status and improves team mapping logic
app/(pages)/admin/_components/Judges/JudgeCard.tsx Displays panel opt-in status on judge cards
app/(pages)/_hooks/useAuthForm.ts Updates hook to handle checkbox inputs with boolean values
app/(pages)/_components/AuthForm/AuthForm.tsx Adds checkbox input support to generic auth form component
app/(api)/_utils/matching/judgeToPanelAlgorithm.ts Updates algorithm to handle optional domain field using nullish coalescing
app/(api)/_actions/logic/assignJudgesToPanels.ts Filters judges by opted_into_panels flag when assigning to panels
app/(api)/_actions/auth/verifyCode.ts Updates check-in logic to optionally set opted_into_panels field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +52 to 62
if (data?._id && data.teams) {
data.teams = data.teams
.map((team: any) => {
// Handle case where team might be just an ID string or already be a full team object
if (typeof team === 'string') {
return teamMap[team] || team;
}
return team._id ? teamMap[team._id] || team : team;
})
.filter(Boolean); // Remove any undefined teams
}
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The team mapping logic has been updated to handle both team ID strings and full team objects. However, the condition data?._id && data.teams means this mapping only occurs when editing an existing judge (one with an _id). For new judges being created, if data.teams exists but data._id doesn't, teams won't be mapped. Consider whether this is intentional or if the mapping should also apply when creating new judges if they somehow have teams assigned.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments