Reconcile schema with migrations and fix failed migration
- Align schema.prisma with add_15_features migration (15 discrepancies): nullability, column names, PKs, missing/extra columns, onDelete behavior - Make universal_apply_programid migration idempotent for safe re-execution - Add reconciliation migration for missing FKs and indexes - Fix message.ts and mentor.ts to match corrected schema field names Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
import { BookOpen, ClipboardList, GitCompare, Home } from 'lucide-react'
|
||||
import { RoleNav, type NavItem, type RoleNavUser } from '@/components/layouts/role-nav'
|
||||
import { trpc } from '@/lib/trpc/client'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
|
||||
const navigation: NavItem[] = [
|
||||
{
|
||||
@@ -30,6 +32,38 @@ interface JuryNavProps {
|
||||
user: RoleNavUser
|
||||
}
|
||||
|
||||
function RemainingBadge() {
|
||||
const { data: assignments } = trpc.assignment.myAssignments.useQuery(
|
||||
{},
|
||||
{ refetchInterval: 60000 }
|
||||
)
|
||||
|
||||
if (!assignments) return null
|
||||
|
||||
const now = new Date()
|
||||
const remaining = (assignments as Array<{
|
||||
round: { status: string; votingStartAt: Date | null; votingEndAt: Date | null }
|
||||
evaluation: { status: string } | null
|
||||
}>).filter((a) => {
|
||||
const isActive =
|
||||
a.round.status === 'ACTIVE' &&
|
||||
a.round.votingStartAt &&
|
||||
a.round.votingEndAt &&
|
||||
new Date(a.round.votingStartAt) <= now &&
|
||||
new Date(a.round.votingEndAt) >= now
|
||||
const isIncomplete = !a.evaluation || a.evaluation.status !== 'SUBMITTED'
|
||||
return isActive && isIncomplete
|
||||
}).length
|
||||
|
||||
if (remaining === 0) return null
|
||||
|
||||
return (
|
||||
<Badge variant="secondary" className="text-xs font-medium">
|
||||
{remaining} remaining
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
|
||||
export function JuryNav({ user }: JuryNavProps) {
|
||||
return (
|
||||
<RoleNav
|
||||
@@ -37,6 +71,7 @@ export function JuryNav({ user }: JuryNavProps) {
|
||||
roleName="Jury"
|
||||
user={user}
|
||||
basePath="/jury"
|
||||
statusBadge={<RemainingBadge />}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user