From ad5ef57fca1c75a908e3e4a30c07dbd89e520361 Mon Sep 17 00:00:00 2001 From: brandonw504 Date: Wed, 17 Apr 2024 22:19:50 -0700 Subject: [PATCH 1/4] Added default track to scoring --- app/(api)/_utils/scoring/calculateScore.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/(api)/_utils/scoring/calculateScore.ts b/app/(api)/_utils/scoring/calculateScore.ts index 0a7ebbb0..0fb5ea62 100644 --- a/app/(api)/_utils/scoring/calculateScore.ts +++ b/app/(api)/_utils/scoring/calculateScore.ts @@ -10,6 +10,7 @@ export default function calculateScore( scores: number[], correlations: Correlation[] ) { + chosenTracks.push('Best Hack for Social Good'); const finalScores = chosenTracks.map((chosenTrack) => { const weights = tracks.find((track) => track.name == chosenTrack); const score = weights?.weights.reduce((sum, weight, i) => { From 99e6b0e5c762821fa6ac30922e1383ff3ac9643a Mon Sep 17 00:00:00 2001 From: brandonw504 Date: Wed, 17 Apr 2024 22:26:08 -0700 Subject: [PATCH 2/4] Updated tracks to have types --- app/(api)/_data/tracks.json | 81 ++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/app/(api)/_data/tracks.json b/app/(api)/_data/tracks.json index dbd49fa7..d29ec70e 100644 --- a/app/(api)/_data/tracks.json +++ b/app/(api)/_data/tracks.json @@ -1,110 +1,137 @@ [ { "name": "Best Hack for Social Good", - "weights": [0.5, 0.1, 0.1, 0.2, 0.1] + "weights": [0.5, 0.1, 0.1, 0.2, 0.1], + "type": "general" }, { "name": "Best Beginner Hack", - "weights": [0.35, 0.15, 0.1, 0.2, 0.2] + "weights": [0.35, 0.15, 0.1, 0.2, 0.2], + "type": "general" }, { "name": "Best Interdisciplinary Hack", - "weights": [0.35, 0.4, 0.05, 0.1, 0.1] + "weights": [0.35, 0.4, 0.05, 0.1, 0.1], + "type": "general" }, { "name": "Best Hardware Hack", - "weights": [0.35, 0.3, 0.05, 0.2, 0.1] + "weights": [0.35, 0.3, 0.05, 0.2, 0.1], + "type": "tech" }, { "name": "Best Health Hack", - "weights": [0.35, 0.2, 0.15, 0.2, 0.1] + "weights": [0.35, 0.2, 0.15, 0.2, 0.1], + "type": "general" }, { "name": "Best Hack for Social Justice", - "weights": [0.5, 0.1, 0.1, 0.2, 0.1] + "weights": [0.5, 0.1, 0.1, 0.2, 0.1], + "type": "general" }, { "name": "Most Creative Hack", - "weights": [0.35, 0.05, 0.15, 0.3, 0.15] + "weights": [0.35, 0.05, 0.15, 0.3, 0.15], + "type": "general" }, { "name": "Best Cybersecurity Hack", - "weights": [0.35, 0.3, 0.05, 0.2, 0.1] + "weights": [0.35, 0.3, 0.05, 0.2, 0.1], + "type": "tech" }, { "name": "Best AI/ML Hack", - "weights": [0.35, 0.3, 0.05, 0.2, 0.1] + "weights": [0.35, 0.3, 0.05, 0.2, 0.1], + "type": "tech" }, { "name": "Best use of IntelĀ® Developer Cloud", - "weights": [0.35, 0.3, 0.05, 0.2, 0.1] + "weights": [0.35, 0.3, 0.05, 0.2, 0.1], + "type": "tech" }, { "name": "Most Technically Challenging Hack", - "weights": [0.35, 0.4, 0.05, 0.1, 0.1] + "weights": [0.35, 0.4, 0.05, 0.1, 0.1], + "type": "tech" }, { "name": "Best UI/UX Prototyping", - "weights": [0.35, 0.05, 0.4, 0.1, 0.1] + "weights": [0.35, 0.05, 0.4, 0.1, 0.1], + "type": "design" }, { "name": "Best Overall Design", - "weights": [0.35, 0.05, 0.4, 0.1, 0.1] + "weights": [0.35, 0.05, 0.4, 0.1, 0.1], + "type": "design" }, { "name": "Best User Research", - "weights": [0.35, 0.05, 0.3, 0.2, 0.1] + "weights": [0.35, 0.05, 0.3, 0.2, 0.1], + "type": "design" }, { "name": "Best Interactive Media Hack", - "weights": [0.35, 0.05, 0.2, 0.2, 0.2] + "weights": [0.35, 0.05, 0.2, 0.2, 0.2], + "type": "design" }, { "name": "Best Finance + Tech Hack", - "weights": [0.35, 0.2, 0.15, 0.2, 0.1] + "weights": [0.35, 0.2, 0.15, 0.2, 0.1], + "type": "tech" }, { "name": "Best Entrepreneurship Hack", - "weights": [0.35, 0.05, 0.1, 0.2, 0.3] + "weights": [0.35, 0.05, 0.1, 0.2, 0.3], + "type": "general" }, { "name": "Best Statistical Model", - "weights": [0.35, 0.4, 0.05, 0.1, 0.1] + "weights": [0.35, 0.4, 0.05, 0.1, 0.1], + "type": "tech" }, { "name": "Best DEI Hack", - "weights": [0.5, 0.1, 0.1, 0.2, 0.1] + "weights": [0.5, 0.1, 0.1, 0.2, 0.1], + "type": "general" }, { "name": "Best Use of Kintone", - "weights": [0.35, 0.3, 0.05, 0.2, 0.1] + "weights": [0.35, 0.3, 0.05, 0.2, 0.1], + "type": "tech" }, { "name": "Best .Tech Domain Name", - "weights": [0.35, 0.25, 0.05, 0.25, 0.1] + "weights": [0.35, 0.25, 0.05, 0.25, 0.1], + "type": "tech" }, { "name": "Best Use of TinyMCE", - "weights": [0.35, 0.3, 0.05, 0.2, 0.1] + "weights": [0.35, 0.3, 0.05, 0.2, 0.1], + "type": "tech" }, { "name": "Best Use of PropelAuth", - "weights": [0.35, 0.3, 0.05, 0.2, 0.1] + "weights": [0.35, 0.3, 0.05, 0.2, 0.1], + "type": "tech" }, { "name": "Sauce Labs Raffle", - "weights": [0.35, 0.25, 0.05, 0.25, 0.1] + "weights": [0.35, 0.25, 0.05, 0.25, 0.1], + "type": "tech" }, { "name": "Life of Kai", - "weights": [0.35, 0.25, 0.05, 0.25, 0.1] + "weights": [0.35, 0.25, 0.05, 0.25, 0.1], + "type": "tech" }, { "name": "DCMH", - "weights": [0.35, 0.25, 0.05, 0.25, 0.1] + "weights": [0.35, 0.25, 0.05, 0.25, 0.1], + "type": "tech" }, { "name": "AggieHouse", - "weights": [0.35, 0.25, 0.05, 0.25, 0.1] + "weights": [0.35, 0.25, 0.05, 0.25, 0.1], + "type": "tech" } ] \ No newline at end of file From 32b7439db3e9cd11c250572f6ce4a4b5b294e90c Mon Sep 17 00:00:00 2001 From: brandonw504 Date: Wed, 17 Apr 2024 22:54:40 -0700 Subject: [PATCH 3/4] Changed nontech to general --- .../{updateJudgePair.ts => updateJudgeGroup.ts} | 0 app/(api)/_schema/Judge.mjs | 4 ++-- app/(api)/_schema/JudgeGroup.mjs | 5 ++--- app/(api)/_schema/Team.mjs | 10 +--------- app/(api)/_types/teams.ts | 2 -- app/(api)/_utils/grouping/groupJudges.ts | 11 ++++------- 6 files changed, 9 insertions(+), 23 deletions(-) rename app/(api)/_datalib/judgeGroups/{updateJudgePair.ts => updateJudgeGroup.ts} (100%) diff --git a/app/(api)/_datalib/judgeGroups/updateJudgePair.ts b/app/(api)/_datalib/judgeGroups/updateJudgeGroup.ts similarity index 100% rename from app/(api)/_datalib/judgeGroups/updateJudgePair.ts rename to app/(api)/_datalib/judgeGroups/updateJudgeGroup.ts diff --git a/app/(api)/_schema/Judge.mjs b/app/(api)/_schema/Judge.mjs index 7f85b122..ab1b530e 100644 --- a/app/(api)/_schema/Judge.mjs +++ b/app/(api)/_schema/Judge.mjs @@ -21,8 +21,8 @@ const Judge = { description: 'encrypted password must be a string', }, specialty: { - enum: ['tech', 'nontech', 'design'], - description: 'specialty must be either tech, nontech, or design', + enum: ['tech', 'general', 'design'], + description: 'specialty must be either tech, general, or design', }, judge_group_id: { bsonType: 'objectId', diff --git a/app/(api)/_schema/JudgeGroup.mjs b/app/(api)/_schema/JudgeGroup.mjs index 8a502463..06d6bb1c 100644 --- a/app/(api)/_schema/JudgeGroup.mjs +++ b/app/(api)/_schema/JudgeGroup.mjs @@ -8,9 +8,8 @@ const JudgeGroup = { description: '_id must be an ObjectId', }, type: { - enum: ['T', 'TN', 'D'], - description: - 'type must be either T (tech), TN (tech-nontech), or D (design).', + enum: ['T', 'G', 'D'], + description: 'type must be either T (tech), G (general), or D (design).', }, judge_ids: { bsonType: 'array', diff --git a/app/(api)/_schema/Team.mjs b/app/(api)/_schema/Team.mjs index 68033ff0..f83643c6 100644 --- a/app/(api)/_schema/Team.mjs +++ b/app/(api)/_schema/Team.mjs @@ -3,7 +3,7 @@ import tracks from '../_data/tracks.json' assert { type: 'json' }; const Team = { bsonType: 'object', title: 'Team Object Validation', - required: ['number', 'name', 'tracks', 'tech_emphasis', 'design_emphasis'], + required: ['number', 'name', 'tracks'], properties: { _id: { bsonType: 'objectId', @@ -25,14 +25,6 @@ const Team = { }, description: 'tracks must be an array of strings', }, - tech_emphasis: { - bsonType: 'int', - description: 'tech_emphasis must be an integer', - }, - design_emphasis: { - bsonType: 'int', - description: 'design_emphasis must be an integer', - }, }, additionalProperties: false, }; diff --git a/app/(api)/_types/teams.ts b/app/(api)/_types/teams.ts index 24048574..88cedcd2 100644 --- a/app/(api)/_types/teams.ts +++ b/app/(api)/_types/teams.ts @@ -2,8 +2,6 @@ interface TeamInt { number: number; tracks: string[]; name: string; - tech_emphasis: number; - design_emphasis: number; judge_pair_ids?: string[]; submission_ids?: string[]; _id: string; diff --git a/app/(api)/_utils/grouping/groupJudges.ts b/app/(api)/_utils/grouping/groupJudges.ts index 058892f3..07df9cbf 100644 --- a/app/(api)/_utils/grouping/groupJudges.ts +++ b/app/(api)/_utils/grouping/groupJudges.ts @@ -2,22 +2,19 @@ import Judge from '@typeDefs/judges'; export default function groupJudges(judges: Judge[]) { const techJudges = judges.filter((judge) => judge.specialty === 'tech'); - const nonTechJudges = judges.filter((judge) => judge.specialty === 'nontech'); + const generalJudges = judges.filter((judge) => judge.specialty === 'general'); const desJudges = judges.filter((judge) => judge.specialty === 'design'); const groups: { type: string; judge_ids: object }[] = []; - nonTechJudges.forEach((ntJudge) => { + generalJudges.forEach((gJudge) => { if (techJudges.length > 0) { const tJudge = techJudges.shift(); groups.push({ - type: 'TN', + type: 'G', judge_ids: { '*convertIds': { - ids: [ - ntJudge._id ? ntJudge._id : '', - tJudge?._id ? tJudge._id : '', - ], + ids: [gJudge._id ? gJudge._id : '', tJudge?._id ? tJudge._id : ''], }, }, }); From bfad68eeace89ba5524c0700489918d34cbb89a8 Mon Sep 17 00:00:00 2001 From: brandonw504 Date: Wed, 17 Apr 2024 23:31:19 -0700 Subject: [PATCH 4/4] Fixed naming error --- app/(api)/_types/judges.ts | 2 +- app/(api)/api/judge-groups/[id]/put.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/(api)/_types/judges.ts b/app/(api)/_types/judges.ts index 33d61d41..8298d131 100644 --- a/app/(api)/_types/judges.ts +++ b/app/(api)/_types/judges.ts @@ -5,7 +5,7 @@ interface JudgeInt { password: string; specialty: string; role: string; - judge_pair_id?: string; + judge_group_id?: string; submission_ids?: string[]; } diff --git a/app/(api)/api/judge-groups/[id]/put.ts b/app/(api)/api/judge-groups/[id]/put.ts index 24344dc1..2209b7a1 100644 --- a/app/(api)/api/judge-groups/[id]/put.ts +++ b/app/(api)/api/judge-groups/[id]/put.ts @@ -1,5 +1,5 @@ import { NextRequest } from 'next/server'; -import { UpdateJudgeGroup } from '@datalib/judgeGroups/updateJudgePair'; +import { UpdateJudgeGroup } from '@datalib/judgeGroups/updateJudgeGroup'; export async function PUT( request: NextRequest,