diff --git a/ui/lib/answer.csv b/ui/lib/answer.csv index 01c6d0f..6b9a736 100644 --- a/ui/lib/answer.csv +++ b/ui/lib/answer.csv @@ -1,7 +1,6 @@ -question0,question1,question2,question3,question4,question5,question6,question7 -answer1,answer1,answer1,answer1,answer1,answer1,answer1,answer1 -answer2,answer2,answer2,answer2,answer2,answer2,answer2,answer2 -answer3,answer3,answer3,answer3,answer3,answer3,answer3,answer3 -answer4,answer4,answer4,answer4,answer4,answer4,answer4,answer4 -answer5,answer5,answer5,answer5,answer5,answer5,answer5,answer5 -answer6,answer6,answer6,answer6,answer6,answer6,answer6,answer6 +question0,question1,question2,question3,question4,question5,question6,question7,question8 +"Listening to what everyone has to say!","Water purifying water bottle","Use the strength of an empire to make this nation feel hopeless","Be well-liked. You want people to trust your judgment, and have as many friends as possible.","Ask upperclassmen for for tips and tricks","Find your RA’s Discord and call them immediately","Gardening!","I don’t have social media!","Do other class’s homework" +"Leading the conversation and planning another hangout","You already have an emergency backpack packed","Send someone to marry the heir to their throne to take over from the within","Be a ruler. You like it when people go to you for advice, when people look to you as their leader. You like to assign tasks, rather than do them.","Start a study group that meets daily","First tell all of your friends also stuck in the elevator to calm down and not panic and ask everyone to brainstorm a solution","Speech and Debate!","Instagram","always asking questions, when you’re not asking questions you’re talking to your friends" +"Thinking about what book you’re going to read when you get home","Survival for Dummies","Take the time to learn about the history of this nation and research its weaknesses to exploit them.","Be wise. Knowledge is your source of happiness. Nothing pleases you more but seeing your own intellectual growth.","Drill pass exams questions","Try to debug the elevator yourself","University Book Club!","Pinterest","Active listening and reflecting and making connections" +"Talking everyone’s ear off about your latest rock climbing experience","GoPro! Gotta vlog the journey","Stage a surprise attack on a sacred holiday of this nation.","Be a risk-taker. Exploring new things and taking on the challenges that others quiver from gives you unprecedented dopamine. You believe only great risks can there be great success","Trick your professor into giving you the topics and types of questions on the exam","Try to kick the door open","Outdoor Adventure Club!","Tiktok","Haha you’re kidding I won’t be in class" +"On a discord channel","Laptop. We’ll figure out the wifi later","Launch a cyber attack to nullify all communications inside and out.","Be remembered. You see leaving your mark on the world as the meaning in life. You want to leave a lasting impression on the world through the work you do!","Go to online office hours and ask for rundowns of potential topics","Pretend it didn’t happen and continue to game","Online Gaming Club!","Twitch","Game with mechanical keyboard" \ No newline at end of file diff --git a/ui/lib/cabinTypes.csv b/ui/lib/cabinTypes.csv index 69f81f2..e9612fb 100644 --- a/ui/lib/cabinTypes.csv +++ b/ui/lib/cabinTypes.csv @@ -1 +1 @@ -cabin0,cabin1,cabin2,cabin3,cabin4 +Finding Nemo,Sharknado,Northern Water Tribe,Bikini Bottom,Minecraft Ocean Monument \ No newline at end of file diff --git a/ui/lib/questionNameMapping.csv b/ui/lib/questionNameMapping.csv index db00c19..484d744 100644 --- a/ui/lib/questionNameMapping.csv +++ b/ui/lib/questionNameMapping.csv @@ -1,2 +1,2 @@ -hangingWithFriends,zombieApocalypse,takeOverNation,aspirations,study,stuckInElevator,socialMedia,duringClass -question0,question1,question2,question3,question4,question5,question6,question7 \ No newline at end of file +hangingWithFriends,zombieApocalypse,takeOverNation,aspirations,study,stuckInElevator,club,socialMedia,duringClass +question0,question1,question2,question3,question4,question5,question6,question7,question8 \ No newline at end of file diff --git a/ui/lib/service/SortedHackerApplicationDataService.ts b/ui/lib/service/SortedHackerApplicationDataService.ts index e892c75..c67b88d 100644 --- a/ui/lib/service/SortedHackerApplicationDataService.ts +++ b/ui/lib/service/SortedHackerApplicationDataService.ts @@ -24,33 +24,32 @@ let answerList: any[] let cabinList: any[] let questionNameMapping: { [key: string]: string } const CABIN_SIZE = 5 -const QUESTIONS_SIZE = 8 - -const getAllHackersWithAssignedCabins = async (): Promise< - SortedHackersReturnType -> => { - await fetch('http://localhost:3000/api/cabinSorting/answerList') - .then((response) => response.json()) - .then((data) => { - answerList = data.content - }) - - await fetch('http://localhost:3000/api/cabinSorting/cabinList') - .then((response) => response.json()) - .then((data) => { - cabinList = data.content[0] - }) - - await fetch('http://localhost:3000/api/cabinSorting/questionNameMapping') - .then((response) => response.json()) - .then((data) => { - questionNameMapping = data - }) - - const rawHackerData = await HackerApplicationDataDao.find() - const formattedHackerData = formatRawData(rawHackerData) - return matchAnswers(formattedHackerData) -} +const QUESTIONS_SIZE = 9 + +const getAllHackersWithAssignedCabins = + async (): Promise => { + await fetch('http://localhost:3000/api/cabinSorting/answerList') + .then((response) => response.json()) + .then((data) => { + answerList = data.content + }) + + await fetch('http://localhost:3000/api/cabinSorting/cabinList') + .then((response) => response.json()) + .then((data) => { + cabinList = data.content[0] + }) + + await fetch('http://localhost:3000/api/cabinSorting/questionNameMapping') + .then((response) => response.json()) + .then((data) => { + questionNameMapping = data + }) + + const rawHackerData = await HackerApplicationDataDao.find() + const formattedHackerData = formatRawData(rawHackerData) + return matchAnswers(formattedHackerData) + } const pingServer = async (): Promise => { for (let i = 1; i <= 3; i++) { @@ -80,7 +79,12 @@ function formatRawData ( rawHackerData: HackerApplicationDataType[] ): FormattedHackerDataType[] { return rawHackerData - .filter((hackerData) => !!hackerData.postAcceptanceResponses) + .filter( + (hackerData) => + hackerData.decisionStatus === 'Admitted' && + hackerData.rsvpStatus === 'Confirmed' && + !!hackerData.postAcceptanceResponses + ) .map((hackerData) => { const { email, postAcceptanceResponses } = hackerData @@ -156,16 +160,17 @@ function hydrateCabinScore ( hacker: FormattedHackerWithCabinsDataType, cabinScore: number[] ) { - answerList.forEach((cabin: any, cabinIndex: number) => { - // skip first row of answerList because of question name - if (cabinIndex === 0) return + // skip first row of answerList because of question name + answerList.slice(1).forEach((cabin: any, cabinIndex: number) => { + console.log(cabin, cabinIndex) for ( let questionIndex = 0; questionIndex < QUESTIONS_SIZE; questionIndex++ ) { if ( - cabin[questionIndex] === hacker['question' + questionIndex.toString()] + cabin[questionIndex].trim() === + hacker['question' + questionIndex.toString()].trim() ) { cabinScore[cabinIndex]++ } diff --git a/ui/models/HackerApplicationData.ts b/ui/models/HackerApplicationData.ts index 0aa348b..04d08a8 100644 --- a/ui/models/HackerApplicationData.ts +++ b/ui/models/HackerApplicationData.ts @@ -48,7 +48,7 @@ export const HackerApplicationDataSchema = } }, { - collection: 'hacker_applications', + collection: 'applicant_data', versionKey: false } ) diff --git a/ui/pages/cabinSorting.tsx b/ui/pages/cabinSorting.tsx index da9f88c..e7d6b40 100644 --- a/ui/pages/cabinSorting.tsx +++ b/ui/pages/cabinSorting.tsx @@ -23,11 +23,11 @@ export default function CabinSorting ({ cabinData }: InferGetServerSidePropsType) { const cabinHeaders: string[] = [ - 'Cabin 0', - 'Cabin 1', - 'Cabin 2', - 'Cabin 3', - 'Cabin 4' + 'Finding Nemo', + 'Sharknado', + 'Northern Water Tribe', + 'Bikini Bottom', + 'Minecraft Ocean Monument' ] const cabinValues: string[][] = []