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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ migrations/
.claude/settings.local.json
packages/db/scripts/seed.ts
packages/db/scripts/seed2.ts
scripts/seed-stripe.ts
scripts/seed-stripe.ts
packages/db/scripts/seed-judges.ts
packages/db/scripts/seed-projects.ts
13 changes: 11 additions & 2 deletions packages/api/src/routers/judge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export const judgeRouter = createTRPCRouter({
scoreScope: z.number().min(1).max(10),
scoreClarity: z.number().min(1).max(10),
scoreSoundness: z.number().min(1).max(10),
scoreImagination: z.number().min(1).max(10).optional(),
comment: z.string().max(1000).optional(),
})
)
Expand All @@ -173,6 +174,7 @@ export const judgeRouter = createTRPCRouter({
scoreScope: input.scoreScope,
scoreClarity: input.scoreClarity,
scoreSoundness: input.scoreSoundness,
scoreImagination: input.scoreImagination,
comment: input.comment,
updatedAt: new Date(),
})
Expand All @@ -193,6 +195,7 @@ export const judgeRouter = createTRPCRouter({
scoreScope: input.scoreScope,
scoreClarity: input.scoreClarity,
scoreSoundness: input.scoreSoundness,
scoreImagination: input.scoreImagination,
comment: input.comment,
})
.returning();
Expand All @@ -210,6 +213,7 @@ export const judgeRouter = createTRPCRouter({
scoreScope: z.number().min(1).max(10),
scoreClarity: z.number().min(1).max(10),
scoreSoundness: z.number().min(1).max(10),
scoreImagination: z.number().min(1).max(10).optional(),
comment: z.string().max(1000).optional(),
})
)
Expand All @@ -232,6 +236,7 @@ export const judgeRouter = createTRPCRouter({
scoreScope: input.scoreScope,
scoreClarity: input.scoreClarity,
scoreSoundness: input.scoreSoundness,
scoreImagination: input.scoreImagination,
comment: input.comment,
updatedAt: new Date(),
})
Expand All @@ -246,6 +251,7 @@ export const judgeRouter = createTRPCRouter({
scoreScope: input.scoreScope,
scoreClarity: input.scoreClarity,
scoreSoundness: input.scoreSoundness,
scoreImagination: input.scoreImagination,
comment: input.comment,
});
}
Expand Down Expand Up @@ -363,13 +369,14 @@ export const judgeRouter = createTRPCRouter({
const avgScore = voteCount > 0 ? totalScore / voteCount : 0;

// Per-category averages
const sumCat = { creativity: 0, impact: 0, scope: 0, clarity: 0, soundness: 0 };
const sumCat = { creativity: 0, impact: 0, scope: 0, clarity: 0, soundness: 0, imagination: 0 };
project.votes.forEach((v) => {
sumCat.creativity += v.scoreCreativity ?? 0;
sumCat.impact += v.scoreImpact ?? 0;
sumCat.scope += v.scoreScope ?? 0;
sumCat.clarity += v.scoreClarity ?? 0;
sumCat.soundness += v.scoreSoundness ?? 0;
sumCat.imagination += v.scoreImagination ?? 0;
});

const categoryAvg = voteCount > 0
Expand All @@ -379,8 +386,9 @@ export const judgeRouter = createTRPCRouter({
scope: round2(sumCat.scope / voteCount),
clarity: round2(sumCat.clarity / voteCount),
soundness: round2(sumCat.soundness / voteCount),
imagination: round2(sumCat.imagination / voteCount),
}
: { creativity: 0, impact: 0, scope: 0, clarity: 0, soundness: 0 };
: { creativity: 0, impact: 0, scope: 0, clarity: 0, soundness: 0, imagination: 0 };

return {
project: {
Expand All @@ -404,6 +412,7 @@ export const judgeRouter = createTRPCRouter({
scoreScope: v.scoreScope,
scoreClarity: v.scoreClarity,
scoreSoundness: v.scoreSoundness,
scoreImagination: v.scoreImagination,
comment: v.comment,
judgeName: v.judge.user?.name || v.judge.name || "Unknown",
})),
Expand Down
2 changes: 2 additions & 0 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"migrate:generate": "drizzle-kit generate",
"studio": "drizzle-kit studio",
"db:seed": "tsx scripts/seed.ts",
"db:seed:judges": "tsx scripts/seed-judges.ts",
"db:seed:projects": "tsx scripts/seed-projects.ts",
"db:seed2": "tsx scripts/seed2.ts",
"db:seed:super": "tsx scripts/seed-super.ts",
"db:reset": "tsx scripts/reset.ts"
Expand Down
11 changes: 7 additions & 4 deletions packages/db/src/schemas/judge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const judgeAssignments = pgTable("judge_assignment", {
.references(() => hackathons.id, { onDelete: "cascade" }),
assignedAt: timestamp("assigned_at").defaultNow().notNull(),
isLead: boolean("is_lead").notNull().default(false),
track: text("track"), // Optional: if set, judge only sees projects in this track/challenge
track: text("track"),
}, (table) => [
index("assignment_judge_id_idx").on(table.judgeId),
index("assignment_hackathon_id_idx").on(table.hackathonId),
Expand All @@ -45,12 +45,12 @@ export const judgingProjects = pgTable("judging_project", {
description: text("description"),
tableNumber: integer("table_number").notNull(),
category: text("category"), // e.g., "AI", "Web3", "Health", "Sustainability"
tracks: text("tracks").array(),
challenges: text("challenges").array(),
isCreateX: boolean("is_create_x").default(false),
teamMembers: text("team_members"), // comma-separated or JSON string
projectUrl: text("project_url"),
repoUrl: text("repo_url"),
tracks: text("tracks").array(), // Enum: GEN-AI, SPORTS, FINANCE, HEALTH, CYBER, NONE
challenges: text("challenges").array(), // Enum: AGG, ASSURANT, AWS, CAPONE, GROWTH, MLH_MONGODB, MLH_STREAMLIT, MLH_TECH, MLH_CLOUDFLARE, MLH_REACH_CAPITAL
isCreateX: boolean("is_create_x").default(false),
createdAt: timestamp("created_at").defaultNow().notNull(),
}, (table) => [
index("judging_project_hackathon_id_idx").on(table.hackathonId),
Expand All @@ -68,6 +68,8 @@ export const judgeVotes = pgTable("judge_vote", {
.references(() => judgingProjects.id, { onDelete: "cascade" }),
score: integer("score").notNull(), // Total score (sum of all criteria, 5-50)
// Rubric scores (1-10 each)

scoreImagination: integer("score_imagination"), // immagination track
scoreCreativity: integer("score_creativity"), // Creativity & Originality
scoreImpact: integer("score_impact"), // Impact & Relevance
scoreScope: integer("score_scope"), // Scope & Technical Depth
Expand Down Expand Up @@ -168,6 +170,7 @@ export const hackathonMapsRelations = relations(hackathonMaps, ({ one }) => ({
}),
}));


export const judgeQueueRelations = relations(judgeQueue, ({ one }) => ({
judge: one(judges, {
fields: [judgeQueue.judgeId],
Expand Down
Loading
Loading