Compare commits
3 Commits
350e9b96e8
...
ee3bfec8b0
| Author | SHA1 | Date | |
|---|---|---|---|
| ee3bfec8b0 | |||
| 8e607478d5 | |||
| 6d4ee93ab3 |
@@ -72,7 +72,7 @@ type Stage = {
|
|||||||
status: string
|
status: string
|
||||||
roundType: string
|
roundType: string
|
||||||
windowCloseAt: Date | null
|
windowCloseAt: Date | null
|
||||||
_count: { projects: number; assignments: number }
|
_count: { projects: number; assignments: number; evaluations: number }
|
||||||
programId: string
|
programId: string
|
||||||
programName: string
|
programName: string
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,13 @@ function ProgressTab({ selectedValue, stages, stagesLoading, selectedRound }: {
|
|||||||
{stages.map((stage) => {
|
{stages.map((stage) => {
|
||||||
const projects = stage._count.projects
|
const projects = stage._count.projects
|
||||||
const assignments = stage._count.assignments
|
const assignments = stage._count.assignments
|
||||||
const rate = assignments > 0 && projects > 0 ? Math.round((assignments / projects) * 100) : 0
|
const evaluations = stage._count.evaluations
|
||||||
|
const isClosed = stage.status === 'ROUND_CLOSED' || stage.status === 'ROUND_ARCHIVED'
|
||||||
|
const rate = isClosed
|
||||||
|
? 100
|
||||||
|
: assignments > 0
|
||||||
|
? Math.min(100, Math.round((evaluations / assignments) * 100))
|
||||||
|
: 0
|
||||||
return (
|
return (
|
||||||
<TableRow key={stage.id}>
|
<TableRow key={stage.id}>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
@@ -335,7 +341,13 @@ function ProgressTab({ selectedValue, stages, stagesLoading, selectedRound }: {
|
|||||||
{stages.map((stage) => {
|
{stages.map((stage) => {
|
||||||
const projects = stage._count.projects
|
const projects = stage._count.projects
|
||||||
const assignments = stage._count.assignments
|
const assignments = stage._count.assignments
|
||||||
const rate = assignments > 0 && projects > 0 ? Math.round((assignments / projects) * 100) : 0
|
const evaluations = stage._count.evaluations
|
||||||
|
const isClosed = stage.status === 'ROUND_CLOSED' || stage.status === 'ROUND_ARCHIVED'
|
||||||
|
const rate = isClosed
|
||||||
|
? 100
|
||||||
|
: assignments > 0
|
||||||
|
? Math.min(100, Math.round((evaluations / assignments) * 100))
|
||||||
|
: 0
|
||||||
return (
|
return (
|
||||||
<Card key={stage.id}>
|
<Card key={stage.id}>
|
||||||
<CardContent className="pt-4 space-y-3">
|
<CardContent className="pt-4 space-y-3">
|
||||||
@@ -770,7 +782,7 @@ function ReportsPageContent() {
|
|||||||
const { data: programs, isLoading: stagesLoading } = trpc.program.list.useQuery({ includeStages: true })
|
const { data: programs, isLoading: stagesLoading } = trpc.program.list.useQuery({ includeStages: true })
|
||||||
|
|
||||||
const stages: Stage[] = programs?.flatMap(p =>
|
const stages: Stage[] = programs?.flatMap(p =>
|
||||||
((p.stages || []) as { id: string; name: string; status: string; roundType: string; windowCloseAt: Date | null; _count: { projects: number; assignments: number } }[]).map(s => ({
|
((p.stages || []) as { id: string; name: string; status: string; roundType: string; windowCloseAt: Date | null; _count: { projects: number; assignments: number; evaluations: number } }[]).map(s => ({
|
||||||
...s,
|
...s,
|
||||||
programId: p.id,
|
programId: p.id,
|
||||||
programName: `${p.year} Edition`,
|
programName: `${p.year} Edition`,
|
||||||
|
|||||||
@@ -43,10 +43,44 @@
|
|||||||
/* Source the JS config for extended theme values */
|
/* Source the JS config for extended theme values */
|
||||||
@config "../../tailwind.config.ts";
|
@config "../../tailwind.config.ts";
|
||||||
|
|
||||||
/* Tremor generates Tailwind utility classes dynamically (fill-blue-500, bg-emerald-500, etc.)
|
/* Tremor generates Tailwind utility classes dynamically via template literals
|
||||||
Tailwind v4 needs to scan Tremor's compiled JS to include them in the output. */
|
(e.g. `fill-${color}-${shade}`). Tailwind v4's scanner cannot detect these,
|
||||||
|
so we must explicitly safelist every color+shade+property combination. */
|
||||||
@source "../../node_modules/@tremor/react/dist/**/*.js";
|
@source "../../node_modules/@tremor/react/dist/**/*.js";
|
||||||
|
|
||||||
|
/* Safelist Tremor chart color utilities — all colors × key shades × fill/stroke/bg */
|
||||||
|
@source inline("{fill,stroke,bg,text}-{blue,emerald,amber,violet,rose,indigo,sky,fuchsia,lime,orange,cyan,teal,purple,slate,gray,zinc,neutral,stone,red,yellow,green,pink}-{50,100,200,300,400,500,600,700,800,900,950}");
|
||||||
|
@source inline("hover:{bg,text,border}-{blue,emerald,amber,violet,rose,indigo,sky,fuchsia,lime,orange,cyan,teal,purple,slate,gray,zinc,neutral,stone,red,yellow,green,pink}-{50,100,200,300,400,500,600,700,800,900,950}");
|
||||||
|
@source inline("{border,ring}-{blue,emerald,amber,violet,rose,indigo,sky,fuchsia,lime,orange,cyan,teal,purple,slate,gray,zinc,neutral,stone,red,yellow,green,pink}-{50,100,200,300,400,500,600,700,800,900,950}");
|
||||||
|
|
||||||
|
/* Safelist Tremor design token utility classes */
|
||||||
|
@source inline("{fill,stroke,bg,text,border}-tremor-{brand,background,border,content,content-emphasis,default,label,card,dropdown}");
|
||||||
|
|
||||||
|
/* Tremor design tokens — normally registered by Tremor's TW3 plugin.
|
||||||
|
We define them manually for Tailwind v4 compatibility. */
|
||||||
|
@theme {
|
||||||
|
--color-tremor-brand: var(--color-blue-500);
|
||||||
|
--color-tremor-brand-emphasis: var(--color-blue-700);
|
||||||
|
--color-tremor-brand-inverted: #fff;
|
||||||
|
--color-tremor-brand-muted: var(--color-blue-200);
|
||||||
|
--color-tremor-brand-faint: var(--color-blue-50);
|
||||||
|
--color-tremor-background: #fff;
|
||||||
|
--color-tremor-background-emphasis: var(--color-gray-700);
|
||||||
|
--color-tremor-background-muted: var(--color-gray-50);
|
||||||
|
--color-tremor-background-subtle: var(--color-gray-100);
|
||||||
|
--color-tremor-border: var(--color-gray-200);
|
||||||
|
--color-tremor-content: var(--color-gray-500);
|
||||||
|
--color-tremor-content-emphasis: var(--color-gray-700);
|
||||||
|
--color-tremor-content-strong: var(--color-gray-900);
|
||||||
|
--color-tremor-content-subtle: var(--color-gray-400);
|
||||||
|
--color-tremor-content-inverted: #fff;
|
||||||
|
--color-tremor-ring: var(--color-gray-200);
|
||||||
|
--color-tremor-default: var(--color-gray-500);
|
||||||
|
--color-tremor-label: var(--color-gray-400);
|
||||||
|
--color-tremor-card: #fff;
|
||||||
|
--color-tremor-dropdown: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
/* Theme variables - using CSS custom properties with Tailwind v4 @theme */
|
/* Theme variables - using CSS custom properties with Tailwind v4 @theme */
|
||||||
@theme {
|
@theme {
|
||||||
/* Container */
|
/* Container */
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ export const programRouter = router({
|
|||||||
_count: {
|
_count: {
|
||||||
select: { assignments: true, projectRoundStates: true },
|
select: { assignments: true, projectRoundStates: true },
|
||||||
},
|
},
|
||||||
|
assignments: {
|
||||||
|
where: { evaluation: { status: 'SUBMITTED' } },
|
||||||
|
select: { id: true },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -52,9 +56,11 @@ export const programRouter = router({
|
|||||||
// Provide `stages` as alias for backward compatibility
|
// Provide `stages` as alias for backward compatibility
|
||||||
stages: allRounds.map((round: any) => ({
|
stages: allRounds.map((round: any) => ({
|
||||||
...round,
|
...round,
|
||||||
|
assignments: undefined, // don't leak raw assignments array
|
||||||
_count: {
|
_count: {
|
||||||
projects: round._count?.projectRoundStates || 0,
|
projects: round._count?.projectRoundStates || 0,
|
||||||
assignments: round._count?.assignments || 0,
|
assignments: round._count?.assignments || 0,
|
||||||
|
evaluations: round.assignments?.length || 0,
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
// Main rounds array
|
// Main rounds array
|
||||||
@@ -68,6 +74,7 @@ export const programRouter = router({
|
|||||||
_count: {
|
_count: {
|
||||||
projects: round._count?.projectRoundStates || 0,
|
projects: round._count?.projectRoundStates || 0,
|
||||||
assignments: round._count?.assignments || 0,
|
assignments: round._count?.assignments || 0,
|
||||||
|
evaluations: round.assignments?.length || 0,
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user