feat: per-category evaluation criteria (startup vs business concept)
Add ability to define completely different evaluation criteria for each competition category. Admins toggle "Separate Criteria per Category" in round config, then configure criteria independently via tabbed editor. - Schema: add nullable `category` to EvaluationForm with updated constraints - Config: add `perCategoryCriteria` boolean to EvaluationConfigSchema - Helper: new `findActiveForm()` with category-aware resolution + fallback - Backend: getForm, upsertForm, getStageForm, startStage all category-aware - AI services: use project category for form lookup in summaries + ranking - Export/ranking: merge criteria from all active forms for cross-category reports - Admin UI: toggle switch + tabbed criteria editor with per-category builders - Jury UI: auto-selects correct form based on project category (invisible to juror) - Fully backwards compatible: toggle defaults OFF, existing forms unchanged Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -443,17 +443,24 @@ export const rankingRouter = router({
|
||||
roundEvaluationScores: adminProcedure
|
||||
.input(z.object({ roundId: z.string() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
// Find the boolean criterion ID from the EvaluationForm (not round configJson)
|
||||
const evalForm = await ctx.prisma.evaluationForm.findFirst({
|
||||
// Find the boolean criterion ID across all active forms (shared + category-specific)
|
||||
const activeForms = await ctx.prisma.evaluationForm.findMany({
|
||||
where: { roundId: input.roundId, isActive: true },
|
||||
select: { criteriaJson: true },
|
||||
})
|
||||
const formCriteria = (evalForm?.criteriaJson as Array<{
|
||||
id: string; label: string; type?: string
|
||||
}> | null) ?? []
|
||||
const boolCriterionId = formCriteria.find(
|
||||
(c) => c.type === 'boolean' && c.label?.toLowerCase().includes('move to the next stage'),
|
||||
)?.id ?? null
|
||||
let boolCriterionId: string | null = null
|
||||
for (const f of activeForms) {
|
||||
const fc = (f.criteriaJson as Array<{
|
||||
id: string; label: string; type?: string
|
||||
}> | null) ?? []
|
||||
const found = fc.find(
|
||||
(c) => c.type === 'boolean' && c.label?.toLowerCase().includes('move to the next stage'),
|
||||
)
|
||||
if (found) {
|
||||
boolCriterionId = found.id
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const assignments = await ctx.prisma.assignment.findMany({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user