Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/features/factotum/add-members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import { toast } from "sonner";
export default function AddMembers() {
const [emails, setEmails] = useState<string>("");
const server = useFactotum().server;
const [selectedRoles, setSelectedRoles] = useState<string[]>(["mentor"]);
const [selectedRoles, setSelectedRoles] = useState<string[]>(["hacker"]);

const availableRoles = [
{
label: "Hacker",
value: "hacker",
},
{
label: "Mentor",
value: "mentor",
Expand Down Expand Up @@ -40,7 +44,7 @@ export default function AddMembers() {
.split("\n")
.map((e) => e.trim())
.filter((e) => e.length > 0);

if (emailList.length === 0 || selectedRoles.length === 0) {
toast.error("You must select at least one role and provide at least one email");
return;
Expand Down
1 change: 1 addition & 0 deletions src/components/features/hackerapp/hacker-app-question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const FORM_INPUT_OPTIONS: HackerApplicationQuestionFormInputField[] = [
"race",
"jobPosition",
"connectPlus",
"travellingToHackathon",
];

export const SHOW_FORM_INPUT: HackerApplicationQuestionType[] = [
Expand Down
4 changes: 3 additions & 1 deletion src/lib/firebase/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export interface Applicant {
gender: string | Record<string, boolean>;
graduation: number;
isOfLegalAge: boolean;
ageByHackathon: string;
location: string; // city
major: ApplicantMajor | Record<string, boolean>;
phoneNumber: string; // "+1 XXX-XXX-XXXX"
Expand Down Expand Up @@ -318,7 +319,8 @@ export type HackerApplicationQuestionFormInputField =
| "pronouns"
| "race"
| "jobPosition"
| "connectPlus";
| "connectPlus"
| "travellingToHackathon";
export interface HackerApplicationQuestion {
_id?: string; // internal
title?: string;
Expand Down
12 changes: 11 additions & 1 deletion src/services/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ export const flattenApplicantData = (applicant: Applicant, hackathon?: string):
const hackathonYear = year ? Number.parseInt(year) : 2025;
const isLegacyFormat = hackathonYear < 2024 || hackathon === "nwHacks2024";

const computedIsOfLegalAge = (applicant: Applicant) => {
const rawAge = applicant.basicInfo?.ageByHackathon
if (rawAge == "<=16") return false
if (rawAge == ">24") return true

const numericAge = typeof rawAge === "number" ? rawAge : Number(rawAge)
return numericAge >= 19
}

const flattened: FlattenedApplicant = {
// Basic Info
firstName: applicant.basicInfo?.legalFirstName || applicant.basicInfo?.firstName || "",
Expand All @@ -55,7 +64,7 @@ export const flattenApplicantData = (applicant: Applicant, hackathon?: string):
applicant.basicInfo?.gender as Record<string, boolean> | undefined,
''
),
isOfLegalAge: applicant.basicInfo?.isOfLegalAge || false,
isOfLegalAge: computedIsOfLegalAge(applicant),
culturalBackground: returnTrueKey(applicant.basicInfo?.ethnicity || applicant.basicInfo?.culturalBackground),
dietaryRestriction: createStringFromSelection(
applicant.basicInfo?.dietaryRestriction,
Expand Down Expand Up @@ -148,6 +157,7 @@ export const getAvailableColumns = (): string[] => {
gender: "",
location: "",
isOfLegalAge: true,
ageByHackathon: "0",
ethnicity: {
asian: false,
black: false,
Expand Down