@@ -84,7 +74,7 @@ export function SmartActions({ actions }: SmartActionsProps) {
) : (
- {sorted.map((action) => {
+ {actions.map((action) => {
const config = severityConfig[action.severity]
const Icon = config.icon
diff --git a/src/components/observer/observer-dashboard-content.tsx b/src/components/observer/observer-dashboard-content.tsx
index 61dd160..d6a7a1b 100644
--- a/src/components/observer/observer-dashboard-content.tsx
+++ b/src/components/observer/observer-dashboard-content.tsx
@@ -290,13 +290,9 @@ export function ObserverDashboardContent({ userName }: { userName?: string }) {
Submitted
Eligible
Assigned
- Under Review
- Shortlisted
Semi-finalist
Finalist
- Winner
Rejected
- Withdrawn
{ setPerPage(Number(v)); setPage(1) }}>
diff --git a/src/components/shared/status-badge.tsx b/src/components/shared/status-badge.tsx
index e28cac4..10a6575 100644
--- a/src/components/shared/status-badge.tsx
+++ b/src/components/shared/status-badge.tsx
@@ -7,6 +7,10 @@ const STATUS_STYLES: Record e.globalScore!).filter((s) => s != null)
const scoreDistribution = [
- { label: '9-10', min: 9, max: 10 },
- { label: '7-8', min: 7, max: 8.99 },
- { label: '5-6', min: 5, max: 6.99 },
- { label: '3-4', min: 3, max: 4.99 },
- { label: '1-2', min: 1, max: 2.99 },
+ { label: '9-10', min: 9, max: Infinity },
+ { label: '7-8', min: 7, max: 9 },
+ { label: '5-6', min: 5, max: 7 },
+ { label: '3-4', min: 3, max: 5 },
+ { label: '1-2', min: 1, max: 3 },
].map((b) => ({
label: b.label,
- count: scores.filter((s) => s >= b.min && s <= b.max).length,
+ count: scores.filter((s) => s >= b.min && s < b.max).length,
}))
return {
@@ -770,7 +770,7 @@ export const analyticsRouter = router({
projectCount,
jurorCount,
submittedEvaluations,
- totalEvaluations: totalAssignments,
+ totalAssignments,
completionRate,
scoreDistribution,
}
diff --git a/src/server/routers/competition.ts b/src/server/routers/competition.ts
index 309e8b8..8292cd7 100644
--- a/src/server/routers/competition.ts
+++ b/src/server/routers/competition.ts
@@ -123,7 +123,7 @@ export const competitionRouter = router({
}
// Count distinct projects across all rounds (not sum of per-round states)
- const roundIds = competition.rounds.map((r) => r.id)
+ const roundIds = competition.rounds.filter((r) => !r.specialAwardId).map((r) => r.id)
const distinctProjectCount = roundIds.length > 0
? await ctx.prisma.projectRoundState.findMany({
where: { roundId: { in: roundIds } },
diff --git a/src/server/routers/deliberation.ts b/src/server/routers/deliberation.ts
index e5156ba..03c611c 100644
--- a/src/server/routers/deliberation.ts
+++ b/src/server/routers/deliberation.ts
@@ -146,7 +146,24 @@ export const deliberationRouter = router({
aggregate: adminProcedure
.input(z.object({ sessionId: z.string() }))
.query(async ({ ctx, input }) => {
- return aggregateVotes(input.sessionId, ctx.prisma)
+ const result = await aggregateVotes(input.sessionId, ctx.prisma)
+ // Enrich rankings with project titles
+ const projectIds = result.rankings.map((r) => r.projectId)
+ const projects = projectIds.length > 0
+ ? await ctx.prisma.project.findMany({
+ where: { id: { in: projectIds } },
+ select: { id: true, title: true, teamName: true },
+ })
+ : []
+ const projectMap = new Map(projects.map((p) => [p.id, p]))
+ return {
+ ...result,
+ rankings: result.rankings.map((r) => ({
+ ...r,
+ projectTitle: projectMap.get(r.projectId)?.title ?? 'Unknown Project',
+ teamName: projectMap.get(r.projectId)?.teamName ?? '',
+ })),
+ }
}),
/**
diff --git a/src/server/routers/project.ts b/src/server/routers/project.ts
index d085b00..516a301 100644
--- a/src/server/routers/project.ts
+++ b/src/server/routers/project.ts
@@ -89,19 +89,19 @@ export const projectRouter = router({
// Filter by program
if (programId) where.programId = programId
- // Filter by round (via RoundAssignment join)
+ // Filter by round (via ProjectRoundState)
if (roundId) {
- where.roundAssignments = { some: { roundId } }
+ where.projectRoundStates = { some: { roundId } }
}
// Exclude projects already in a specific round
if (excludeInRoundId) {
- where.roundAssignments = { none: { roundId: excludeInRoundId } }
+ where.projectRoundStates = { none: { roundId: excludeInRoundId } }
}
// Filter by unassigned (not in any round)
if (unassignedOnly) {
- where.roundAssignments = { none: {} }
+ where.projectRoundStates = { none: {} }
}
// Status filter
@@ -223,13 +223,13 @@ export const projectRouter = router({
if (programId) where.programId = programId
if (roundId) {
- where.roundAssignments = { some: { roundId } }
+ where.projectRoundStates = { some: { roundId } }
}
if (excludeInRoundId) {
- where.roundAssignments = { none: { roundId: excludeInRoundId } }
+ where.projectRoundStates = { none: { roundId: excludeInRoundId } }
}
if (unassignedOnly) {
- where.roundAssignments = { none: {} }
+ where.projectRoundStates = { none: {} }
}
if (statuses?.length) where.status = { in: statuses }
if (tags && tags.length > 0) where.tags = { hasSome: tags }
@@ -1102,7 +1102,7 @@ export const projectRouter = router({
const where: Record = {
programId,
- roundAssignments: { none: {} }, // Projects not assigned to any round
+ projectRoundStates: { none: {} }, // Projects not assigned to any round
}
if (search) {
diff --git a/src/server/routers/specialAward.ts b/src/server/routers/specialAward.ts
index 5852176..2fac9b2 100644
--- a/src/server/routers/specialAward.ts
+++ b/src/server/routers/specialAward.ts
@@ -102,12 +102,17 @@ export const specialAwardRouter = router({
}
}
- // Count eligible projects
- const eligibleCount = await ctx.prisma.awardEligibility.count({
- where: { awardId: input.id, eligible: true },
- })
+ // Count eligible projects and total assessed
+ const [eligibleCount, totalAssessed] = await Promise.all([
+ ctx.prisma.awardEligibility.count({
+ where: { awardId: input.id, eligible: true },
+ }),
+ ctx.prisma.awardEligibility.count({
+ where: { awardId: input.id },
+ }),
+ ])
- return { ...award, competition, eligibleCount }
+ return { ...award, competition, eligibleCount, totalAssessed }
}),
// ─── Admin Mutations ────────────────────────────────────────────────────