-
Notifications
You must be signed in to change notification settings - Fork 2
Panel judging opt in #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panel judging opt in #343
Changes from all commits
cf38738
8882278
401f570
f52462c
e454ae3
1790027
04aa349
e0b0d97
e9a7027
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,10 +49,16 @@ export default function JudgeForm({ | |
| teams.body.map((team: any) => [team._id, team]) | ||
| ); | ||
|
|
||
| if (data?._id) { | ||
| data.teams = data.teams.map((team: any) => { | ||
| return teamMap[team._id]; | ||
| }); | ||
| 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 | ||
| } | ||
|
Comment on lines
+52
to
62
|
||
|
|
||
| const onSubmit = async (event: React.FormEvent<HTMLFormElement>) => { | ||
|
|
@@ -91,6 +97,11 @@ export default function JudgeForm({ | |
| validation: (has_checked_in: any) => | ||
| has_checked_in === true || has_checked_in === false, | ||
| }, | ||
| { | ||
| field: 'opted_into_panels', | ||
| validation: (opted_into_panels: any) => | ||
| opted_into_panels === true || opted_into_panels === false, | ||
| }, | ||
michelleyeoh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ]; | ||
|
|
||
| verificationList.forEach(({ field, validation }) => { | ||
|
|
@@ -104,13 +115,23 @@ export default function JudgeForm({ | |
| return; | ||
| } | ||
|
|
||
| const { _id, name, email, role, specialties, teams, has_checked_in } = data; | ||
| const { | ||
| _id, | ||
| name, | ||
| email, | ||
| role, | ||
| specialties, | ||
| teams, | ||
| has_checked_in, | ||
| opted_into_panels, | ||
| } = data; | ||
| const body = { | ||
| name, | ||
| email, | ||
| role, | ||
| specialties, | ||
| has_checked_in, | ||
| opted_into_panels, | ||
| }; | ||
|
|
||
| const res = await updateJudgeWithTeams(_id, { $set: body }, teams); | ||
|
|
@@ -232,6 +253,16 @@ export default function JudgeForm({ | |
| { option: 'false', value: false }, | ||
| ]} | ||
| /> | ||
| <DropdownInput | ||
| label="opted into panels" | ||
| value={data.opted_into_panels} | ||
michelleyeoh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| updateValue={(value: any) => updateField('opted_into_panels', value)} | ||
| width="400px" | ||
| options={[ | ||
| { option: 'true', value: true }, | ||
| { option: 'false', value: false }, | ||
| ]} | ||
| /> | ||
| <div className={styles.action_buttons}> | ||
| <button className={styles.submit_button} type="submit"> | ||
| Submit | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.