fix: surface advance-type criterion in ranking yes/no counts
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m7s
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m7s
The ranking dashboard showed 0/X Yes for every project in rounds using the 'advance' criterion type because the matcher only looked for type === 'boolean' with a "move to the next stage" label. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -443,7 +443,9 @@ export const rankingRouter = router({
|
||||
roundEvaluationScores: adminProcedure
|
||||
.input(z.object({ roundId: z.string() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
// Find the boolean criterion ID across all active forms (shared + category-specific)
|
||||
// Find the advance-decision criterion ID across all active forms (shared + category-specific).
|
||||
// Current forms use type === 'advance' (one allowed per form). Legacy forms used
|
||||
// type === 'boolean' with a "move to the next stage" label.
|
||||
const activeForms = await ctx.prisma.evaluationForm.findMany({
|
||||
where: { roundId: input.roundId, isActive: true },
|
||||
select: { criteriaJson: true },
|
||||
@@ -453,9 +455,9 @@ export const rankingRouter = router({
|
||||
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'),
|
||||
)
|
||||
const found =
|
||||
fc.find((c) => c.type === 'advance') ??
|
||||
fc.find((c) => c.type === 'boolean' && c.label?.toLowerCase().includes('move to the next stage'))
|
||||
if (found) {
|
||||
boolCriterionId = found.id
|
||||
break
|
||||
|
||||
@@ -256,10 +256,14 @@ function anonymizeProjectsForRanking(
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the boolean criterion ID for "Move to the Next Stage?" from criteria definitions.
|
||||
* Find the advance-decision criterion ID from criteria definitions.
|
||||
* Current forms use type === 'advance' (one allowed per form). Legacy forms used
|
||||
* type === 'boolean' with a "move to the next stage" label.
|
||||
* Accepts criteria from EvaluationForm.criteriaJson (preferred) or round configJson (legacy).
|
||||
*/
|
||||
function findBooleanCriterionId(criterionDefs: Array<{ id: string; label: string; type?: string }>): string | null {
|
||||
const advanceCriterion = criterionDefs.find((c) => c.type === 'advance')
|
||||
if (advanceCriterion) return advanceCriterion.id
|
||||
const boolCriterion = criterionDefs.find(
|
||||
(c) => c.type === 'boolean' && c.label?.toLowerCase().includes('move to the next stage'),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user