fix: surface advance-type criterion in ranking yes/no counts
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:
Matt
2026-04-23 14:03:26 +02:00
parent f37a9b49b5
commit be4449e4ef
2 changed files with 11 additions and 5 deletions

View File

@@ -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'),
)