Skip to content
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

Feat/team grouping #54

Merged
merged 5 commits into from
Apr 18, 2024
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
81 changes: 54 additions & 27 deletions app/(api)/_data/tracks.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
4 changes: 2 additions & 2 deletions app/(api)/_schema/Judge.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 2 additions & 3 deletions app/(api)/_schema/JudgeGroup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 1 addition & 9 deletions app/(api)/_schema/Team.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion app/(api)/_types/judges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface JudgeInt {
password: string;
specialty: string;
role: string;
judge_pair_id?: string;
judge_group_id?: string;
submission_ids?: string[];
}

Expand Down
2 changes: 0 additions & 2 deletions app/(api)/_types/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 4 additions & 7 deletions app/(api)/_utils/grouping/groupJudges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 : ''],
},
},
});
Expand Down
1 change: 1 addition & 0 deletions app/(api)/_utils/scoring/calculateScore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion app/(api)/api/judge-groups/[id]/put.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down