Skip to content

Commit 072499e

Browse files
authored
Merge pull request #161 from Finite-Loop-Club-NMAMIT/staging
Release: staging → main
2 parents f42e649 + 15fda14 commit 072499e

3 files changed

Lines changed: 429 additions & 291 deletions

File tree

src/app/api/dashboard/panel/leaderboard/route.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { type NextRequest, NextResponse } from "next/server";
33
import { adminProtected } from "~/auth/routes-wrapper";
44
import db from "~/db";
55
import {
6+
ideaSubmission,
67
panelCriterias,
78
panelTeamRoundScores,
89
teamRoundScores,
910
teams,
11+
tracks,
1012
} from "~/db/schema";
1113

1214
export const GET = adminProtected(async (req: NextRequest) => {
@@ -37,9 +39,13 @@ export const GET = adminProtected(async (req: NextRequest) => {
3739
rawTotalScore: panelTeamRoundScores.rawTotalScore,
3840
normalizedTotalScore: panelTeamRoundScores.normalizedTotalScore,
3941
panelistCount: panelTeamRoundScores.panelistCount,
42+
trackId: ideaSubmission.trackId,
43+
trackName: tracks.name,
4044
})
4145
.from(panelTeamRoundScores)
4246
.innerJoin(teams, eq(teams.id, panelTeamRoundScores.teamId))
47+
.leftJoin(ideaSubmission, eq(ideaSubmission.teamId, panelTeamRoundScores.teamId))
48+
.leftJoin(tracks, eq(tracks.id, ideaSubmission.trackId))
4349
.where(eq(panelTeamRoundScores.roundId, panelRoundId));
4450

4551
// Judge Z-score totals (sum of normalized_total_score across ALL judge rounds per team)
@@ -90,6 +96,8 @@ export const GET = adminProtected(async (req: NextRequest) => {
9096
return {
9197
teamId: row.teamId,
9298
teamName: row.teamName,
99+
trackId: row.trackId ?? null,
100+
trackName: row.trackName ?? null,
93101
rawTotalScore: row.rawTotalScore ?? 0,
94102
normalizedTotalScore: row.normalizedTotalScore ?? 0,
95103
maxPossibleScore,

0 commit comments

Comments
 (0)